Bisected regression: /proc/stat reports 0 steal time after commit x86/kvm: Move context tracking where it belongs

From: Julian Sax
Date: Sun Jan 03 2021 - 16:22:35 EST


Hello,

I know I am kind of late with this report, but I recently upgraded
from Kernel 5.8 to 5.10 and noticed that all my steal cpu time in htop
was gone, instead the time seems to be added to the sys counter. The
same thing happened in my own scripts, which source from /proc/stat.

After execution of "qemu-system-x86_64 -enable-kvm -m 1G" right after
bootup with no kvm used before this happens:

5.8, good
julian@chef:~$ cat /proc/stat | grep "cpu "
cpu 11235 3 7928 1309820 1360 0 64 0 508 0
# ^ steal

5.10, bad
julian@chef:~$ cat /proc/stat | grep "cpu "
cpu 420 0 1869 37801 746 0 7 0 0 0
# ^ steal

I did bisect the problem and ended up at

commit 87fa7f3e98a1310ef1ac1900e7ee7f9610a038bc
Author: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Date: Wed Jul 8 21:51:54 2020 +0200

x86/kvm: Move context tracking where it belongs

This however does not revert at all on top of the current HEAD and I am
not familiar enough with the area to possibly guess what side effect
could have caused this.

This functionality was pretty nice, because it enabled me to see how the
guest was scheduling etc. It would be nice if that could be brought
back.

Or am I doing the wrong thing to begin with? But then again, htop
breaks in the same way.

Thanks!

Regards,
Julian