mbox series

[kvm-unit-tests,00/15] KVM: clean up the nVMX config

Message ID 20190212233451.27740-1-sean.j.christopherson@intel.com (mailing list archive)
Headers show
Series KVM: clean up the nVMX config | expand

Message

Sean Christopherson Feb. 12, 2019, 11:34 p.m. UTC
The VMX validation space is ginormous, e.g. there are hundreds if not
thousands of combinations of control settings alone to test, and that's
not counting tests like the VMCS shadowing test that permute every
possible value of the test space and generate tens of thousands of
sub-tests.

Because of the sheer number of things to validate, the VMX code crams
many individual test, i.e. things that report PASS/FAIL, into each
test function, i.e. a collection of tests that can be explicitly
invoked via command line, and then consolidates several test functions
under an actual test case, i.e. an entry in x86/unittests.cfg.

While the VMX test infrastructure isn't terrible (I wouldn't call it
"good" either), the testcases defind in unittests.cfg are a mess.
Clean up the worst of the mess so that the defined testcases are at
least somewhat sane, and more importantly, somehwat maintainable.

Most of the patches are relatively minor things to undo copy+paste
issues.  Patch 1/15 adds an option to run a specific test, which is

Sean Christopherson (15):
  KVM: Add a "-t" option to run a specific test
  KVM: x86/config: Consolidate EPT access tests into a single test
  KVM: nVMX: Exclude the EPT access tests from the VMX testcase
  KVM: nVMX: Drop the bogus 2gb requirement from the "vmx" testcase
  KVM: nVMX: Drop the bogus 2gb requirement from the shadow VMCS test
  KVM: nVMX: Drop the bogus SMP requirement from VMCS shadowing test
  KVM: nVMX: Rename VMCS shadowing test to "vmcs_shadow"
  KVM: nVMX: Exclude the VMCS shadowing test from the "vmx" testcase
  KVM: nVMX: Drop testcases that are redundant with the primary VMX
    testcase
  KVM: nVMX: Drop the SMP configuration of the ST APIC passthrough test
  KVM: nVMX: Consolidate the SMP tests into a single testcase
  KVM: nVMX: Rename SMP tests to being with vmx_smp_*
  KVM: nVMX: Exclude the SMP tests from the primary "vmx" testcases
  KVM: nVMX: Drop the bogus 2gb requirement from the SMP tests
  KVM: nVMX: Drop the bogus 2gb requirement from the HLT+RVI testcase

 run_tests.sh         |   6 +-
 scripts/runtime.bash |   6 +-
 x86/unittests.cfg    | 397 +------------------------------------------
 x86/vmx_tests.c      |   8 +-
 4 files changed, 20 insertions(+), 397 deletions(-)

Comments

Paolo Bonzini Feb. 14, 2019, 1:30 p.m. UTC | #1
On 13/02/19 00:34, Sean Christopherson wrote:
> Sean Christopherson (15):
>   KVM: Add a "-t" option to run a specific test
>   KVM: x86/config: Consolidate EPT access tests into a single test
>   KVM: nVMX: Exclude the EPT access tests from the VMX testcase
>   KVM: nVMX: Drop the bogus 2gb requirement from the "vmx" testcase
>   KVM: nVMX: Drop the bogus 2gb requirement from the shadow VMCS test
>   KVM: nVMX: Drop the bogus SMP requirement from VMCS shadowing test
>   KVM: nVMX: Rename VMCS shadowing test to "vmcs_shadow"
>   KVM: nVMX: Exclude the VMCS shadowing test from the "vmx" testcase
>   KVM: nVMX: Drop testcases that are redundant with the primary VMX
>     testcase
>   KVM: nVMX: Drop the SMP configuration of the ST APIC passthrough test
>   KVM: nVMX: Consolidate the SMP tests into a single testcase
>   KVM: nVMX: Rename SMP tests to being with vmx_smp_*
>   KVM: nVMX: Exclude the SMP tests from the primary "vmx" testcases
>   KVM: nVMX: Drop the bogus 2gb requirement from the SMP tests
>   KVM: nVMX: Drop the bogus 2gb requirement from the HLT+RVI testcase
> 
>  run_tests.sh         |   6 +-
>  scripts/runtime.bash |   6 +-
>  x86/unittests.cfg    | 397 +------------------------------------------
>  x86/vmx_tests.c      |   8 +-
>  4 files changed, 20 insertions(+), 397 deletions(-)
> 


Nice, thanks.  "-t" is taken by TAP output so I dropped that patch, and
I also dropped patch 7 because it's nice to have "vmx_" in the name of
the tests.  Otherwise, it's always good to clean up after our past selves...

Paolo
Paolo Bonzini Feb. 14, 2019, 3:24 p.m. UTC | #2
On 14/02/19 14:30, Paolo Bonzini wrote:
> On 13/02/19 00:34, Sean Christopherson wrote:
>> Sean Christopherson (15):
>>   KVM: Add a "-t" option to run a specific test
>>   KVM: x86/config: Consolidate EPT access tests into a single test
>>   KVM: nVMX: Exclude the EPT access tests from the VMX testcase
>>   KVM: nVMX: Drop the bogus 2gb requirement from the "vmx" testcase
>>   KVM: nVMX: Drop the bogus 2gb requirement from the shadow VMCS test
>>   KVM: nVMX: Drop the bogus SMP requirement from VMCS shadowing test
>>   KVM: nVMX: Rename VMCS shadowing test to "vmcs_shadow"
>>   KVM: nVMX: Exclude the VMCS shadowing test from the "vmx" testcase
>>   KVM: nVMX: Drop testcases that are redundant with the primary VMX
>>     testcase
>>   KVM: nVMX: Drop the SMP configuration of the ST APIC passthrough test
>>   KVM: nVMX: Consolidate the SMP tests into a single testcase
>>   KVM: nVMX: Rename SMP tests to being with vmx_smp_*
>>   KVM: nVMX: Exclude the SMP tests from the primary "vmx" testcases
>>   KVM: nVMX: Drop the bogus 2gb requirement from the SMP tests
>>   KVM: nVMX: Drop the bogus 2gb requirement from the HLT+RVI testcase
>>
>>  run_tests.sh         |   6 +-
>>  scripts/runtime.bash |   6 +-
>>  x86/unittests.cfg    | 397 +------------------------------------------
>>  x86/vmx_tests.c      |   8 +-
>>  4 files changed, 20 insertions(+), 397 deletions(-)
>>
> 
> 
> Nice, thanks.  "-t" is taken by TAP output so I dropped that patch, and
> I also dropped patch 7 because it's nice to have "vmx_" in the name of
> the tests.  Otherwise, it's always good to clean up after our past selves...

Hmm, spoke too soon.  The two SMP tests hang when grouped in a single
execution (at least on a Haswell Xeon E5), I can reproduce it also with
upstream kvm-unit-tests and

   ./x86/run x86/vmx.flat -cpu host,+vmx -smp 2 \
      -append \
      "vmx_eoi_bitmap_ioapic_scan_test vmx_apic_passthrough_thread_test"

Paolo
Sean Christopherson Feb. 14, 2019, 3:56 p.m. UTC | #3
On Thu, Feb 14, 2019 at 04:24:16PM +0100, Paolo Bonzini wrote:
> On 14/02/19 14:30, Paolo Bonzini wrote:
> > On 13/02/19 00:34, Sean Christopherson wrote:
> >> Sean Christopherson (15):
> >>   KVM: Add a "-t" option to run a specific test
> >>   KVM: x86/config: Consolidate EPT access tests into a single test
> >>   KVM: nVMX: Exclude the EPT access tests from the VMX testcase
> >>   KVM: nVMX: Drop the bogus 2gb requirement from the "vmx" testcase
> >>   KVM: nVMX: Drop the bogus 2gb requirement from the shadow VMCS test
> >>   KVM: nVMX: Drop the bogus SMP requirement from VMCS shadowing test
> >>   KVM: nVMX: Rename VMCS shadowing test to "vmcs_shadow"
> >>   KVM: nVMX: Exclude the VMCS shadowing test from the "vmx" testcase
> >>   KVM: nVMX: Drop testcases that are redundant with the primary VMX
> >>     testcase
> >>   KVM: nVMX: Drop the SMP configuration of the ST APIC passthrough test
> >>   KVM: nVMX: Consolidate the SMP tests into a single testcase
> >>   KVM: nVMX: Rename SMP tests to being with vmx_smp_*
> >>   KVM: nVMX: Exclude the SMP tests from the primary "vmx" testcases
> >>   KVM: nVMX: Drop the bogus 2gb requirement from the SMP tests
> >>   KVM: nVMX: Drop the bogus 2gb requirement from the HLT+RVI testcase
> >>
> >>  run_tests.sh         |   6 +-
> >>  scripts/runtime.bash |   6 +-
> >>  x86/unittests.cfg    | 397 +------------------------------------------
> >>  x86/vmx_tests.c      |   8 +-
> >>  4 files changed, 20 insertions(+), 397 deletions(-)
> >>
> > 
> > 
> > Nice, thanks.  "-t" is taken by TAP output so I dropped that patch, and
> > I also dropped patch 7 because it's nice to have "vmx_" in the name of
> > the tests.  Otherwise, it's always good to clean up after our past selves...
> 
> Hmm, spoke too soon.  The two SMP tests hang when grouped in a single
> execution (at least on a Haswell Xeon E5), I can reproduce it also with
> upstream kvm-unit-tests and
> 
>    ./x86/run x86/vmx.flat -cpu host,+vmx -smp 2 \
>       -append \
>       "vmx_eoi_bitmap_ioapic_scan_test vmx_apic_passthrough_thread_test"

None of my systems have full vAPIC support, i.e. I can't run
vmx_eoi_bitmap_ioapic_scan_test.  My guess is it doesn't clean up after
itself.

On the topic of self-cleanup, a lofty long-term goal would be to enhance
(or rewrite) the framework to properly sandbox each test.  The unit tests
are riddled with hidden dependencies.
Paolo Bonzini Feb. 14, 2019, 4:06 p.m. UTC | #4
On 14/02/19 16:56, Sean Christopherson wrote:
>> Hmm, spoke too soon.  The two SMP tests hang when grouped in a single
>> execution (at least on a Haswell Xeon E5), I can reproduce it also with
>> upstream kvm-unit-tests and
>>
>>    ./x86/run x86/vmx.flat -cpu host,+vmx -smp 2 \
>>       -append \
>>       "vmx_eoi_bitmap_ioapic_scan_test vmx_apic_passthrough_thread_test"
> None of my systems have full vAPIC support, i.e. I can't run
> vmx_eoi_bitmap_ioapic_scan_test.  My guess is it doesn't clean up after
> itself.

Yes, my guess too.  I couldn't spot anything obvious, but the IPI is not
delivered in the second test.  I'll take a closer look later.

Paolo

> On the topic of self-cleanup, a lofty long-term goal would be to enhance
> (or rewrite) the framework to properly sandbox each test.  The unit tests
> are riddled with hidden dependencies.