Re: FYI: hyperv_clock selftest has random failures

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

 



Maxim Levitsky <mlevitsk@xxxxxxxxxx> writes:

> Just something I noticed today. Happens on both AMD and Intel, kvm/queue. 
>
> Likely the test needs lower tolerancies.
>
> I'll investigate this later
>
> This is on my AMD machine (3970X):
>
> [mlevitsk@starship ~/Kernel/master/src/tools/testing/selftests/kvm]$while true ; do ./x86_64/hyperv_clock  ; done
> ==== Test Assertion Failure ====
>   x86_64/hyperv_clock.c:199: delta_ns * 100 < (t2 - t1) * 100
>   pid=66218 tid=66218 errno=0 - Success
>      1	0x000000000040255d: host_check_tsc_msr_rdtsc at hyperv_clock.c:199
>      2	 (inlined by) main at hyperv_clock.c:223
>      3	0x00007f0f2822d55f: ?? ??:0
>      4	0x00007f0f2822d60b: ?? ??:0
>      5	0x0000000000402744: _start at ??:?
>   Elapsed time does not match (MSR=471600, TSC=461024)
...

Here the test is:

r1 = rdtsc()
m1 = KVM_GET_MSRS (HV_X64_MSR_TIME_REF_COUNT)
nop_loop()
r2 = rdtsc()
m2 = KVM_GET_MSRS (HV_X64_MSR_TIME_REF_COUNT)

and then we compare the difference between rdtsc()-s and
HV_X64_MSR_TIME_REF_COUNT changes with 1% tolerance (r2-r1 vs m2-m1).

It would probably increase accuracy if we do

r1_1 = rdtsc()
KVM_GET_MSRS (HV_X64_MSR_TIME_REF_COUNT)
r1_2 = rdtsc()
nop_loop()
r2_1 = rdtsc()
KVM_GET_MSRS (HV_X64_MSR_TIME_REF_COUNT)
r2_2 = rdtsc()

and compare (r2_2 + r2_1)/2 - (r2_1 + r2_2)/2 vs m2-m1.

and also increase tolerance to say 5%.

> ==== Test Assertion Failure ====
>   x86_64/hyperv_clock.c:234: false
>   pid=66652 tid=66652 errno=4 - Interrupted system call
>      1	0x00000000004026e7: main at hyperv_clock.c:234
>      2	0x00007fdab782d55f: ?? ??:0
>      3	0x00007fdab782d60b: ?? ??:0
>      4	0x0000000000402744: _start at ??:?
>   Failed guest assert: delta_ns * 100 < (t2 - t1) * 100 at x86_64/hyperv_clock.c:74

Same story as above but from within the guest (rdmsr() istead of
KVM_GET_MSRS). We can probably employ the same idea to increate the
accuracy.

-- 
Vitaly




[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