Re: weird /proc/stat output with newer (4.1, 4.2) kernels in kvm guest on 3.10 host?

From: Chris Friesen
Date: Thu Mar 03 2016 - 13:36:16 EST


On 03/02/2016 11:12 AM, Chris Friesen wrote:
I'm running a 3.10-based host with libvirt 1.2.12 and qemu 2.2.

Running a Fedora23 cloud image as a guest, the "cpu" lines in /proc/stat seem to
be hardly changing:

[fedora@fedora23 boot]$ uptime
17:01:50 up 44 min, 1 user, load average: 3.00, 2.99, 2.79
[fedora@fedora23 boot]$ grep cpu /proc/stat
cpu 13 0 124 65880 165 0 0 23088 0 0
cpu0 1 0 4 21967 67 0 0 21866 0 0
cpu1 8 0 52 21877 66 0 0 623 0 0
cpu2 4 0 67 22034 30 0 0 598 0 0


Running an Ubuntu 15.10 cloud image as a guest, everything looks fine:

ubuntu@ubuntu1510:/boot$ uptime
17:02:28 up 28 min, 1 user, load average: 3.00, 2.98, 2.42
ubuntu@ubuntu1510:/boot$ grep cpu /proc/stat
cpu 3932 130 443061 46116 257 0 5 12974 0 0
cpu0 1296 130 139886 14960 195 0 1 12343 0 0
cpu1 1330 0 151580 15570 35 0 0 315 0 0
cpu2 1305 0 151595 15586 26 0 4 316 0 0


In both cases the current_clocksource is kvm-clock.


Quick update (sorry it's not threaded, I'm not subscribed to the list).

The problem seems to be related to VIRT_CPU_ACCOUNTING being enabled in the guest. If I switch to TICK_CPU_ACCOUNTING or IRQ_TIME_ACCOUNTING then the problem goes away.

I'm digging into the code now. Anyone have any tips on debugging why
VIRT_CPU_ACCOUNTING is misbehaving in the guest?

Thanks,
Chris