Bug 922285 - kvmclock unit test fails on F18 with -smp 2
Summary: kvmclock unit test fails on F18 with -smp 2
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: qemu
Version: 18
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Marcelo Tosatti
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-16 00:18 UTC by Cole Robinson
Modified: 2013-06-14 21:32 UTC (History)
13 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-06-14 21:32:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
My AMD host cpuinfo (8.43 KB, text/plain)
2013-03-17 23:54 UTC, Cole Robinson
no flags Details
Host dmesg after a reboot and reproducing the test failure (87.51 KB, text/plain)
2013-03-22 21:19 UTC, Cole Robinson
no flags Details
kvmunittest-serialize-rdtsc-inside-kvmclock-read.patch (545 bytes, patch)
2013-06-14 01:15 UTC, Marcelo Tosatti
no flags Details | Diff

Description Cole Robinson 2013-03-16 00:18:48 UTC
$ uname -a
Linux colepc 3.8.1-201.fc18.x86_64 #1 SMP Thu Feb 28 19:23:08 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

F18 qemu 1.2 and qemu 1.4 from rawhide seem affected.


$ qemu-kvm -enable-kvm -serial stdio -device testdev,chardev=testlog -chardev file,id=testlog,path=test.out -kernel ./x86/kvmclock_test.flat --append "10000000 `date +%s`" -smp 2
enabling apic
enabling apic
kvm-clock: cpu 0, msr 0x:44bf20 
kvm-clock: cpu 1, msr 0x:44bf40 
Wallclock test, threshold 5
Seconds get from host:     1363393013
Seconds get from kvmclock: 1363393014
Offset:                    1
Check the stability of raw cycle ...
Worst warp -112 
Worst warp -117 
Worst warp -236 
Worst warp -276 
Worst warp -280 
Worst warp -302 
Worst warp -458 
Worst warp -1225 
Worst warp -9719 
Worst warp -9726 
Worst warp -10057 
Total vcpus: 2
Test  loops: 10000000
Total warps:  227220
Total stalls: 0
Worst warp:   -10057
Raw cycle is not stable
Monotonic cycle test:
Worst warp -64 
Worst warp -86 
Worst warp -88 
Worst warp -283 
Worst warp -436 
Worst warp -449 
Worst warp -472 
Worst warp -1207 
Worst warp -1218 
Worst warp -1563 
Worst warp -9983 
Worst warp -10036 
Total vcpus: 2
Test  loops: 10000000
Total warps:  324738
Total stalls: 0
Worst warp:   -10036
Measure the performance of raw cycle ...
Total vcpus: 2
Test  loops: 10000000
TSC cycles:  812278784
Measure the performance of adjusted cycle ...
Total vcpus: 2
Test  loops: 10000000
TSC cycles:  789702310


Without -smp 2:

$ qemu-kvm -enable-kvm -serial stdio -device testdev,chardev=testlog -chardev file,id=testlog,path=test.out -kernel ./x86/kvmclock_test.flat --append "10000000 `date +%s`"
enabling apic
kvm-clock: cpu 0, msr 0x:44bf20 
Wallclock test, threshold 5
Seconds get from host:     1363393041
Seconds get from kvmclock: 1363393042
Offset:                    1
Check the stability of raw cycle ...
Total vcpus: 1
Test  loops: 10000000
Total warps:  0
Total stalls: 0
Worst warp:   0
Raw cycle is stable
Monotonic cycle test:
Total vcpus: 1
Test  loops: 10000000
Total warps:  0
Total stalls: 0
Worst warp:   0
Measure the performance of raw cycle ...
Total vcpus: 1
Test  loops: 10000000
TSC cycles:  799635736
Measure the performance of adjusted cycle ...
Total vcpus: 1
Test  loops: 10000000
TSC cycles:  1436678893


Strangely in our internal autotest jobs, which run with -smp 2, there don't seem to be any problems. I've reproduced on two different machines though.

Comment 1 Marcelo Tosatti 2013-03-17 22:25:42 UTC
Cole,

Please provide more info on the host machine (cat /proc/cpuinfo).

What is the purpose of 

--append "10000000 `date +%s`"

Again?

Comment 2 Cole Robinson 2013-03-17 23:54:52 UTC
Created attachment 711635 [details]
My AMD host cpuinfo

(In reply to comment #1)
> 
> What is the purpose of 
> 
> --append "10000000 `date +%s`"
> 
> Again?

Not sure, it's in unittests.cfg in kvm-unit-tests.git:

https://git.kernel.org/cgit/virt/kvm/kvm-unit-tests.git/tree/x86/unittests.cfg

I just assumed it was a required parameter.

Comment 3 Marcelo Tosatti 2013-03-20 01:19:01 UTC
Cole, please gather the following

1) dmesg of the host
2) $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource

Comment 4 Cole Robinson 2013-03-22 21:19:41 UTC
Created attachment 714805 [details]
Host dmesg after a reboot and reproducing the test failure

$ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
tsc

Comment 5 Marcelo Tosatti 2013-06-14 01:15:17 UTC
Created attachment 761027 [details]
kvmunittest-serialize-rdtsc-inside-kvmclock-read.patch

Comment 6 Marcelo Tosatti 2013-06-14 01:16:14 UTC
Cole,

Can you please test the attach patch to kvm-unit-test on your AMD machine? TIA.

Comment 7 Cole Robinson 2013-06-14 13:19:40 UTC
Seems to fix things:

$ ./x86-run ./x86/kvmclock_test.flat 
qemu-kvm -enable-kvm -serial stdio -device pc-testdev -device isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel ./x86/kvmclock_test.flat --append "10000000 `date +%s`" -smp 2
enabling apic
enabling apic
kvm-clock: cpu 0, msr 0x:44bee0 
kvm-clock: cpu 1, msr 0x:44bf00 
Wallclock test, threshold 5
Seconds get from host:     1371215837
Seconds get from kvmclock: 1371215837
Offset:                    0
Check the stability of raw cycle ...
Total vcpus: 2
Test  loops: 10000000
Total warps:  0
Total stalls: 0
Worst warp:   0
Raw cycle is stable
Monotonic cycle test:
Total vcpus: 2
Test  loops: 10000000
Total warps:  0
Total stalls: 0
Worst warp:   0
Measure the performance of raw cycle ...
Total vcpus: 2
Test  loops: 10000000
TSC cycles:  2617779666
Measure the performance of adjusted cycle ...
Total vcpus: 2
Test  loops: 10000000
TSC cycles:  2627790624

$ echo $?
0


Thanks Marcelo! So is this just a kvm-unit-test bug? If so I'll close the report.

Comment 8 Marcelo Tosatti 2013-06-14 21:32:09 UTC
Cole, yes its a kvm-unit-test bug. Patch submitted upstream.

Closing bug as agreed (as NOTABUG since its neither qemu/kernel bug). Thanks.


Note You need to log in before you can comment on or make changes to this bug.