[PATCH kvm-unit-tests 05/13] x86: access: move pde_valid test earlier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If pde_valid is false, at->expected_fault will be 1.  Tests
that do nothing but set it again to 1 can be postponed.

Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
---
 x86/access.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/x86/access.c b/x86/access.c
index 00591ac..fdec681 100644
--- a/x86/access.c
+++ b/x86/access.c
@@ -375,6 +375,12 @@ void ac_set_expected_status(ac_test_t *at)
         at->expected_error |= PFERR_RESERVED_MASK;
     }
 
+    if (!F(AC_PDE_ACCESSED))
+        at->ignore_pde = PT_ACCESSED_MASK;
+
+    if (!pde_valid)
+	goto fault;
+
     if (F(AC_ACCESS_USER) && !F(AC_PDE_USER))
 	at->expected_fault = 1;
 
@@ -386,12 +392,6 @@ void ac_set_expected_status(ac_test_t *at)
     if (F(AC_ACCESS_FETCH) && F(AC_PDE_NX))
 	at->expected_fault = 1;
 
-    if (!F(AC_PDE_ACCESSED))
-        at->ignore_pde = PT_ACCESSED_MASK;
-
-    if (!pde_valid)
-	goto fault;
-
     if (!at->expected_fault)
         at->expected_pde |= PT_ACCESSED_MASK;
 
@@ -433,9 +433,6 @@ void ac_set_expected_status(ac_test_t *at)
         at->expected_error |= PFERR_RESERVED_MASK;
     }
 
-    if (F(AC_ACCESS_USER) && !F(AC_PTE_USER))
-	at->expected_fault = 1;
-
     if (!pte_valid)
         goto fault;
 
@@ -446,6 +443,9 @@ void ac_set_expected_status(ac_test_t *at)
         pte_valid = false;
     }
 
+    if (F(AC_ACCESS_USER) && !F(AC_PTE_USER))
+	at->expected_fault = 1;
+
     if (F(AC_ACCESS_WRITE)
 	&& !F(AC_PTE_WRITABLE)
 	&& (F(AC_CPU_CR0_WP) || F(AC_ACCESS_USER)))
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux