All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] x86: svm: Skip NPT-only part of guest CR3 tests when NPT is disabled
@ 2021-04-22  2:54 Sean Christopherson
  2021-06-22 20:10 ` Sean Christopherson
  2021-06-23  8:40 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Sean Christopherson @ 2021-04-22  2:54 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, Sean Christopherson

Skip the sub-tests for guest CR3 that rely on NPT, unsurprisingly they
fail when running with NPT disabled.  Alternatively, the test could be
modified to poke into the legacy page tables, but obviously no one
actually cares that much about shadow paging.

Fixes: 6d0ecbf ("nSVM: Test non-MBZ reserved bits in CR3 in long mode and legacy PAE mode")
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 x86/svm_tests.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/x86/svm_tests.c b/x86/svm_tests.c
index 29a0b59..353ab6b 100644
--- a/x86/svm_tests.c
+++ b/x86/svm_tests.c
@@ -2237,6 +2237,9 @@ static void test_cr3(void)
 
 	vmcb->save.cr4 = cr4_saved & ~X86_CR4_PCIDE;
 
+	if (!npt_supported())
+		goto skip_npt_only;
+
 	/* Clear P (Present) bit in NPT in order to trigger #NPF */
 	pdpe[0] &= ~1ULL;
 
@@ -2255,6 +2258,8 @@ static void test_cr3(void)
 	    SVM_CR3_PAE_LEGACY_RESERVED_MASK, SVM_EXIT_NPF, "(PAE) ");
 
 	pdpe[0] |= 1ULL;
+
+skip_npt_only:
 	vmcb->save.cr3 = cr3_saved;
 	vmcb->save.cr4 = cr4_saved;
 }
-- 
2.31.1.498.g6c1eba8ee3d-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [kvm-unit-tests PATCH] x86: svm: Skip NPT-only part of guest CR3 tests when NPT is disabled
  2021-04-22  2:54 [kvm-unit-tests PATCH] x86: svm: Skip NPT-only part of guest CR3 tests when NPT is disabled Sean Christopherson
@ 2021-06-22 20:10 ` Sean Christopherson
  2021-06-23  8:40 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Sean Christopherson @ 2021-06-22 20:10 UTC (permalink / raw)
  To: Paolo Bonzini, kvm

On Wed, Apr 21, 2021, Sean Christopherson wrote:
> Skip the sub-tests for guest CR3 that rely on NPT, unsurprisingly they
> fail when running with NPT disabled.  Alternatively, the test could be
> modified to poke into the legacy page tables, but obviously no one
> actually cares that much about shadow paging.
> 
> Fixes: 6d0ecbf ("nSVM: Test non-MBZ reserved bits in CR3 in long mode and legacy PAE mode")
> Signed-off-by: Sean Christopherson <seanjc@google.com>

Ping!  Doesn't look like this ever got merged.

> ---
>  x86/svm_tests.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/x86/svm_tests.c b/x86/svm_tests.c
> index 29a0b59..353ab6b 100644
> --- a/x86/svm_tests.c
> +++ b/x86/svm_tests.c
> @@ -2237,6 +2237,9 @@ static void test_cr3(void)
>  
>  	vmcb->save.cr4 = cr4_saved & ~X86_CR4_PCIDE;
>  
> +	if (!npt_supported())
> +		goto skip_npt_only;
> +
>  	/* Clear P (Present) bit in NPT in order to trigger #NPF */
>  	pdpe[0] &= ~1ULL;
>  
> @@ -2255,6 +2258,8 @@ static void test_cr3(void)
>  	    SVM_CR3_PAE_LEGACY_RESERVED_MASK, SVM_EXIT_NPF, "(PAE) ");
>  
>  	pdpe[0] |= 1ULL;
> +
> +skip_npt_only:
>  	vmcb->save.cr3 = cr3_saved;
>  	vmcb->save.cr4 = cr4_saved;
>  }
> -- 
> 2.31.1.498.g6c1eba8ee3d-goog
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [kvm-unit-tests PATCH] x86: svm: Skip NPT-only part of guest CR3 tests when NPT is disabled
  2021-04-22  2:54 [kvm-unit-tests PATCH] x86: svm: Skip NPT-only part of guest CR3 tests when NPT is disabled Sean Christopherson
  2021-06-22 20:10 ` Sean Christopherson
@ 2021-06-23  8:40 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2021-06-23  8:40 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: kvm

On 22/04/21 04:54, Sean Christopherson wrote:
> Skip the sub-tests for guest CR3 that rely on NPT, unsurprisingly they
> fail when running with NPT disabled.  Alternatively, the test could be
> modified to poke into the legacy page tables, but obviously no one
> actually cares that much about shadow paging.
> 
> Fixes: 6d0ecbf ("nSVM: Test non-MBZ reserved bits in CR3 in long mode and legacy PAE mode")
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
>   x86/svm_tests.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/x86/svm_tests.c b/x86/svm_tests.c
> index 29a0b59..353ab6b 100644
> --- a/x86/svm_tests.c
> +++ b/x86/svm_tests.c
> @@ -2237,6 +2237,9 @@ static void test_cr3(void)
>   
>   	vmcb->save.cr4 = cr4_saved & ~X86_CR4_PCIDE;
>   
> +	if (!npt_supported())
> +		goto skip_npt_only;
> +
>   	/* Clear P (Present) bit in NPT in order to trigger #NPF */
>   	pdpe[0] &= ~1ULL;
>   
> @@ -2255,6 +2258,8 @@ static void test_cr3(void)
>   	    SVM_CR3_PAE_LEGACY_RESERVED_MASK, SVM_EXIT_NPF, "(PAE) ");
>   
>   	pdpe[0] |= 1ULL;
> +
> +skip_npt_only:
>   	vmcb->save.cr3 = cr3_saved;
>   	vmcb->save.cr4 = cr4_saved;
>   }
> 

Queued now, thanks!

Paolo


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-23  8:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22  2:54 [kvm-unit-tests PATCH] x86: svm: Skip NPT-only part of guest CR3 tests when NPT is disabled Sean Christopherson
2021-06-22 20:10 ` Sean Christopherson
2021-06-23  8:40 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.