mbox series

[kvm-unit-tests,0/3] Add L2 exception handling KVM unit tests for nSVM

Message ID 20211229062201.26269-1-manali.shukla@amd.com (mailing list archive)
Headers show
Series Add L2 exception handling KVM unit tests for nSVM | expand

Message

Manali Shukla Dec. 29, 2021, 6:21 a.m. UTC
This series adds 3 KVM Unit tests for nested SVM
1) Check #NM is handled in L2 when L2 #NM handler is registered
   "fnop" instruction is called in L2 to generate the exception

2) Check #BP is handled in L2 when L2 #BP handler is registered
   "int3" instruction is called in L2 to generate the exception

3) Check #OF is handled in L2 when L2 #OF handler is registered
   "into" instruction with instrumented code is used in L2 to
   generate the exception

Manali Shukla (3):
  x86: nSVM: Check #NM exception handling in L2
  x86: nSVM: Check #BP exception handling in L2
  x86: nSVM: Check #OF exception handling in L2

 x86/svm_tests.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 114 insertions(+)

Comments

Shukla, Manali Jan. 7, 2022, 4:05 a.m. UTC | #1
On 12/29/2021 11:51 AM, Manali Shukla wrote:
> This series adds 3 KVM Unit tests for nested SVM
> 1) Check #NM is handled in L2 when L2 #NM handler is registered
>    "fnop" instruction is called in L2 to generate the exception
> 
> 2) Check #BP is handled in L2 when L2 #BP handler is registered
>    "int3" instruction is called in L2 to generate the exception
> 
> 3) Check #OF is handled in L2 when L2 #OF handler is registered
>    "into" instruction with instrumented code is used in L2 to
>    generate the exception
> 
> Manali Shukla (3):
>   x86: nSVM: Check #NM exception handling in L2
>   x86: nSVM: Check #BP exception handling in L2
>   x86: nSVM: Check #OF exception handling in L2
> 
>  x86/svm_tests.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 114 insertions(+)
> 

A gentle reminder for review

Thank you,
Manali
Sean Christopherson Jan. 12, 2022, 9:29 p.m. UTC | #2
+Aaron, and +Paolo who may or may not subsribe to kvm@ :-)

On Wed, Dec 29, 2021, Manali Shukla wrote:
> This series adds 3 KVM Unit tests for nested SVM
> 1) Check #NM is handled in L2 when L2 #NM handler is registered
>    "fnop" instruction is called in L2 to generate the exception
> 
> 2) Check #BP is handled in L2 when L2 #BP handler is registered
>    "int3" instruction is called in L2 to generate the exception
> 
> 3) Check #OF is handled in L2 when L2 #OF handler is registered
>    "into" instruction with instrumented code is used in L2 to
>    generate the exception

This is all basically identical in terms of desired functionality to existing or
in-flight nVMX tests, e.g. vmx_nm_test() and Aaron's vmx_exception_test() work[*].
And much of the feedback I provided to Aaron's earlier revisions applies to this
series as well, e.g. create a framework to test intercpetion of arbitrary exceptions
instead of writing the same boilerplate for each and every test.

It doesn't seem like it'd be _that_ difficult to turn vmx_exception_test into a
generic-ish l2_exception_test.  To avoid too much scope creep, what if we first get
Aaron's code merged, and than attempt to extract the core functionality into a
shared library to reuse it for nSVM?  If it turns out to be more trouble then its
worth, we can always fall back to something like this series.

[*] https://lore.kernel.org/all/20211214011823.3277011-1-aaronlewis@google.com
Paolo Bonzini Jan. 18, 2022, 9:21 a.m. UTC | #3
On 12/29/21 07:21, Manali Shukla wrote:
> This series adds 3 KVM Unit tests for nested SVM
> 1) Check #NM is handled in L2 when L2 #NM handler is registered
>     "fnop" instruction is called in L2 to generate the exception
> 
> 2) Check #BP is handled in L2 when L2 #BP handler is registered
>     "int3" instruction is called in L2 to generate the exception
> 
> 3) Check #OF is handled in L2 when L2 #OF handler is registered
>     "into" instruction with instrumented code is used in L2 to
>     generate the exception
> 
> Manali Shukla (3):
>    x86: nSVM: Check #NM exception handling in L2
>    x86: nSVM: Check #BP exception handling in L2
>    x86: nSVM: Check #OF exception handling in L2
> 
>   x86/svm_tests.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 114 insertions(+)
> 

Queued, thanks.

Paolo
Shukla, Manali Jan. 18, 2022, 11:11 a.m. UTC | #4
On 1/13/2022 2:59 AM, Sean Christopherson wrote:
> +Aaron, and +Paolo who may or may not subsribe to kvm@ :-)
> 
> On Wed, Dec 29, 2021, Manali Shukla wrote:
>> This series adds 3 KVM Unit tests for nested SVM
>> 1) Check #NM is handled in L2 when L2 #NM handler is registered
>>    "fnop" instruction is called in L2 to generate the exception
>>
>> 2) Check #BP is handled in L2 when L2 #BP handler is registered
>>    "int3" instruction is called in L2 to generate the exception
>>
>> 3) Check #OF is handled in L2 when L2 #OF handler is registered
>>    "into" instruction with instrumented code is used in L2 to
>>    generate the exception
> 
> This is all basically identical in terms of desired functionality to existing or
> in-flight nVMX tests, e.g. vmx_nm_test() and Aaron's vmx_exception_test() work[*].
> And much of the feedback I provided to Aaron's earlier revisions applies to this
> series as well, e.g. create a framework to test intercpetion of arbitrary exceptions
> instead of writing the same boilerplate for each and every test.
> 
> It doesn't seem like it'd be _that_ difficult to turn vmx_exception_test into a
> generic-ish l2_exception_test.  To avoid too much scope creep, what if we first get
> Aaron's code merged, and than attempt to extract the core functionality into a
> shared library to reuse it for nSVM?  If it turns out to be more trouble then its
> worth, we can always fall back to something like this series.
> 
> [*] https://lore.kernel.org/all/20211214011823.3277011-1-aaronlewis@google.com

This patch has already been queued by Paolo.
I will wait till Aaron's code is merged and than do appropriate changes.
I hope this is fine.

Thank you
Manali
Paolo Bonzini Jan. 18, 2022, 11:38 a.m. UTC | #5
On 1/18/22 12:11, Shukla, Manali wrote:
>>
>> It doesn't seem like it'd be_that_  difficult to turn vmx_exception_test into a
>> generic-ish l2_exception_test.  To avoid too much scope creep, what if we first get
>> Aaron's code merged, and than attempt to extract the core functionality into a
>> shared library to reuse it for nSVM?  If it turns out to be more trouble then its
>> worth, we can always fall back to something like this series.
>>
>> [*]https://lore.kernel.org/all/20211214011823.3277011-1-aaronlewis@google.com
> This patch has already been queued by Paolo.
> I will wait till Aaron's code is merged and than do appropriate changes.
> I hope this is fine.

Yes, it is.  I am holding on Aaron's series because of the remarks from 
Sean[1], on the other hand it's really difficult to share code between 
VMX and SVM tests.  So while I agree that a lot of code changes can be 
done the same way to VMX and SVM tests, it's not really feasible to keep 
them in sync.

Paolo

[1] https://lore.kernel.org/all/Yd8+n+%2F2GCZtIhaB@google.com/#t