]> 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)
commitf75e53e1192b14922bb82fb2047ad8fb06412ea9
tree3e529bd5b529778bca2cffb7b0b7e6f8b07eccac
parent5b1ad6183b1f35c8643695794d58103262f5ca1e
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