* [PATCH kvm-unit-tests] vmx: fixes for MAXPHYADDR requirement
@ 2018-01-17 18:03 Paolo Bonzini
2018-01-25 15:11 ` Radim Krčmář
0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2018-01-17 18:03 UTC (permalink / raw)
To: kvm
The EPT access tests require at least 41 bits of guest physical address
space. This is because the test data needs a separate PML4 entry in the
EPT table. However, many consumer-grade processors have only 36 or
39-bit MAXPHYADDR, and the tests fail there with a page fault due to
reserved bits set in the guest (GVA->GPA) page tables.
Add a test on MAXPHYADDR and skip the tests if they cannot run on the
system under test, and only require 40 bits to lower the requirements.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
x86/vmx_tests.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index e8c97f2..0c3b5a7 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -2609,6 +2609,10 @@ static void ept_access_test_setup(void)
if (setup_ept(false))
test_skip("EPT not supported");
+ /* We use data->gpa = 1 << 39 so that test data has a separate pml4 entry */
+ if (cpuid_maxphyaddr() < 40)
+ test_skip("Test needs MAXPHYADDR >= 40");
+
test_set_guest(ept_access_test_guest);
test_add_teardown(ept_access_test_teardown, NULL);
@@ -2616,7 +2620,7 @@ static void ept_access_test_setup(void)
TEST_ASSERT(data->hva);
data->hpa = virt_to_phys(data->hva);
- data->gpa = 1ul << 40;
+ data->gpa = 1ul << 39;
data->gva = (void *) ALIGN((unsigned long) alloc_vpages(npages * 2),
size);
TEST_ASSERT(!any_present_pages(page_table, data->gva, size));
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH kvm-unit-tests] vmx: fixes for MAXPHYADDR requirement
2018-01-17 18:03 [PATCH kvm-unit-tests] vmx: fixes for MAXPHYADDR requirement Paolo Bonzini
@ 2018-01-25 15:11 ` Radim Krčmář
2018-01-25 16:36 ` Paolo Bonzini
0 siblings, 1 reply; 5+ messages in thread
From: Radim Krčmář @ 2018-01-25 15:11 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm
2018-01-17 19:03+0100, Paolo Bonzini:
> The EPT access tests require at least 41 bits of guest physical address
> space. This is because the test data needs a separate PML4 entry in the
> EPT table. However, many consumer-grade processors have only 36 or
> 39-bit MAXPHYADDR, and the tests fail there with a page fault due to
> reserved bits set in the guest (GVA->GPA) page tables.
>
> Add a test on MAXPHYADDR and skip the tests if they cannot run on the
> system under test, and only require 40 bits to lower the requirements.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> x86/vmx_tests.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
> index e8c97f2..0c3b5a7 100644
> --- a/x86/vmx_tests.c
> +++ b/x86/vmx_tests.c
> @@ -2609,6 +2609,10 @@ static void ept_access_test_setup(void)
> if (setup_ept(false))
> test_skip("EPT not supported");
>
> + /* We use data->gpa = 1 << 39 so that test data has a separate pml4 entry */
> + if (cpuid_maxphyaddr() < 40)
This does not help at the moment -- QEMU reports 40 even on hosts that
don't have as much. It is a QEMU bug, so applied still, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH kvm-unit-tests] vmx: fixes for MAXPHYADDR requirement
2018-01-25 15:11 ` Radim Krčmář
@ 2018-01-25 16:36 ` Paolo Bonzini
2018-01-25 16:45 ` Radim Krčmář
0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2018-01-25 16:36 UTC (permalink / raw)
To: Radim Krčmář; +Cc: kvm
----- Original Message -----
> From: "Radim Krčmář" <rkrcmar@redhat.com>
> To: "Paolo Bonzini" <pbonzini@redhat.com>
> Cc: kvm@vger.kernel.org
> Sent: Thursday, January 25, 2018 4:11:32 PM
> Subject: Re: [PATCH kvm-unit-tests] vmx: fixes for MAXPHYADDR requirement
>
> 2018-01-17 19:03+0100, Paolo Bonzini:
> > The EPT access tests require at least 41 bits of guest physical address
> > space. This is because the test data needs a separate PML4 entry in the
> > EPT table. However, many consumer-grade processors have only 36 or
> > 39-bit MAXPHYADDR, and the tests fail there with a page fault due to
> > reserved bits set in the guest (GVA->GPA) page tables.
> >
> > Add a test on MAXPHYADDR and skip the tests if they cannot run on the
> > system under test, and only require 40 bits to lower the requirements.
> >
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > ---
> > x86/vmx_tests.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
> > index e8c97f2..0c3b5a7 100644
> > --- a/x86/vmx_tests.c
> > +++ b/x86/vmx_tests.c
> > @@ -2609,6 +2609,10 @@ static void ept_access_test_setup(void)
> > if (setup_ept(false))
> > test_skip("EPT not supported");
> >
> > + /* We use data->gpa = 1 << 39 so that test data has a separate pml4 entry
> > */
> > + if (cpuid_maxphyaddr() < 40)
>
> This does not help at the moment -- QEMU reports 40 even on hosts that
> don't have as much. It is a QEMU bug, so applied still, thanks.
True. However, vmx.flat is run with "-cpu host,+vmx", and that should forward
the host MAXPHYADDR, shouldn't it?
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH kvm-unit-tests] vmx: fixes for MAXPHYADDR requirement
2018-01-25 16:36 ` Paolo Bonzini
@ 2018-01-25 16:45 ` Radim Krčmář
2018-01-25 17:06 ` Paolo Bonzini
0 siblings, 1 reply; 5+ messages in thread
From: Radim Krčmář @ 2018-01-25 16:45 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm
2018-01-25 11:36-0500, Paolo Bonzini:
> ----- Original Message -----
> > From: "Radim Krčmář" <rkrcmar@redhat.com>
> > To: "Paolo Bonzini" <pbonzini@redhat.com>
> > Cc: kvm@vger.kernel.org
> > Sent: Thursday, January 25, 2018 4:11:32 PM
> > Subject: Re: [PATCH kvm-unit-tests] vmx: fixes for MAXPHYADDR requirement
> >
> > 2018-01-17 19:03+0100, Paolo Bonzini:
> > > The EPT access tests require at least 41 bits of guest physical address
> > > space. This is because the test data needs a separate PML4 entry in the
> > > EPT table. However, many consumer-grade processors have only 36 or
> > > 39-bit MAXPHYADDR, and the tests fail there with a page fault due to
> > > reserved bits set in the guest (GVA->GPA) page tables.
> > >
> > > Add a test on MAXPHYADDR and skip the tests if they cannot run on the
> > > system under test, and only require 40 bits to lower the requirements.
> > >
> > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > > ---
> > > x86/vmx_tests.c | 6 +++++-
> > > 1 file changed, 5 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
> > > index e8c97f2..0c3b5a7 100644
> > > --- a/x86/vmx_tests.c
> > > +++ b/x86/vmx_tests.c
> > > @@ -2609,6 +2609,10 @@ static void ept_access_test_setup(void)
> > > if (setup_ept(false))
> > > test_skip("EPT not supported");
> > >
> > > + /* We use data->gpa = 1 << 39 so that test data has a separate pml4 entry
> > > */
> > > + if (cpuid_maxphyaddr() < 40)
> >
> > This does not help at the moment -- QEMU reports 40 even on hosts that
> > don't have as much. It is a QEMU bug, so applied still, thanks.
>
> True. However, vmx.flat is run with "-cpu host,+vmx", and that should forward
> the host MAXPHYADDR, shouldn't it?
Would make sense for QEMU to do that, but it's not what happens.
I get 40 on both 39 and 46 hosts.
We can do "-cpu host,+vmx,host_phys_bits" at the cost of breaking unit
tests on old QEMUs ...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH kvm-unit-tests] vmx: fixes for MAXPHYADDR requirement
2018-01-25 16:45 ` Radim Krčmář
@ 2018-01-25 17:06 ` Paolo Bonzini
0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2018-01-25 17:06 UTC (permalink / raw)
To: Radim Krčmář; +Cc: kvm
----- Original Message -----
> From: "Radim Krčmář" <rkrcmar@redhat.com>
> To: "Paolo Bonzini" <pbonzini@redhat.com>
> Cc: kvm@vger.kernel.org
> Sent: Thursday, January 25, 2018 5:45:54 PM
> Subject: Re: [PATCH kvm-unit-tests] vmx: fixes for MAXPHYADDR requirement
>
> 2018-01-25 11:36-0500, Paolo Bonzini:
> > ----- Original Message -----
> > > From: "Radim Krčmář" <rkrcmar@redhat.com>
> > > To: "Paolo Bonzini" <pbonzini@redhat.com>
> > > Cc: kvm@vger.kernel.org
> > > Sent: Thursday, January 25, 2018 4:11:32 PM
> > > Subject: Re: [PATCH kvm-unit-tests] vmx: fixes for MAXPHYADDR requirement
> > >
> > > 2018-01-17 19:03+0100, Paolo Bonzini:
> > > > The EPT access tests require at least 41 bits of guest physical address
> > > > space. This is because the test data needs a separate PML4 entry in
> > > > the
> > > > EPT table. However, many consumer-grade processors have only 36 or
> > > > 39-bit MAXPHYADDR, and the tests fail there with a page fault due to
> > > > reserved bits set in the guest (GVA->GPA) page tables.
> > > >
> > > > Add a test on MAXPHYADDR and skip the tests if they cannot run on the
> > > > system under test, and only require 40 bits to lower the requirements.
> > > >
> > > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > > > ---
> > > > x86/vmx_tests.c | 6 +++++-
> > > > 1 file changed, 5 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
> > > > index e8c97f2..0c3b5a7 100644
> > > > --- a/x86/vmx_tests.c
> > > > +++ b/x86/vmx_tests.c
> > > > @@ -2609,6 +2609,10 @@ static void ept_access_test_setup(void)
> > > > if (setup_ept(false))
> > > > test_skip("EPT not supported");
> > > >
> > > > + /* We use data->gpa = 1 << 39 so that test data has a separate pml4
> > > > entry
> > > > */
> > > > + if (cpuid_maxphyaddr() < 40)
> > >
> > > This does not help at the moment -- QEMU reports 40 even on hosts that
> > > don't have as much. It is a QEMU bug, so applied still, thanks.
> >
> > True. However, vmx.flat is run with "-cpu host,+vmx", and that should
> > forward
> > the host MAXPHYADDR, shouldn't it?
>
> Would make sense for QEMU to do that, but it's not what happens.
> I get 40 on both 39 and 46 hosts.
>
> We can do "-cpu host,+vmx,host_phys_bits" at the cost of breaking unit
> tests on old QEMUs ...
No, let's fix QEMU.
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-01-25 17:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-17 18:03 [PATCH kvm-unit-tests] vmx: fixes for MAXPHYADDR requirement Paolo Bonzini
2018-01-25 15:11 ` Radim Krčmář
2018-01-25 16:36 ` Paolo Bonzini
2018-01-25 16:45 ` Radim Krčmář
2018-01-25 17:06 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).