* [kvm-unit-tests PATCH] x86: Fix max VMCS field encoding index check
@ 2019-05-18 16:37 Nadav Amit
2019-05-20 14:51 ` Paolo Bonzini
2019-12-12 22:59 ` Jim Mattson
0 siblings, 2 replies; 7+ messages in thread
From: Nadav Amit @ 2019-05-18 16:37 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, Nadav Amit, Sean Christopherson
The test that checks the maximum VMCS field encoding does not probe all
possible VMCS fields. As a result it might fail since the actual
IA32_VMX_VMCS_ENUM.MAX_INDEX would be higher than the expected value.
Change the test to check that the maximum of the supported probed
VMCS fields is lower/equal than the actual reported
IA32_VMX_VMCS_ENUM.MAX_INDEX.
This test might still fail on bare-metal due to errata (e.g., BDX30).
Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
---
x86/vmx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/x86/vmx.c b/x86/vmx.c
index 962ec0f..f540e15 100644
--- a/x86/vmx.c
+++ b/x86/vmx.c
@@ -361,8 +361,8 @@ static void test_vmwrite_vmread(void)
report("VMWRITE/VMREAD", __check_all_vmcs_fields(0x42, &max_index));
vmcs_enum_max = rdmsr(MSR_IA32_VMX_VMCS_ENUM) & VMCS_FIELD_INDEX_MASK;
- report("VMX_VMCS_ENUM.MAX_INDEX expected: %x, actual: %x",
- vmcs_enum_max == max_index, max_index, vmcs_enum_max);
+ report("VMX_VMCS_ENUM.MAX_INDEX expected at least: %x, actual: %x",
+ vmcs_enum_max >= max_index, max_index, vmcs_enum_max);
assert(!vmcs_clear(vmcs));
free_page(vmcs);
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [kvm-unit-tests PATCH] x86: Fix max VMCS field encoding index check
2019-05-18 16:37 [kvm-unit-tests PATCH] x86: Fix max VMCS field encoding index check Nadav Amit
@ 2019-05-20 14:51 ` Paolo Bonzini
2019-12-12 22:59 ` Jim Mattson
1 sibling, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2019-05-20 14:51 UTC (permalink / raw)
To: Nadav Amit; +Cc: kvm, Sean Christopherson
On 18/05/19 18:37, Nadav Amit wrote:
> The test that checks the maximum VMCS field encoding does not probe all
> possible VMCS fields. As a result it might fail since the actual
> IA32_VMX_VMCS_ENUM.MAX_INDEX would be higher than the expected value.
>
> Change the test to check that the maximum of the supported probed
> VMCS fields is lower/equal than the actual reported
> IA32_VMX_VMCS_ENUM.MAX_INDEX.
>
> This test might still fail on bare-metal due to errata (e.g., BDX30).
>
> Cc: Sean Christopherson <sean.j.christopherson@intel.com>
> Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
> ---
> x86/vmx.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/x86/vmx.c b/x86/vmx.c
> index 962ec0f..f540e15 100644
> --- a/x86/vmx.c
> +++ b/x86/vmx.c
> @@ -361,8 +361,8 @@ static void test_vmwrite_vmread(void)
> report("VMWRITE/VMREAD", __check_all_vmcs_fields(0x42, &max_index));
>
> vmcs_enum_max = rdmsr(MSR_IA32_VMX_VMCS_ENUM) & VMCS_FIELD_INDEX_MASK;
> - report("VMX_VMCS_ENUM.MAX_INDEX expected: %x, actual: %x",
> - vmcs_enum_max == max_index, max_index, vmcs_enum_max);
> + report("VMX_VMCS_ENUM.MAX_INDEX expected at least: %x, actual: %x",
> + vmcs_enum_max >= max_index, max_index, vmcs_enum_max);
>
> assert(!vmcs_clear(vmcs));
> free_page(vmcs);
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [kvm-unit-tests PATCH] x86: Fix max VMCS field encoding index check
2019-05-18 16:37 [kvm-unit-tests PATCH] x86: Fix max VMCS field encoding index check Nadav Amit
2019-05-20 14:51 ` Paolo Bonzini
@ 2019-12-12 22:59 ` Jim Mattson
2019-12-13 9:13 ` Nadav Amit
1 sibling, 1 reply; 7+ messages in thread
From: Jim Mattson @ 2019-12-12 22:59 UTC (permalink / raw)
To: Nadav Amit; +Cc: Paolo Bonzini, kvm list, Sean Christopherson
On Sat, May 18, 2019 at 4:58 PM Nadav Amit <nadav.amit@gmail.com> wrote:
>
> The test that checks the maximum VMCS field encoding does not probe all
> possible VMCS fields. As a result it might fail since the actual
> IA32_VMX_VMCS_ENUM.MAX_INDEX would be higher than the expected value.
>
> Change the test to check that the maximum of the supported probed
> VMCS fields is lower/equal than the actual reported
> IA32_VMX_VMCS_ENUM.MAX_INDEX.
Wouldn't it be better to probe all possible VMCS fields and keep the
test for equality?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [kvm-unit-tests PATCH] x86: Fix max VMCS field encoding index check
2019-12-12 22:59 ` Jim Mattson
@ 2019-12-13 9:13 ` Nadav Amit
2019-12-13 17:30 ` Jim Mattson
0 siblings, 1 reply; 7+ messages in thread
From: Nadav Amit @ 2019-12-13 9:13 UTC (permalink / raw)
To: Jim Mattson; +Cc: Paolo Bonzini, kvm list, Sean Christopherson
> On Dec 13, 2019, at 12:59 AM, Jim Mattson <jmattson@google.com> wrote:
>
> On Sat, May 18, 2019 at 4:58 PM Nadav Amit <nadav.amit@gmail.com> wrote:
>> The test that checks the maximum VMCS field encoding does not probe all
>> possible VMCS fields. As a result it might fail since the actual
>> IA32_VMX_VMCS_ENUM.MAX_INDEX would be higher than the expected value.
>>
>> Change the test to check that the maximum of the supported probed
>> VMCS fields is lower/equal than the actual reported
>> IA32_VMX_VMCS_ENUM.MAX_INDEX.
>
> Wouldn't it be better to probe all possible VMCS fields and keep the
> test for equality?
It might take a while though…
How about probing VMREAD/VMWRITE to MAX_INDEX in addition to all the known
VMCS fields and then checking for equation?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [kvm-unit-tests PATCH] x86: Fix max VMCS field encoding index check
2019-12-13 9:13 ` Nadav Amit
@ 2019-12-13 17:30 ` Jim Mattson
2019-12-18 0:24 ` Sean Christopherson
0 siblings, 1 reply; 7+ messages in thread
From: Jim Mattson @ 2019-12-13 17:30 UTC (permalink / raw)
To: Nadav Amit; +Cc: Paolo Bonzini, kvm list, Sean Christopherson
It can't take that long. VMCS field encodings are only 15 bits, and
you can ignore the "high" part of 64-bit fields, so that leaves only
14 bits.
On Fri, Dec 13, 2019 at 1:13 AM Nadav Amit <nadav.amit@gmail.com> wrote:
>
> > On Dec 13, 2019, at 12:59 AM, Jim Mattson <jmattson@google.com> wrote:
> >
> > On Sat, May 18, 2019 at 4:58 PM Nadav Amit <nadav.amit@gmail.com> wrote:
> >> The test that checks the maximum VMCS field encoding does not probe all
> >> possible VMCS fields. As a result it might fail since the actual
> >> IA32_VMX_VMCS_ENUM.MAX_INDEX would be higher than the expected value.
> >>
> >> Change the test to check that the maximum of the supported probed
> >> VMCS fields is lower/equal than the actual reported
> >> IA32_VMX_VMCS_ENUM.MAX_INDEX.
> >
> > Wouldn't it be better to probe all possible VMCS fields and keep the
> > test for equality?
>
> It might take a while though…
>
> How about probing VMREAD/VMWRITE to MAX_INDEX in addition to all the known
> VMCS fields and then checking for equation?
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [kvm-unit-tests PATCH] x86: Fix max VMCS field encoding index check
2019-12-13 17:30 ` Jim Mattson
@ 2019-12-18 0:24 ` Sean Christopherson
2019-12-19 8:52 ` Nadav Amit
0 siblings, 1 reply; 7+ messages in thread
From: Sean Christopherson @ 2019-12-18 0:24 UTC (permalink / raw)
To: Jim Mattson; +Cc: Nadav Amit, Paolo Bonzini, kvm list
On Fri, Dec 13, 2019 at 09:30:45AM -0800, Jim Mattson wrote:
> On Fri, Dec 13, 2019 at 1:13 AM Nadav Amit <nadav.amit@gmail.com> wrote:
> >
> > > On Dec 13, 2019, at 12:59 AM, Jim Mattson <jmattson@google.com> wrote:
> > >
> > > On Sat, May 18, 2019 at 4:58 PM Nadav Amit <nadav.amit@gmail.com> wrote:
> > >> The test that checks the maximum VMCS field encoding does not probe all
> > >> possible VMCS fields. As a result it might fail since the actual
> > >> IA32_VMX_VMCS_ENUM.MAX_INDEX would be higher than the expected value.
> > >>
> > >> Change the test to check that the maximum of the supported probed
> > >> VMCS fields is lower/equal than the actual reported
> > >> IA32_VMX_VMCS_ENUM.MAX_INDEX.
> > >
> > > Wouldn't it be better to probe all possible VMCS fields and keep the
> > > test for equality?
> >
> > It might take a while though…
> >
> > How about probing VMREAD/VMWRITE to MAX_INDEX in addition to all the known
> > VMCS fields and then checking for equation?
> >
> It can't take that long. VMCS field encodings are only 15 bits, and
> you can ignore the "high" part of 64-bit fields, so that leaves only
> 14 bits.
Unless kvm-unit-tests is being run in L1, in which case things like this
are painful. That being said, I do agree that probing "all" VMCS fields
is the way to go. Walking from highest->lowest probably won't even take
all that many VMREADS. If it is slow, the test can be binned to its own
config.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [kvm-unit-tests PATCH] x86: Fix max VMCS field encoding index check
2019-12-18 0:24 ` Sean Christopherson
@ 2019-12-19 8:52 ` Nadav Amit
0 siblings, 0 replies; 7+ messages in thread
From: Nadav Amit @ 2019-12-19 8:52 UTC (permalink / raw)
To: Sean Christopherson; +Cc: Jim Mattson, Paolo Bonzini, kvm list
> On Dec 18, 2019, at 2:24 AM, Sean Christopherson <sean.j.christopherson@intel.com> wrote:
>
> On Fri, Dec 13, 2019 at 09:30:45AM -0800, Jim Mattson wrote:
>> On Fri, Dec 13, 2019 at 1:13 AM Nadav Amit <nadav.amit@gmail.com> wrote:
>>>> On Dec 13, 2019, at 12:59 AM, Jim Mattson <jmattson@google.com> wrote:
>>>>
>>>> On Sat, May 18, 2019 at 4:58 PM Nadav Amit <nadav.amit@gmail.com> wrote:
>>>>> The test that checks the maximum VMCS field encoding does not probe all
>>>>> possible VMCS fields. As a result it might fail since the actual
>>>>> IA32_VMX_VMCS_ENUM.MAX_INDEX would be higher than the expected value.
>>>>>
>>>>> Change the test to check that the maximum of the supported probed
>>>>> VMCS fields is lower/equal than the actual reported
>>>>> IA32_VMX_VMCS_ENUM.MAX_INDEX.
>>>>
>>>> Wouldn't it be better to probe all possible VMCS fields and keep the
>>>> test for equality?
>>>
>>> It might take a while though…
>>>
>>> How about probing VMREAD/VMWRITE to MAX_INDEX in addition to all the known
>>> VMCS fields and then checking for equation?
>> It can't take that long. VMCS field encodings are only 15 bits, and
>> you can ignore the "high" part of 64-bit fields, so that leaves only
>> 14 bits.
>
> Unless kvm-unit-tests is being run in L1, in which case things like this
> are painful. That being said, I do agree that probing "all" VMCS fields
> is the way to go. Walking from highest->lowest probably won't even take
> all that many VMREADS. If it is slow, the test can be binned to its own
> config.
Ok. I’ll send a patch for that.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-12-19 8:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-18 16:37 [kvm-unit-tests PATCH] x86: Fix max VMCS field encoding index check Nadav Amit
2019-05-20 14:51 ` Paolo Bonzini
2019-12-12 22:59 ` Jim Mattson
2019-12-13 9:13 ` Nadav Amit
2019-12-13 17:30 ` Jim Mattson
2019-12-18 0:24 ` Sean Christopherson
2019-12-19 8:52 ` Nadav Amit
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).