mbox series

[kvm-unit-tests,0/3] Move nNPT test cases to a seperate file

Message ID 20220228061737.22233-1-manali.shukla@amd.com (mailing list archive)
Headers show
Series Move nNPT test cases to a seperate file | expand

Message

Manali Shukla Feb. 28, 2022, 6:17 a.m. UTC
Commit 916635a813e975600335c6c47250881b7a328971
(nSVM: Add test for NPT reserved bit and #NPF error code behavior)
clears PT_USER_MASK for all svm testcases. Any tests that requires
usermode access will fail after this commit.

If __setup_vm() is changed to setup_vm(), KUT will build tests with
PT_USER_MASK set on all PTEs. It is a better idea to move nNPT tests
to  their own file so that tests don't need to fiddle with page tables
midway.

The quick approach to do this would be to turn the current main into a small
helper, without calling __setup_vm() from helper.

There are three patches in this patch series
1) Turned current main into helper function minus setup_vm()
2) Moved all nNPT test cases from svm_tests.c to svm_npt.c
3) Change __setup_vm to setup_vm() on svm_tests.c

Manali Shukla (3):
  x86: nSVM: Move common functionality of the main() to helper
    run_svm_tests
  x86: nSVM: Move all nNPT test cases from svm_tests.c to a seperate
    file.
  x86: nSVM: Allow nSVM tests run with PT_USER_MASK enabled

 x86/Makefile.common |   2 +
 x86/Makefile.x86_64 |   2 +
 x86/svm.c           |   6 +-
 x86/svm.h           |   1 +
 x86/svm_npt.c       | 386 ++++++++++++++++++++++++++++++++++++++++++++
 x86/svm_tests.c     | 369 +-----------------------------------------
 6 files changed, 398 insertions(+), 368 deletions(-)
 create mode 100644 x86/svm_npt.c

Comments

Shukla, Manali March 8, 2022, 2:54 a.m. UTC | #1
On 2/28/2022 11:47 AM, Manali Shukla wrote:
> Commit 916635a813e975600335c6c47250881b7a328971
> (nSVM: Add test for NPT reserved bit and #NPF error code behavior)
> clears PT_USER_MASK for all svm testcases. Any tests that requires
> usermode access will fail after this commit.
> 
> If __setup_vm() is changed to setup_vm(), KUT will build tests with
> PT_USER_MASK set on all PTEs. It is a better idea to move nNPT tests
> to  their own file so that tests don't need to fiddle with page tables
> midway.
> 
> The quick approach to do this would be to turn the current main into a small
> helper, without calling __setup_vm() from helper.
> 
> There are three patches in this patch series
> 1) Turned current main into helper function minus setup_vm()
> 2) Moved all nNPT test cases from svm_tests.c to svm_npt.c
> 3) Change __setup_vm to setup_vm() on svm_tests.c
> 
> Manali Shukla (3):
>   x86: nSVM: Move common functionality of the main() to helper
>     run_svm_tests
>   x86: nSVM: Move all nNPT test cases from svm_tests.c to a seperate
>     file.
>   x86: nSVM: Allow nSVM tests run with PT_USER_MASK enabled
> 
>  x86/Makefile.common |   2 +
>  x86/Makefile.x86_64 |   2 +
>  x86/svm.c           |   6 +-
>  x86/svm.h           |   1 +
>  x86/svm_npt.c       | 386 ++++++++++++++++++++++++++++++++++++++++++++
>  x86/svm_tests.c     | 369 +-----------------------------------------
>  6 files changed, 398 insertions(+), 368 deletions(-)
>  create mode 100644 x86/svm_npt.c
> 

A gentle reminder for review

Thanks 
Manali
Paolo Bonzini March 8, 2022, 3:35 p.m. UTC | #2
On 2/28/22 07:17, Manali Shukla wrote:
> Commit 916635a813e975600335c6c47250881b7a328971
> (nSVM: Add test for NPT reserved bit and #NPF error code behavior)
> clears PT_USER_MASK for all svm testcases. Any tests that requires
> usermode access will fail after this commit.
> 
> If __setup_vm() is changed to setup_vm(), KUT will build tests with
> PT_USER_MASK set on all PTEs. It is a better idea to move nNPT tests
> to  their own file so that tests don't need to fiddle with page tables
> midway.
> 
> The quick approach to do this would be to turn the current main into a small
> helper, without calling __setup_vm() from helper.
> 
> There are three patches in this patch series
> 1) Turned current main into helper function minus setup_vm()
> 2) Moved all nNPT test cases from svm_tests.c to svm_npt.c
> 3) Change __setup_vm to setup_vm() on svm_tests.c

What ideas do you have for SVM tests that require usermode access in the 
test (not in the guest)?

Paolo
Shukla, Manali March 10, 2022, 6:41 p.m. UTC | #3
On 3/8/2022 9:05 PM, Paolo Bonzini wrote:
> On 2/28/22 07:17, Manali Shukla wrote:
>> Commit 916635a813e975600335c6c47250881b7a328971
>> (nSVM: Add test for NPT reserved bit and #NPF error code behavior)
>> clears PT_USER_MASK for all svm testcases. Any tests that requires
>> usermode access will fail after this commit.
>>
>> If __setup_vm() is changed to setup_vm(), KUT will build tests with
>> PT_USER_MASK set on all PTEs. It is a better idea to move nNPT tests
>> to  their own file so that tests don't need to fiddle with page tables
>> midway.
>>
>> The quick approach to do this would be to turn the current main into a small
>> helper, without calling __setup_vm() from helper.
>>
>> There are three patches in this patch series
>> 1) Turned current main into helper function minus setup_vm()
>> 2) Moved all nNPT test cases from svm_tests.c to svm_npt.c
>> 3) Change __setup_vm to setup_vm() on svm_tests.c
> 
> What ideas do you have for SVM tests that require usermode access in the test (not in the guest)?
> 
> Paolo
> 

I have tried running the user mode function from L1 guest, with setup_vm(), this 
seems to be working fine. 

But I am not very clear about your ask for svm tests which require usermode access 
in the test (not in the guest).
Can you please elaborate on it if possible?
Are there any sample tests you are referring to which I can check out.

Thank you 
Manali