]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: selftests: Make hyperv_clock selftest more stable
authorVitaly Kuznetsov <vkuznets@redhat.com>
Wed, 1 Jun 2022 14:43:22 +0000 (16:43 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 7 Jun 2022 15:28:50 +0000 (11:28 -0400)
commit22b43bae236808ff6699e514e53fc111d178a11a
tree3e529bd5b529778bca2cffb7b0b7e6f8b07eccac
parentdd42e0594c2d9cadd161df1d230f10e34f30120a
KVM: selftests: Make hyperv_clock selftest more stable

hyperv_clock doesn't always give a stable test result, especially with
AMD CPUs. The test compares Hyper-V MSR clocksource (acquired either
with rdmsr() from within the guest or KVM_GET_MSRS from the host)
against rdtsc(). To increase the accuracy, increase the measured delay
(done with nop loop) by two orders of magnitude and take the mean rdtsc()
value before and after rdmsr()/KVM_GET_MSRS.

Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Tested-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20220601144322.1968742-1-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/x86_64/hyperv_clock.c