[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 29/33] linux-user: Allow TARGET_PAGE_BITS_VARY
From: |
Ilya Leoshkevich |
Subject: |
Re: [PATCH v3 29/33] linux-user: Allow TARGET_PAGE_BITS_VARY |
Date: |
Tue, 30 Jan 2024 14:47:30 +0100 |
On Tue, Jan 02, 2024 at 12:58:04PM +1100, Richard Henderson wrote:
> If set, match the host and guest page sizes.
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> linux-user/main.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
[...]
> @@ -794,6 +796,16 @@ int main(int argc, char **argv, char **envp)
> opt_one_insn_per_tb, &error_abort);
> ac->init_machine(NULL);
> }
> +
> + /*
> + * Finalize page size before creating CPUs.
> + * This will do nothing if !TARGET_PAGE_BITS_VARY.
> + * The most efficient setting is to match the host.
> + */
> + host_page_size = qemu_real_host_page_size();
> + set_preferred_target_page_bits(ctz32(host_page_size));
> + finalize_target_page_bits();
> +
> cpu = cpu_create(cpu_type);
> env = cpu_env(cpu);
> cpu_reset(cpu);
Not sure if that's an officially blessed use case, but I tried to
increase the alpha page size to 8k by doing
--- a/target/alpha/cpu-param.h
+++ b/target/alpha/cpu-param.h
@@ -20,7 +20,7 @@
* a 4k minimum to match x86 host, which can minimize emulation issues.
*/
# define TARGET_PAGE_BITS_VARY
-# define TARGET_PAGE_BITS_MIN 12
+# define TARGET_PAGE_BITS_MIN 13
# define TARGET_VIRT_ADDR_SPACE_BITS 63
#else
# define TARGET_PAGE_BITS 13
and this triggered an assetion in set_preferred_target_page_bits().
I wonder if it would make sense to add something like the following to
this patch?
--- a/page-vary-target.c
+++ b/page-vary-target.c
@@ -26,8 +26,7 @@
bool set_preferred_target_page_bits(int bits)
{
#ifdef TARGET_PAGE_BITS_VARY
- assert(bits >= TARGET_PAGE_BITS_MIN);
- return set_preferred_target_page_bits_common(bits);
+ return set_preferred_target_page_bits_common(MAX(TARGET_PAGE_BITS_MIN,
bits));
#else
return true;
#endif
- [PATCH v3 26/33] *-user: Deprecate and disable -p pagesize, (continued)
- [PATCH v3 26/33] *-user: Deprecate and disable -p pagesize, Richard Henderson, 2024/01/01
- [PATCH v3 27/33] cpu: Remove page_size_init, Richard Henderson, 2024/01/01
- [PATCH v3 25/33] tests/tcg: Extend file in linux-madvise.c, Richard Henderson, 2024/01/01
- [PATCH v3 28/33] accel/tcg: Disconnect TargetPageDataNode from page size, Richard Henderson, 2024/01/01
- [PATCH v3 29/33] linux-user: Allow TARGET_PAGE_BITS_VARY, Richard Henderson, 2024/01/01
- Re: [PATCH v3 29/33] linux-user: Allow TARGET_PAGE_BITS_VARY,
Ilya Leoshkevich <=
- [PATCH v3 31/33] linux-user: Bound mmap_min_addr by host page size, Richard Henderson, 2024/01/01
- [PATCH v3 30/33] target/arm: Enable TARGET_PAGE_BITS_VARY for AArch64 user-only, Richard Henderson, 2024/01/01
- [PATCH v3 33/33] target/alpha: Enable TARGET_PAGE_BITS_VARY for user-only, Richard Henderson, 2024/01/01
- [PATCH v3 32/33] target/ppc: Enable TARGET_PAGE_BITS_VARY for user-only, Richard Henderson, 2024/01/01