Commit 1604571
KVM: x86: Defer vtime accounting 'til after IRQ handling
Defer the call to account guest time until after servicing any IRQ(s)
that happened in the guest or immediately after VM-Exit. Tick-based
accounting of vCPU time relies on PF_VCPU being set when the tick IRQ
handler runs, and IRQs are blocked throughout the main sequence of
vcpu_enter_guest(), including the call into vendor code to actually
enter and exit the guest.
This fixes a bug where reported guest time remains '0', even when
running an infinite loop in the guest:
https://bugzilla.kernel.org/show_bug.cgi?id=209831
Fixes: 87fa7f3 ("x86/kvm: Move context tracking where it belongs")
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Co-developed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20210505002735.1684165-4-seanjc@google.com1 parent 88d8220 commit 1604571
3 files changed
Lines changed: 15 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3753 | 3753 | | |
3754 | 3754 | | |
3755 | 3755 | | |
3756 | | - | |
3757 | | - | |
| 3756 | + | |
| 3757 | + | |
3758 | 3758 | | |
3759 | 3759 | | |
3760 | 3760 | | |
3761 | 3761 | | |
3762 | 3762 | | |
3763 | 3763 | | |
3764 | | - | |
| 3764 | + | |
3765 | 3765 | | |
3766 | 3766 | | |
3767 | 3767 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6703 | 6703 | | |
6704 | 6704 | | |
6705 | 6705 | | |
6706 | | - | |
6707 | | - | |
| 6706 | + | |
| 6707 | + | |
6708 | 6708 | | |
6709 | 6709 | | |
6710 | 6710 | | |
6711 | 6711 | | |
6712 | 6712 | | |
6713 | 6713 | | |
6714 | | - | |
| 6714 | + | |
6715 | 6715 | | |
6716 | 6716 | | |
6717 | 6717 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9315 | 9315 | | |
9316 | 9316 | | |
9317 | 9317 | | |
| 9318 | + | |
| 9319 | + | |
| 9320 | + | |
| 9321 | + | |
| 9322 | + | |
| 9323 | + | |
| 9324 | + | |
| 9325 | + | |
| 9326 | + | |
9318 | 9327 | | |
9319 | 9328 | | |
9320 | 9329 | | |
| |||
0 commit comments