All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] exec: Ensure variable page size is only used with TARGET_PAGE_BITS_VARY
@ 2020-11-04  9:35 Philippe Mathieu-Daudé
  2020-11-04  9:35 ` [PATCH 1/2] MAINTAINERS: Cover exec-vary.c (variable page size) Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-04  9:35 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, Philippe Mathieu-Daudé,
	Richard Henderson

Simple patch while trying to figure out Fuloong-2E 16KB page size.
Better safe than sorry =)

Philippe Mathieu-Daudé (2):
  MAINTAINERS: Cover exec-vary.c (variable page size)
  exec: Ensure variable page size is only used with
    TARGET_PAGE_BITS_VARY

 include/qemu-common.h | 4 +++-
 exec-vary.c           | 4 +++-
 MAINTAINERS           | 1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

-- 
2.26.2



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] MAINTAINERS: Cover exec-vary.c (variable page size)
  2020-11-04  9:35 [PATCH 0/2] exec: Ensure variable page size is only used with TARGET_PAGE_BITS_VARY Philippe Mathieu-Daudé
@ 2020-11-04  9:35 ` Philippe Mathieu-Daudé
  2020-11-04  9:35 ` [PATCH 2/2] exec: Ensure variable page size is only used with TARGET_PAGE_BITS_VARY Philippe Mathieu-Daudé
  2020-11-23 12:28 ` [PATCH-for-6.0 0/2] " Philippe Mathieu-Daudé
  2 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-04  9:35 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, Philippe Mathieu-Daudé,
	Richard Henderson

Add exec-vary.c to the 'Overall TCG CPUs' section.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index dd16606bcdc..466898d3dbd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -117,6 +117,7 @@ R: Paolo Bonzini <pbonzini@redhat.com>
 S: Maintained
 F: softmmu/cpus.c
 F: cpus-common.c
+F: exec-vary.c
 F: accel/tcg/
 F: accel/stubs/tcg-stub.c
 F: scripts/decodetree.py
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] exec: Ensure variable page size is only used with TARGET_PAGE_BITS_VARY
  2020-11-04  9:35 [PATCH 0/2] exec: Ensure variable page size is only used with TARGET_PAGE_BITS_VARY Philippe Mathieu-Daudé
  2020-11-04  9:35 ` [PATCH 1/2] MAINTAINERS: Cover exec-vary.c (variable page size) Philippe Mathieu-Daudé
@ 2020-11-04  9:35 ` Philippe Mathieu-Daudé
  2020-11-24 16:12   ` Richard Henderson
  2020-11-23 12:28 ` [PATCH-for-6.0 0/2] " Philippe Mathieu-Daudé
  2 siblings, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-04  9:35 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, Philippe Mathieu-Daudé,
	Richard Henderson

If TARGET_PAGE_BITS_VARY is not supported, machines should not
intent to modify the target page size.
As set_preferred_target_page_bits() is supposed to return 'false'
on failure (documented in "qemu-common.h"), return false to
indicate failure if this ever happens.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/qemu-common.h | 4 +++-
 exec-vary.c           | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/qemu-common.h b/include/qemu-common.h
index fda7dc6ca77..3ea616d4567 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -70,7 +70,9 @@ void cpu_exec_step_atomic(CPUState *cpu);
  * size may be smaller than any given CPU's preference).
  * Returns true on success, false on failure (which can only happen
  * if this is called after the system has already finalized its
- * choice of page size and the requested page size is smaller than that).
+ * choice of page size and the requested page size is smaller than
+ * that). Only target supporting variable page size should set a
+ * preferred target page size.
  */
 bool set_preferred_target_page_bits(int bits);
 
diff --git a/exec-vary.c b/exec-vary.c
index ff905f2a8fb..4b0b7f193af 100644
--- a/exec-vary.c
+++ b/exec-vary.c
@@ -86,8 +86,10 @@ bool set_preferred_target_page_bits(int bits)
         }
         init_target_page.bits = bits;
     }
-#endif
     return true;
+#else
+    return false;
+#endif
 }
 
 void finalize_target_page_bits(void)
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH-for-6.0 0/2] exec: Ensure variable page size is only used with TARGET_PAGE_BITS_VARY
  2020-11-04  9:35 [PATCH 0/2] exec: Ensure variable page size is only used with TARGET_PAGE_BITS_VARY Philippe Mathieu-Daudé
  2020-11-04  9:35 ` [PATCH 1/2] MAINTAINERS: Cover exec-vary.c (variable page size) Philippe Mathieu-Daudé
  2020-11-04  9:35 ` [PATCH 2/2] exec: Ensure variable page size is only used with TARGET_PAGE_BITS_VARY Philippe Mathieu-Daudé
@ 2020-11-23 12:28 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-23 12:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Richard Henderson

ping?

On 11/4/20 10:35 AM, Philippe Mathieu-Daudé wrote:
> Simple patch while trying to figure out Fuloong-2E 16KB page size.
> Better safe than sorry =)
> 
> Philippe Mathieu-Daudé (2):
>   MAINTAINERS: Cover exec-vary.c (variable page size)
>   exec: Ensure variable page size is only used with
>     TARGET_PAGE_BITS_VARY
> 
>  include/qemu-common.h | 4 +++-
>  exec-vary.c           | 4 +++-
>  MAINTAINERS           | 1 +
>  3 files changed, 7 insertions(+), 2 deletions(-)
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] exec: Ensure variable page size is only used with TARGET_PAGE_BITS_VARY
  2020-11-04  9:35 ` [PATCH 2/2] exec: Ensure variable page size is only used with TARGET_PAGE_BITS_VARY Philippe Mathieu-Daudé
@ 2020-11-24 16:12   ` Richard Henderson
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2020-11-24 16:12 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Paolo Bonzini, Richard Henderson

On 11/4/20 1:35 AM, Philippe Mathieu-Daudé wrote:
> If TARGET_PAGE_BITS_VARY is not supported, machines should not
> intent to modify the target page size.
> As set_preferred_target_page_bits() is supposed to return 'false'
> on failure (documented in "qemu-common.h"), return false to
> indicate failure if this ever happens.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  include/qemu-common.h | 4 +++-
>  exec-vary.c           | 4 +++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/include/qemu-common.h b/include/qemu-common.h
> index fda7dc6ca77..3ea616d4567 100644
> --- a/include/qemu-common.h
> +++ b/include/qemu-common.h
> @@ -70,7 +70,9 @@ void cpu_exec_step_atomic(CPUState *cpu);
>   * size may be smaller than any given CPU's preference).
>   * Returns true on success, false on failure (which can only happen
>   * if this is called after the system has already finalized its
> - * choice of page size and the requested page size is smaller than that).
> + * choice of page size and the requested page size is smaller than
> + * that). Only target supporting variable page size should set a
> + * preferred target page size.
>   */
>  bool set_preferred_target_page_bits(int bits);
>  
> diff --git a/exec-vary.c b/exec-vary.c
> index ff905f2a8fb..4b0b7f193af 100644
> --- a/exec-vary.c
> +++ b/exec-vary.c
> @@ -86,8 +86,10 @@ bool set_preferred_target_page_bits(int bits)
>          }
>          init_target_page.bits = bits;
>      }
> -#endif
>      return true;
> +#else
> +    return false;
> +#endif

I guess the only generic caller is the one in softmmu/vl.c, which is protected
by machine_class->minimum_page_bits != 0.  So this affects exactly one machine
outside arm -- fuloong2e.

Certainly we should not allow an impossible setting.  I wonder if it is worth
doing return bits == TARGET_PAGE_BITS?

Either way,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-24 16:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04  9:35 [PATCH 0/2] exec: Ensure variable page size is only used with TARGET_PAGE_BITS_VARY Philippe Mathieu-Daudé
2020-11-04  9:35 ` [PATCH 1/2] MAINTAINERS: Cover exec-vary.c (variable page size) Philippe Mathieu-Daudé
2020-11-04  9:35 ` [PATCH 2/2] exec: Ensure variable page size is only used with TARGET_PAGE_BITS_VARY Philippe Mathieu-Daudé
2020-11-24 16:12   ` Richard Henderson
2020-11-23 12:28 ` [PATCH-for-6.0 0/2] " Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.