* Re: [PATCH v2] KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn() [not found] ` <8cae6330-f88a-ec24-4e7d-bc999f49288d@de.ibm.com> @ 2021-06-08 10:03 ` Christian Borntraeger 2021-06-08 11:45 ` [PATCH] KVM: selftests: introduce P47V64 for s390x Christian Borntraeger 2021-06-08 12:39 ` [PATCH v2] " Christian Borntraeger 0 siblings, 2 replies; 8+ messages in thread From: Christian Borntraeger @ 2021-06-08 10:03 UTC (permalink / raw) To: David Matlack, kvm, Venkatesh Srinivas Cc: Paolo Bonzini, Andrew Jones, Ben Gardon, Peter Xu, linux-s390, Janosch Frank On 08.06.21 10:39, Christian Borntraeger wrote: > > > On 21.05.21 19:38, David Matlack wrote: >> vm_get_max_gfn() casts vm->max_gfn from a uint64_t to an unsigned int, >> which causes the upper 32-bits of the max_gfn to get truncated. >> >> Nobody noticed until now likely because vm_get_max_gfn() is only used >> as a mechanism to create a memslot in an unused region of the guest >> physical address space (the top), and the top of the 32-bit physical >> address space was always good enough. >> >> This fix reveals a bug in memslot_modification_stress_test which was >> trying to create a dummy memslot past the end of guest physical memory. >> Fix that by moving the dummy memslot lower. >> >> Fixes: 52200d0d944e ("KVM: selftests: Remove duplicate guest mode handling") >> Reviewed-by: Venkatesh Srinivas <venkateshs@chromium.org> >> Signed-off-by: David Matlack <dmatlack@google.com> > > As a heads up: > I have not yet looked into this, but this broke demand_paging_test and kvm_page_table_test > on s390: > > not ok 4 selftests: kvm: demand_paging_test # exit=254 > # selftests: kvm: dirty_log_test > # ==== Test Assertion Failure ==== > # lib/kvm_util.c:900: ret == 0 > # pid=245410 tid=245410 errno=22 - Invalid argument > # 1 0x0000000001005457: vm_userspace_mem_region_add at kvm_util.c:900 > # 2 0x0000000001002cbf: run_test at dirty_log_test.c:757 > # 3 (inlined by) run_test at dirty_log_test.c:702 > # 4 0x000000000100c055: for_each_guest_mode at guest_modes.c:37 > # 5 0x00000000010022b5: main at dirty_log_test.c:929 (discriminator 3) > # 6 0x000003ff96fabdb3: ?? ??:0 > # 7 0x000000000100241d: .annobin_lto.hot at crt1.o:? > # KVM_SET_USER_MEMORY_REGION IOCTL failed, > # rc: -1 errno: 22 > # slot: 1 flags: 0x1 > # guest_phys_addr: 0xfffffbfe00000 size: 0x40100000 Ah. We do have a limit of 128TB for guest physical memory. The patch now made this apparent as we no longer cut the upper bits off. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] KVM: selftests: introduce P47V64 for s390x 2021-06-08 10:03 ` [PATCH v2] KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn() Christian Borntraeger @ 2021-06-08 11:45 ` Christian Borntraeger 2021-06-08 11:49 ` Janosch Frank 2021-06-08 12:18 ` Christian Borntraeger 2021-06-08 12:39 ` [PATCH v2] " Christian Borntraeger 1 sibling, 2 replies; 8+ messages in thread From: Christian Borntraeger @ 2021-06-08 11:45 UTC (permalink / raw) To: pbonzini Cc: borntraeger, bgardon, dmatlack, drjones, frankja, kvm, linux-s390, peterx, venkateshs s390x can have up to 47bits of physical guest and 64bits of virtual address bits. Add a new address mode to avoid errors of testcases going beyond 47bits. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> --- tools/testing/selftests/kvm/include/kvm_util.h | 3 ++- tools/testing/selftests/kvm/lib/kvm_util.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h index fcd8e3855111..6d3f71822976 100644 --- a/tools/testing/selftests/kvm/include/kvm_util.h +++ b/tools/testing/selftests/kvm/include/kvm_util.h @@ -43,6 +43,7 @@ enum vm_guest_mode { VM_MODE_P40V48_4K, VM_MODE_P40V48_64K, VM_MODE_PXXV48_4K, /* For 48bits VA but ANY bits PA */ + VM_MODE_P47V64_4K, /* For 48bits VA but ANY bits PA */ NUM_VM_MODES, }; @@ -60,7 +61,7 @@ enum vm_guest_mode { #elif defined(__s390x__) -#define VM_MODE_DEFAULT VM_MODE_P52V48_4K +#define VM_MODE_DEFAULT VM_MODE_P47V64_4K #define MIN_PAGE_SHIFT 12U #define ptes_per_page(page_size) ((page_size) / 16) diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 28e528c19d28..d61ad15b1979 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -175,6 +175,7 @@ const char *vm_guest_mode_string(uint32_t i) [VM_MODE_P40V48_4K] = "PA-bits:40, VA-bits:48, 4K pages", [VM_MODE_P40V48_64K] = "PA-bits:40, VA-bits:48, 64K pages", [VM_MODE_PXXV48_4K] = "PA-bits:ANY, VA-bits:48, 4K pages", + [VM_MODE_P47V64_4K] = "PA-bits:47, VA-bits:64, 4K pages", }; _Static_assert(sizeof(strings)/sizeof(char *) == NUM_VM_MODES, "Missing new mode strings?"); @@ -192,6 +193,7 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = { { 40, 48, 0x1000, 12 }, { 40, 48, 0x10000, 16 }, { 0, 0, 0x1000, 12 }, + { 47, 64, 0x1000, 12 }, }; _Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES, "Missing new mode params?"); @@ -277,6 +279,9 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm) TEST_FAIL("VM_MODE_PXXV48_4K not supported on non-x86 platforms"); #endif break; + case VM_MODE_P47V64_4K: + vm->pgtable_levels = 4; + break; default: TEST_FAIL("Unknown guest mode, mode: 0x%x", mode); } -- 2.31.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: selftests: introduce P47V64 for s390x 2021-06-08 11:45 ` [PATCH] KVM: selftests: introduce P47V64 for s390x Christian Borntraeger @ 2021-06-08 11:49 ` Janosch Frank 2021-06-08 11:55 ` Christian Borntraeger 2021-06-08 12:18 ` Christian Borntraeger 1 sibling, 1 reply; 8+ messages in thread From: Janosch Frank @ 2021-06-08 11:49 UTC (permalink / raw) To: Christian Borntraeger, pbonzini Cc: bgardon, dmatlack, drjones, kvm, linux-s390, peterx, venkateshs On 6/8/21 1:45 PM, Christian Borntraeger wrote: > s390x can have up to 47bits of physical guest and 64bits of virtual > address bits. Add a new address mode to avoid errors of testcases > going beyond 47bits. > > Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> > --- > tools/testing/selftests/kvm/include/kvm_util.h | 3 ++- > tools/testing/selftests/kvm/lib/kvm_util.c | 5 +++++ > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h > index fcd8e3855111..6d3f71822976 100644 > --- a/tools/testing/selftests/kvm/include/kvm_util.h > +++ b/tools/testing/selftests/kvm/include/kvm_util.h > @@ -43,6 +43,7 @@ enum vm_guest_mode { > VM_MODE_P40V48_4K, > VM_MODE_P40V48_64K, > VM_MODE_PXXV48_4K, /* For 48bits VA but ANY bits PA */ > + VM_MODE_P47V64_4K, /* For 48bits VA but ANY bits PA */ /* 64 bits VA but 47 bits PA */ Or, looking at the other entries above, just remove it. > NUM_VM_MODES, > }; > > @@ -60,7 +61,7 @@ enum vm_guest_mode { > > #elif defined(__s390x__) > > -#define VM_MODE_DEFAULT VM_MODE_P52V48_4K > +#define VM_MODE_DEFAULT VM_MODE_P47V64_4K > #define MIN_PAGE_SHIFT 12U > #define ptes_per_page(page_size) ((page_size) / 16) > > diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c > index 28e528c19d28..d61ad15b1979 100644 > --- a/tools/testing/selftests/kvm/lib/kvm_util.c > +++ b/tools/testing/selftests/kvm/lib/kvm_util.c > @@ -175,6 +175,7 @@ const char *vm_guest_mode_string(uint32_t i) > [VM_MODE_P40V48_4K] = "PA-bits:40, VA-bits:48, 4K pages", > [VM_MODE_P40V48_64K] = "PA-bits:40, VA-bits:48, 64K pages", > [VM_MODE_PXXV48_4K] = "PA-bits:ANY, VA-bits:48, 4K pages", > + [VM_MODE_P47V64_4K] = "PA-bits:47, VA-bits:64, 4K pages", > }; > _Static_assert(sizeof(strings)/sizeof(char *) == NUM_VM_MODES, > "Missing new mode strings?"); > @@ -192,6 +193,7 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = { > { 40, 48, 0x1000, 12 }, > { 40, 48, 0x10000, 16 }, > { 0, 0, 0x1000, 12 }, > + { 47, 64, 0x1000, 12 }, > }; > _Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES, > "Missing new mode params?"); > @@ -277,6 +279,9 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm) > TEST_FAIL("VM_MODE_PXXV48_4K not supported on non-x86 platforms"); > #endif > break; > + case VM_MODE_P47V64_4K: > + vm->pgtable_levels = 4; > + break; > default: > TEST_FAIL("Unknown guest mode, mode: 0x%x", mode); > } > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: selftests: introduce P47V64 for s390x 2021-06-08 11:49 ` Janosch Frank @ 2021-06-08 11:55 ` Christian Borntraeger 0 siblings, 0 replies; 8+ messages in thread From: Christian Borntraeger @ 2021-06-08 11:55 UTC (permalink / raw) To: Janosch Frank, pbonzini Cc: bgardon, dmatlack, drjones, kvm, linux-s390, peterx, venkateshs On 08.06.21 13:49, Janosch Frank wrote: > On 6/8/21 1:45 PM, Christian Borntraeger wrote: >> s390x can have up to 47bits of physical guest and 64bits of virtual >> address bits. Add a new address mode to avoid errors of testcases >> going beyond 47bits. >> >> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> >> --- >> tools/testing/selftests/kvm/include/kvm_util.h | 3 ++- >> tools/testing/selftests/kvm/lib/kvm_util.c | 5 +++++ >> 2 files changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h >> index fcd8e3855111..6d3f71822976 100644 >> --- a/tools/testing/selftests/kvm/include/kvm_util.h >> +++ b/tools/testing/selftests/kvm/include/kvm_util.h >> @@ -43,6 +43,7 @@ enum vm_guest_mode { >> VM_MODE_P40V48_4K, >> VM_MODE_P40V48_64K, >> VM_MODE_PXXV48_4K, /* For 48bits VA but ANY bits PA */ >> + VM_MODE_P47V64_4K, /* For 48bits VA but ANY bits PA */ > > /* 64 bits VA but 47 bits PA */ > > Or, looking at the other entries above, just remove it. Yes, will remove. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] KVM: selftests: introduce P47V64 for s390x 2021-06-08 11:45 ` [PATCH] KVM: selftests: introduce P47V64 for s390x Christian Borntraeger 2021-06-08 11:49 ` Janosch Frank @ 2021-06-08 12:18 ` Christian Borntraeger 1 sibling, 0 replies; 8+ messages in thread From: Christian Borntraeger @ 2021-06-08 12:18 UTC (permalink / raw) To: pbonzini Cc: bgardon, dmatlack, drjones, frankja, kvm, linux-s390, peterx, venkateshs On 08.06.21 13:45, Christian Borntraeger wrote: > s390x can have up to 47bits of physical guest and 64bits of virtual > address bits. Add a new address mode to avoid errors of testcases > going beyond 47bits. > > Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> > --- > tools/testing/selftests/kvm/include/kvm_util.h | 3 ++- > tools/testing/selftests/kvm/lib/kvm_util.c | 5 +++++ > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h > index fcd8e3855111..6d3f71822976 100644 > --- a/tools/testing/selftests/kvm/include/kvm_util.h > +++ b/tools/testing/selftests/kvm/include/kvm_util.h > @@ -43,6 +43,7 @@ enum vm_guest_mode { > VM_MODE_P40V48_4K, > VM_MODE_P40V48_64K, > VM_MODE_PXXV48_4K, /* For 48bits VA but ANY bits PA */ > + VM_MODE_P47V64_4K, /* For 48bits VA but ANY bits PA */ > NUM_VM_MODES, > }; > > @@ -60,7 +61,7 @@ enum vm_guest_mode { > > #elif defined(__s390x__) > > -#define VM_MODE_DEFAULT VM_MODE_P52V48_4K > +#define VM_MODE_DEFAULT VM_MODE_P47V64_4K > #define MIN_PAGE_SHIFT 12U > #define ptes_per_page(page_size) ((page_size) / 16) > > diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c > index 28e528c19d28..d61ad15b1979 100644 > --- a/tools/testing/selftests/kvm/lib/kvm_util.c > +++ b/tools/testing/selftests/kvm/lib/kvm_util.c > @@ -175,6 +175,7 @@ const char *vm_guest_mode_string(uint32_t i) > [VM_MODE_P40V48_4K] = "PA-bits:40, VA-bits:48, 4K pages", > [VM_MODE_P40V48_64K] = "PA-bits:40, VA-bits:48, 64K pages", > [VM_MODE_PXXV48_4K] = "PA-bits:ANY, VA-bits:48, 4K pages", > + [VM_MODE_P47V64_4K] = "PA-bits:47, VA-bits:64, 4K pages", > }; > _Static_assert(sizeof(strings)/sizeof(char *) == NUM_VM_MODES, > "Missing new mode strings?"); > @@ -192,6 +193,7 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = { > { 40, 48, 0x1000, 12 }, > { 40, 48, 0x10000, 16 }, > { 0, 0, 0x1000, 12 }, > + { 47, 64, 0x1000, 12 }, > }; > _Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES, > "Missing new mode params?"); > @@ -277,6 +279,9 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm) > TEST_FAIL("VM_MODE_PXXV48_4K not supported on non-x86 platforms"); > #endif > break; > + case VM_MODE_P47V64_4K: > + vm->pgtable_levels = 4; I will change that to 5 as well. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] KVM: selftests: introduce P47V64 for s390x 2021-06-08 10:03 ` [PATCH v2] KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn() Christian Borntraeger 2021-06-08 11:45 ` [PATCH] KVM: selftests: introduce P47V64 for s390x Christian Borntraeger @ 2021-06-08 12:39 ` Christian Borntraeger 2021-06-08 16:41 ` David Matlack 2021-06-08 17:19 ` Paolo Bonzini 1 sibling, 2 replies; 8+ messages in thread From: Christian Borntraeger @ 2021-06-08 12:39 UTC (permalink / raw) To: pbonzini Cc: borntraeger, bgardon, dmatlack, drjones, frankja, kvm, linux-s390, peterx, venkateshs s390x can have up to 47bits of physical guest and 64bits of virtual address bits. Add a new address mode to avoid errors of testcases going beyond 47bits. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> --- v1->v2: - remove wrong comment - use 5 levels of page tables tools/testing/selftests/kvm/include/kvm_util.h | 3 ++- tools/testing/selftests/kvm/lib/kvm_util.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h index fcd8e3855111..b602552b1ed0 100644 --- a/tools/testing/selftests/kvm/include/kvm_util.h +++ b/tools/testing/selftests/kvm/include/kvm_util.h @@ -43,6 +43,7 @@ enum vm_guest_mode { VM_MODE_P40V48_4K, VM_MODE_P40V48_64K, VM_MODE_PXXV48_4K, /* For 48bits VA but ANY bits PA */ + VM_MODE_P47V64_4K, NUM_VM_MODES, }; @@ -60,7 +61,7 @@ enum vm_guest_mode { #elif defined(__s390x__) -#define VM_MODE_DEFAULT VM_MODE_P52V48_4K +#define VM_MODE_DEFAULT VM_MODE_P47V64_4K #define MIN_PAGE_SHIFT 12U #define ptes_per_page(page_size) ((page_size) / 16) diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 28e528c19d28..b126fab6c4e1 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -175,6 +175,7 @@ const char *vm_guest_mode_string(uint32_t i) [VM_MODE_P40V48_4K] = "PA-bits:40, VA-bits:48, 4K pages", [VM_MODE_P40V48_64K] = "PA-bits:40, VA-bits:48, 64K pages", [VM_MODE_PXXV48_4K] = "PA-bits:ANY, VA-bits:48, 4K pages", + [VM_MODE_P47V64_4K] = "PA-bits:47, VA-bits:64, 4K pages", }; _Static_assert(sizeof(strings)/sizeof(char *) == NUM_VM_MODES, "Missing new mode strings?"); @@ -192,6 +193,7 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = { { 40, 48, 0x1000, 12 }, { 40, 48, 0x10000, 16 }, { 0, 0, 0x1000, 12 }, + { 47, 64, 0x1000, 12 }, }; _Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES, "Missing new mode params?"); @@ -277,6 +279,9 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm) TEST_FAIL("VM_MODE_PXXV48_4K not supported on non-x86 platforms"); #endif break; + case VM_MODE_P47V64_4K: + vm->pgtable_levels = 5; + break; default: TEST_FAIL("Unknown guest mode, mode: 0x%x", mode); } -- 2.31.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] KVM: selftests: introduce P47V64 for s390x 2021-06-08 12:39 ` [PATCH v2] " Christian Borntraeger @ 2021-06-08 16:41 ` David Matlack 2021-06-08 17:19 ` Paolo Bonzini 1 sibling, 0 replies; 8+ messages in thread From: David Matlack @ 2021-06-08 16:41 UTC (permalink / raw) To: Christian Borntraeger Cc: pbonzini, bgardon, drjones, frankja, kvm, linux-s390, peterx, venkateshs On Tue, Jun 08, 2021 at 02:39:54PM +0200, Christian Borntraeger wrote: > s390x can have up to 47bits of physical guest and 64bits of virtual > address bits. Add a new address mode to avoid errors of testcases > going beyond 47bits. Thanks for the fix. My apologies for breaking s390. The patch "KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn()" has already been added to stable so you may want to add the following: Fixes: ef4c9f4f6546 ("KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn()") Cc: stable@vger.kernel.org > > Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: David Matlack <dmatlack@google.com> > --- > v1->v2: > - remove wrong comment > - use 5 levels of page tables > tools/testing/selftests/kvm/include/kvm_util.h | 3 ++- > tools/testing/selftests/kvm/lib/kvm_util.c | 5 +++++ > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h > index fcd8e3855111..b602552b1ed0 100644 > --- a/tools/testing/selftests/kvm/include/kvm_util.h > +++ b/tools/testing/selftests/kvm/include/kvm_util.h > @@ -43,6 +43,7 @@ enum vm_guest_mode { > VM_MODE_P40V48_4K, > VM_MODE_P40V48_64K, > VM_MODE_PXXV48_4K, /* For 48bits VA but ANY bits PA */ > + VM_MODE_P47V64_4K, > NUM_VM_MODES, > }; > > @@ -60,7 +61,7 @@ enum vm_guest_mode { > > #elif defined(__s390x__) > > -#define VM_MODE_DEFAULT VM_MODE_P52V48_4K > +#define VM_MODE_DEFAULT VM_MODE_P47V64_4K > #define MIN_PAGE_SHIFT 12U > #define ptes_per_page(page_size) ((page_size) / 16) > > diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c > index 28e528c19d28..b126fab6c4e1 100644 > --- a/tools/testing/selftests/kvm/lib/kvm_util.c > +++ b/tools/testing/selftests/kvm/lib/kvm_util.c > @@ -175,6 +175,7 @@ const char *vm_guest_mode_string(uint32_t i) > [VM_MODE_P40V48_4K] = "PA-bits:40, VA-bits:48, 4K pages", > [VM_MODE_P40V48_64K] = "PA-bits:40, VA-bits:48, 64K pages", > [VM_MODE_PXXV48_4K] = "PA-bits:ANY, VA-bits:48, 4K pages", > + [VM_MODE_P47V64_4K] = "PA-bits:47, VA-bits:64, 4K pages", > }; > _Static_assert(sizeof(strings)/sizeof(char *) == NUM_VM_MODES, > "Missing new mode strings?"); > @@ -192,6 +193,7 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = { > { 40, 48, 0x1000, 12 }, > { 40, 48, 0x10000, 16 }, > { 0, 0, 0x1000, 12 }, > + { 47, 64, 0x1000, 12 }, > }; > _Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES, > "Missing new mode params?"); > @@ -277,6 +279,9 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm) > TEST_FAIL("VM_MODE_PXXV48_4K not supported on non-x86 platforms"); > #endif > break; > + case VM_MODE_P47V64_4K: > + vm->pgtable_levels = 5; > + break; > default: > TEST_FAIL("Unknown guest mode, mode: 0x%x", mode); > } > -- > 2.31.1 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] KVM: selftests: introduce P47V64 for s390x 2021-06-08 12:39 ` [PATCH v2] " Christian Borntraeger 2021-06-08 16:41 ` David Matlack @ 2021-06-08 17:19 ` Paolo Bonzini 1 sibling, 0 replies; 8+ messages in thread From: Paolo Bonzini @ 2021-06-08 17:19 UTC (permalink / raw) To: Christian Borntraeger Cc: bgardon, dmatlack, drjones, frankja, kvm, linux-s390, peterx, venkateshs On 08/06/21 14:39, Christian Borntraeger wrote: > s390x can have up to 47bits of physical guest and 64bits of virtual > address bits. Add a new address mode to avoid errors of testcases > going beyond 47bits. > > Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> > --- > v1->v2: > - remove wrong comment > - use 5 levels of page tables > tools/testing/selftests/kvm/include/kvm_util.h | 3 ++- > tools/testing/selftests/kvm/lib/kvm_util.c | 5 +++++ > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h > index fcd8e3855111..b602552b1ed0 100644 > --- a/tools/testing/selftests/kvm/include/kvm_util.h > +++ b/tools/testing/selftests/kvm/include/kvm_util.h > @@ -43,6 +43,7 @@ enum vm_guest_mode { > VM_MODE_P40V48_4K, > VM_MODE_P40V48_64K, > VM_MODE_PXXV48_4K, /* For 48bits VA but ANY bits PA */ > + VM_MODE_P47V64_4K, > NUM_VM_MODES, > }; > > @@ -60,7 +61,7 @@ enum vm_guest_mode { > > #elif defined(__s390x__) > > -#define VM_MODE_DEFAULT VM_MODE_P52V48_4K > +#define VM_MODE_DEFAULT VM_MODE_P47V64_4K > #define MIN_PAGE_SHIFT 12U > #define ptes_per_page(page_size) ((page_size) / 16) > > diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c > index 28e528c19d28..b126fab6c4e1 100644 > --- a/tools/testing/selftests/kvm/lib/kvm_util.c > +++ b/tools/testing/selftests/kvm/lib/kvm_util.c > @@ -175,6 +175,7 @@ const char *vm_guest_mode_string(uint32_t i) > [VM_MODE_P40V48_4K] = "PA-bits:40, VA-bits:48, 4K pages", > [VM_MODE_P40V48_64K] = "PA-bits:40, VA-bits:48, 64K pages", > [VM_MODE_PXXV48_4K] = "PA-bits:ANY, VA-bits:48, 4K pages", > + [VM_MODE_P47V64_4K] = "PA-bits:47, VA-bits:64, 4K pages", > }; > _Static_assert(sizeof(strings)/sizeof(char *) == NUM_VM_MODES, > "Missing new mode strings?"); > @@ -192,6 +193,7 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = { > { 40, 48, 0x1000, 12 }, > { 40, 48, 0x10000, 16 }, > { 0, 0, 0x1000, 12 }, > + { 47, 64, 0x1000, 12 }, > }; > _Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES, > "Missing new mode params?"); > @@ -277,6 +279,9 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm) > TEST_FAIL("VM_MODE_PXXV48_4K not supported on non-x86 platforms"); > #endif > break; > + case VM_MODE_P47V64_4K: > + vm->pgtable_levels = 5; > + break; > default: > TEST_FAIL("Unknown guest mode, mode: 0x%x", mode); > } > Queued, thanks. Paolo ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-06-08 17:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20210521173828.1180619-1-dmatlack@google.com>
[not found] ` <8cae6330-f88a-ec24-4e7d-bc999f49288d@de.ibm.com>
2021-06-08 10:03 ` [PATCH v2] KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn() Christian Borntraeger
2021-06-08 11:45 ` [PATCH] KVM: selftests: introduce P47V64 for s390x Christian Borntraeger
2021-06-08 11:49 ` Janosch Frank
2021-06-08 11:55 ` Christian Borntraeger
2021-06-08 12:18 ` Christian Borntraeger
2021-06-08 12:39 ` [PATCH v2] " Christian Borntraeger
2021-06-08 16:41 ` David Matlack
2021-06-08 17:19 ` Paolo Bonzini
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox