[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Commit "x86/kvm: Move context tracking where it belongs" broke guest
From: |
Sean Christopherson |
Subject: |
Re: Commit "x86/kvm: Move context tracking where it belongs" broke guest time accounting |
Date: |
Tue, 6 Apr 2021 21:47:40 +0000 |
On Tue, Apr 06, 2021, Michael Tokarev wrote:
> Hi!
>
> It looks like this commit:
>
> commit 87fa7f3e98a1310ef1ac1900e7ee7f9610a038bc
> Author: Thomas Gleixner <tglx@linutronix.de>
> Date: Wed Jul 8 21:51:54 2020 +0200
>
> x86/kvm: Move context tracking where it belongs
>
> Context tracking for KVM happens way too early in the vcpu_run()
> code. Anything after guest_enter_irqoff() and before guest_exit_irqoff()
> cannot use RCU and should also be not instrumented.
>
> The current way of doing this covers way too much code. Move it closer to
> the actual vmenter/exit code.
>
> broke kvm guest cpu time accounting - after this commit, when running
> qemu-system-x86_64 -enable-kvm, the guest time (in /proc/stat and
> elsewhere) is always 0.
>
> I dunno why it happened, but it happened, and all kernels after 5.9
> are affected by this.
>
> This commit is found in a (painful) git bisect between kernel 5.8 and 5.10.
Yes :-(
There's a bugzilla[1] and two proposed fixes[2][3]. I don't particularly like
either of the fixes, but an elegant solution hasn't presented itself.
Thomas/Paolo, can you please weigh in?
[1] https://bugzilla.kernel.org/show_bug.cgi?id=209831
[2]
https://lkml.kernel.org/r/1617011036-11734-1-git-send-email-wanpengli@tencent.com
[3] https://lkml.kernel.org/r/20210206004218.312023-1-seanjc@google.com