aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Christopherson <sean.j.christopherson@intel.com>2020-01-24 15:46:08 -0800
committerPaolo Bonzini <pbonzini@redhat.com>2020-07-01 11:59:41 -0400
commit84a43d344a5c70df847521b2a4e1a736ca97d922 (patch)
treebe668170c08a3926ce7905e701c04685eaa1003f
parent2c1ca866799879072d95122759fc81fb34ba6306 (diff)
downloadkvm-unit-tests-84a43d344a5c70df847521b2a4e1a736ca97d922.tar.gz
x86: nVMX: Print more (accurate) info if RDTSC diff test fails
Snapshot the delta of the last run and display it in the report if the test fails. Abort the run loop as soon as the threshold is reached so that the displayed delta is guaranteed to a failed delta. Displaying the delta helps triage failures, e.g. is my system completely broken or did I get unlucky, and aborting the loop early saves 99900 runs when the system is indeed broken. Cc: Nadav Amit <nadav.amit@gmail.com> Cc: Aaron Lewis <aaronlewis@google.com> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Message-Id: <20200124234608.10754-1-sean.j.christopherson@intel.com> Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com> Reviewed-by: Aaron Lewis <aaronlewis@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--x86/vmx_tests.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 9fec0f7..0bef0b1 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -9795,6 +9795,7 @@ static unsigned long long rdtsc_vmexit_diff_test_iteration(void)
static void rdtsc_vmexit_diff_test(void)
{
+ unsigned long long delta;
int fail = 0;
int i;
@@ -9817,17 +9818,17 @@ static void rdtsc_vmexit_diff_test(void)
vmcs_write(EXI_MSR_ST_CNT, 1);
vmcs_write(EXIT_MSR_ST_ADDR, virt_to_phys(exit_msr_store));
- for (i = 0; i < RDTSC_DIFF_ITERS; i++) {
- if (rdtsc_vmexit_diff_test_iteration() >=
- HOST_CAPTURED_GUEST_TSC_DIFF_THRESHOLD)
+ for (i = 0; i < RDTSC_DIFF_ITERS && fail < RDTSC_DIFF_FAILS; i++) {
+ delta = rdtsc_vmexit_diff_test_iteration();
+ if (delta >= HOST_CAPTURED_GUEST_TSC_DIFF_THRESHOLD)
fail++;
}
enter_guest();
report(fail < RDTSC_DIFF_FAILS,
- "RDTSC to VM-exit delta too high in %d of %d iterations",
- fail, RDTSC_DIFF_ITERS);
+ "RDTSC to VM-exit delta too high in %d of %d iterations, last = %llu",
+ fail, i, delta);
}
static int invalid_msr_init(struct vmcs *vmcs)