mbox series

[kvm-unit-tests,v2,0/4] x86: nSVM: Add testing for routing L2 exceptions

Message ID 20220810050738.7442-1-manali.shukla@amd.com (mailing list archive)
Headers show
Series x86: nSVM: Add testing for routing L2 exceptions | expand

Message

Manali Shukla Aug. 10, 2022, 5:07 a.m. UTC
Series is inspired by vmx exception test framework series[1].

Set up a test framework that verifies an exception occurring in L2 is
forwarded to the right place (L1 or L2).

Tests two conditions for each exception.
1) Exception generated in L2, is handled by L2 when L2 exception handler
   is registered.
2) Exception generated in L2, is handled by L1 when intercept exception
   bit map is set in L1.

Above tests were added to verify 8 different exceptions.
#GP, #UD, #DE, #DB, #AC, #OF, #BP, #NM.

There are 4 patches in this series
1) Added test infrastructure and exception tests.
2) Move #BP test to exception test framework.
3) Move #OF test to exception test framework.
4) Move part of #NM test to exception test framework because
   #NM has a test case which checks the condition for which #NM should not
   be generated, all the test cases under #NM test except this test case have been
   moved to exception test framework because of the exception test framework
   design.

v1->v2
1) Rebased to latest kvm-unit-tests. 
2) Move 3 different exception test cases #BP, #OF and #NM exception to
   exception test framework.

[1] https://lore.kernel.org/all/20220125203127.1161838-1-aaronlewis@google.com/
[2] https://lore.kernel.org/kvm/a090c16f-c307-9548-9739-ceb71687514f@amd.com/

Manali Shukla (4):
  x86: nSVM: Add an exception test framework and tests
  x86: nSVM: Move #BP test to exception test framework
  x86: nSVM: Move #OF test to exception test framework
  x86: nSVM: Move part of #NM test to exception test framework

 x86/svm_tests.c | 197 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 142 insertions(+), 55 deletions(-)

Comments

Manali Shukla Aug. 29, 2022, 4:11 a.m. UTC | #1
On 8/10/2022 10:37 AM, Manali Shukla wrote:
> Series is inspired by vmx exception test framework series[1].
> 
> Set up a test framework that verifies an exception occurring in L2 is
> forwarded to the right place (L1 or L2).
> 
> Tests two conditions for each exception.
> 1) Exception generated in L2, is handled by L2 when L2 exception handler
>    is registered.
> 2) Exception generated in L2, is handled by L1 when intercept exception
>    bit map is set in L1.
> 
> Above tests were added to verify 8 different exceptions.
> #GP, #UD, #DE, #DB, #AC, #OF, #BP, #NM.
> 
> There are 4 patches in this series
> 1) Added test infrastructure and exception tests.
> 2) Move #BP test to exception test framework.
> 3) Move #OF test to exception test framework.
> 4) Move part of #NM test to exception test framework because
>    #NM has a test case which checks the condition for which #NM should not
>    be generated, all the test cases under #NM test except this test case have been
>    moved to exception test framework because of the exception test framework
>    design.
> 
> v1->v2
> 1) Rebased to latest kvm-unit-tests. 
> 2) Move 3 different exception test cases #BP, #OF and #NM exception to
>    exception test framework.
> 
> [1] https://lore.kernel.org/all/20220125203127.1161838-1-aaronlewis@google.com/
> [2] https://lore.kernel.org/kvm/a090c16f-c307-9548-9739-ceb71687514f@amd.com/
> 
> Manali Shukla (4):
>   x86: nSVM: Add an exception test framework and tests
>   x86: nSVM: Move #BP test to exception test framework
>   x86: nSVM: Move #OF test to exception test framework
>   x86: nSVM: Move part of #NM test to exception test framework
> 
>  x86/svm_tests.c | 197 ++++++++++++++++++++++++++++++++++--------------
>  1 file changed, 142 insertions(+), 55 deletions(-)
> 

A gentle reminder for the review

-Manali
Manali Shukla Sept. 19, 2022, 4:41 a.m. UTC | #2
On 8/29/2022 9:41 AM, Manali Shukla wrote:
> On 8/10/2022 10:37 AM, Manali Shukla wrote:
>> Series is inspired by vmx exception test framework series[1].
>>
>> Set up a test framework that verifies an exception occurring in L2 is
>> forwarded to the right place (L1 or L2).
>>
>> Tests two conditions for each exception.
>> 1) Exception generated in L2, is handled by L2 when L2 exception handler
>>    is registered.
>> 2) Exception generated in L2, is handled by L1 when intercept exception
>>    bit map is set in L1.
>>
>> Above tests were added to verify 8 different exceptions.
>> #GP, #UD, #DE, #DB, #AC, #OF, #BP, #NM.
>>
>> There are 4 patches in this series
>> 1) Added test infrastructure and exception tests.
>> 2) Move #BP test to exception test framework.
>> 3) Move #OF test to exception test framework.
>> 4) Move part of #NM test to exception test framework because
>>    #NM has a test case which checks the condition for which #NM should not
>>    be generated, all the test cases under #NM test except this test case have been
>>    moved to exception test framework because of the exception test framework
>>    design.
>>
>> v1->v2
>> 1) Rebased to latest kvm-unit-tests. 
>> 2) Move 3 different exception test cases #BP, #OF and #NM exception to
>>    exception test framework.
>>
>> [1] https://lore.kernel.org/all/20220125203127.1161838-1-aaronlewis@google.com/
>> [2] https://lore.kernel.org/kvm/a090c16f-c307-9548-9739-ceb71687514f@amd.com/
>>
>> Manali Shukla (4):
>>   x86: nSVM: Add an exception test framework and tests
>>   x86: nSVM: Move #BP test to exception test framework
>>   x86: nSVM: Move #OF test to exception test framework
>>   x86: nSVM: Move part of #NM test to exception test framework
>>
>>  x86/svm_tests.c | 197 ++++++++++++++++++++++++++++++++++--------------
>>  1 file changed, 142 insertions(+), 55 deletions(-)
>>
> 
> A gentle reminder for the review
> 
> -Manali

A gentle reminder for the review

-Manali
Manali Shukla Sept. 26, 2022, 4:34 a.m. UTC | #3
On 9/19/2022 10:11 AM, Manali Shukla wrote:
> On 8/29/2022 9:41 AM, Manali Shukla wrote:
>> On 8/10/2022 10:37 AM, Manali Shukla wrote:
>>> Series is inspired by vmx exception test framework series[1].
>>>
>>> Set up a test framework that verifies an exception occurring in L2 is
>>> forwarded to the right place (L1 or L2).
>>>
>>> Tests two conditions for each exception.
>>> 1) Exception generated in L2, is handled by L2 when L2 exception handler
>>>    is registered.
>>> 2) Exception generated in L2, is handled by L1 when intercept exception
>>>    bit map is set in L1.
>>>
>>> Above tests were added to verify 8 different exceptions.
>>> #GP, #UD, #DE, #DB, #AC, #OF, #BP, #NM.
>>>
>>> There are 4 patches in this series
>>> 1) Added test infrastructure and exception tests.
>>> 2) Move #BP test to exception test framework.
>>> 3) Move #OF test to exception test framework.
>>> 4) Move part of #NM test to exception test framework because
>>>    #NM has a test case which checks the condition for which #NM should not
>>>    be generated, all the test cases under #NM test except this test case have been
>>>    moved to exception test framework because of the exception test framework
>>>    design.
>>>
>>> v1->v2
>>> 1) Rebased to latest kvm-unit-tests. 
>>> 2) Move 3 different exception test cases #BP, #OF and #NM exception to
>>>    exception test framework.
>>>
>>> [1] https://lore.kernel.org/all/20220125203127.1161838-1-aaronlewis@google.com/
>>> [2] https://lore.kernel.org/kvm/a090c16f-c307-9548-9739-ceb71687514f@amd.com/
>>>
>>> Manali Shukla (4):
>>>   x86: nSVM: Add an exception test framework and tests
>>>   x86: nSVM: Move #BP test to exception test framework
>>>   x86: nSVM: Move #OF test to exception test framework
>>>   x86: nSVM: Move part of #NM test to exception test framework
>>>
>>>  x86/svm_tests.c | 197 ++++++++++++++++++++++++++++++++++--------------
>>>  1 file changed, 142 insertions(+), 55 deletions(-)
>>>
>>
>> A gentle reminder for the review
>>
>> -Manali
> 
> A gentle reminder for the review
> 
> -Manali

A gentle reminder for the review

-Manali
Manali Shukla Oct. 3, 2022, 4:15 a.m. UTC | #4
On 9/26/2022 10:04 AM, Manali Shukla wrote:
> On 9/19/2022 10:11 AM, Manali Shukla wrote:
>> On 8/29/2022 9:41 AM, Manali Shukla wrote:
>>> On 8/10/2022 10:37 AM, Manali Shukla wrote:
>>>> Series is inspired by vmx exception test framework series[1].
>>>>
>>>> Set up a test framework that verifies an exception occurring in L2 is
>>>> forwarded to the right place (L1 or L2).
>>>>
>>>> Tests two conditions for each exception.
>>>> 1) Exception generated in L2, is handled by L2 when L2 exception handler
>>>>    is registered.
>>>> 2) Exception generated in L2, is handled by L1 when intercept exception
>>>>    bit map is set in L1.
>>>>
>>>> Above tests were added to verify 8 different exceptions.
>>>> #GP, #UD, #DE, #DB, #AC, #OF, #BP, #NM.
>>>>
>>>> There are 4 patches in this series
>>>> 1) Added test infrastructure and exception tests.
>>>> 2) Move #BP test to exception test framework.
>>>> 3) Move #OF test to exception test framework.
>>>> 4) Move part of #NM test to exception test framework because
>>>>    #NM has a test case which checks the condition for which #NM should not
>>>>    be generated, all the test cases under #NM test except this test case have been
>>>>    moved to exception test framework because of the exception test framework
>>>>    design.
>>>>
>>>> v1->v2
>>>> 1) Rebased to latest kvm-unit-tests. 
>>>> 2) Move 3 different exception test cases #BP, #OF and #NM exception to
>>>>    exception test framework.
>>>>
>>>> [1] https://lore.kernel.org/all/20220125203127.1161838-1-aaronlewis@google.com/
>>>> [2] https://lore.kernel.org/kvm/a090c16f-c307-9548-9739-ceb71687514f@amd.com/
>>>>
>>>> Manali Shukla (4):
>>>>   x86: nSVM: Add an exception test framework and tests
>>>>   x86: nSVM: Move #BP test to exception test framework
>>>>   x86: nSVM: Move #OF test to exception test framework
>>>>   x86: nSVM: Move part of #NM test to exception test framework
>>>>
>>>>  x86/svm_tests.c | 197 ++++++++++++++++++++++++++++++++++--------------
>>>>  1 file changed, 142 insertions(+), 55 deletions(-)
>>>>
>>>
>>> A gentle reminder for the review
>>>
>>> -Manali
>>
>> A gentle reminder for the review
>>
>> -Manali
> 
> A gentle reminder for the review
> 
> -Manali

A gentle remider for the review

-Manali
Maxim Levitsky Oct. 3, 2022, 7:07 a.m. UTC | #5
On Mon, 2022-10-03 at 09:45 +0530, Manali Shukla wrote:
> On 9/26/2022 10:04 AM, Manali Shukla wrote:
> > On 9/19/2022 10:11 AM, Manali Shukla wrote:
> > > On 8/29/2022 9:41 AM, Manali Shukla wrote:
> > > > On 8/10/2022 10:37 AM, Manali Shukla wrote:
> > > > > Series is inspired by vmx exception test framework series[1].
> > > > > 
> > > > > Set up a test framework that verifies an exception occurring in L2 is
> > > > > forwarded to the right place (L1 or L2).
> > > > > 
> > > > > Tests two conditions for each exception.
> > > > > 1) Exception generated in L2, is handled by L2 when L2 exception handler
> > > > >    is registered.
> > > > > 2) Exception generated in L2, is handled by L1 when intercept exception
> > > > >    bit map is set in L1.
> > > > > 
> > > > > Above tests were added to verify 8 different exceptions.
> > > > > #GP, #UD, #DE, #DB, #AC, #OF, #BP, #NM.
> > > > > 
> > > > > There are 4 patches in this series
> > > > > 1) Added test infrastructure and exception tests.
> > > > > 2) Move #BP test to exception test framework.
> > > > > 3) Move #OF test to exception test framework.
> > > > > 4) Move part of #NM test to exception test framework because
> > > > >    #NM has a test case which checks the condition for which #NM should not
> > > > >    be generated, all the test cases under #NM test except this test case have been
> > > > >    moved to exception test framework because of the exception test framework
> > > > >    design.
> > > > > 
> > > > > v1->v2
> > > > > 1) Rebased to latest kvm-unit-tests. 
> > > > > 2) Move 3 different exception test cases #BP, #OF and #NM exception to
> > > > >    exception test framework.
> > > > > 
> > > > > [1] https://lore.kernel.org/all/20220125203127.1161838-1-aaronlewis@google.com/
> > > > > [2] https://lore.kernel.org/kvm/a090c16f-c307-9548-9739-ceb71687514f@amd.com/
> > > > > 
> > > > > Manali Shukla (4):
> > > > >   x86: nSVM: Add an exception test framework and tests
> > > > >   x86: nSVM: Move #BP test to exception test framework
> > > > >   x86: nSVM: Move #OF test to exception test framework
> > > > >   x86: nSVM: Move part of #NM test to exception test framework
> > > > > 
> > > > >  x86/svm_tests.c | 197 ++++++++++++++++++++++++++++++++++--------------
> > > > >  1 file changed, 142 insertions(+), 55 deletions(-)
> > > > > 
> > > > 
> > > > A gentle reminder for the review
> > > > 
> > > > -Manali
> > > 
> > > A gentle reminder for the review
> > > 
> > > -Manali
> > 
> > A gentle reminder for the review
> > 
> > -Manali
> 
> A gentle remider for the review
> 
> -Manali
> 
I will review this very soon. Sorry for not getting to it earlier.

Best regards,
	Maxim Levitsky
Sean Christopherson Oct. 5, 2022, 9:14 p.m. UTC | #6
On Wed, Aug 10, 2022, Manali Shukla wrote:
> Series is inspired by vmx exception test framework series[1].
> 
> Set up a test framework that verifies an exception occurring in L2 is
> forwarded to the right place (L1 or L2).
> 
> Tests two conditions for each exception.
> 1) Exception generated in L2, is handled by L2 when L2 exception handler
>    is registered.
> 2) Exception generated in L2, is handled by L1 when intercept exception
>    bit map is set in L1.
> 
> Above tests were added to verify 8 different exceptions.
> #GP, #UD, #DE, #DB, #AC, #OF, #BP, #NM.
> 
> There are 4 patches in this series
> 1) Added test infrastructure and exception tests.
> 2) Move #BP test to exception test framework.
> 3) Move #OF test to exception test framework.
> 4) Move part of #NM test to exception test framework because
>    #NM has a test case which checks the condition for which #NM should not
>    be generated, all the test cases under #NM test except this test case have been
>    moved to exception test framework because of the exception test framework
>    design.

I know Paolo NACKed a full rework to share nVMX and nSVM code, but it's super easy
to share the helpers, get a net -100 LoC, and improve nVMX coverage.

I've done the work, along with some misc cleanups.  I'll post a combined version
shortly.

 lib/x86/processor.h |  98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 x86/svm_tests.c     | 195 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------
 x86/vmx_tests.c     | 200 +++++++++++--------------------------------------------------------------------------------------------------------------------------------------
 3 files changed, 199 insertions(+), 294 deletions(-)