diff mbox series

[kvm-unit-tests,v2,1/2] x86: access: Fix timeout failure by limiting number of tests

Message ID 162880842111.21995.9414122849581561486.stgit@bmoger-ubuntu (mailing list archive)
State New, archived
Headers show
Series Couple of SVM unit test fixes | expand

Commit Message

Moger, Babu Aug. 12, 2021, 10:47 p.m. UTC
From: Babu Moger <Babu.Moger@amd.com>

The test ./x86/access fails with a timeout. This is due to the number test
combination. The test cases increase exponentially as the features get
enabled. The new machine adds the feature AC_CPU_CR4_PKE. The default
timeout is 180 seconds. Seen this problem both on AMD and Intel machines.

Test fails with following messages.
#./tests/access
qemu-system-x86_64: terminating on signal 15 from pid 20050 (timeout)
FAIL access (timeout; duration=180)

This test can take about 7 minutes without timeout.
time ./tests/access
58982405 tests, 0 failures
PASS access

real    7m10.063s
user    7m9.063s
sys     0m0.309s

Fix the problem by adding a new check to limit to the number of tests. The
new a check limits the combinations with more than one reserved bits. With
this limit, the runtime goes down from 7 minutes to approximately 2 minutes.

Signed-off-by: Babu Moger <Babu.Moger@amd.com>
---
 x86/access.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/x86/access.c b/x86/access.c
index 47807cc..c71f39d 100644
--- a/x86/access.c
+++ b/x86/access.c
@@ -315,11 +315,14 @@  static _Bool ac_test_legal(ac_test_t *at)
         return false;
 
     /*
-     * Shorten the test by avoiding testing too many reserved bit combinations
+     * Shorten the test by avoiding testing too many reserved bit combinations.
+     * Skip testing multiple reserved bits to shorten the test. Reserved bit
+     * page faults are terminal and multiple reserved bits do not affect the
+     * error code; the odds of a KVM bug are super low, and the odds of actually
+     * being able to detect a bug are even lower.
      */
-    if ((F(AC_PDE_BIT51) + F(AC_PDE_BIT36) + F(AC_PDE_BIT13)) > 1)
-        return false;
-    if ((F(AC_PTE_BIT51) + F(AC_PTE_BIT36)) > 1)
+    if ((F(AC_PDE_BIT51) + F(AC_PDE_BIT36) + F(AC_PDE_BIT13) +
+        F(AC_PTE_BIT51) + F(AC_PTE_BIT36)) > 1)
         return false;
 
     return true;