summaryrefslogtreecommitdiff
path: root/Documentation/core-api/debug-objects.rst
diff options
context:
space:
mode:
authorVenkatesh Srinivas <venkateshs@chromium.org>2026-07-15 23:42:35 +0000
committerPaolo Bonzini <pbonzini@redhat.com>2026-07-21 12:25:28 +0200
commite800decd9c0ac4349bcd8f8f9b29fd21fe93165e (patch)
treeb0e8a8a5619f6cdde80d318c06c74e178de1c5be /Documentation/core-api/debug-objects.rst
parentf148dd411d451e3e4bf79240faec736d101832d4 (diff)
downloadlinux-e800decd9c0ac4349bcd8f8f9b29fd21fe93165e.tar.gz
linux-e800decd9c0ac4349bcd8f8f9b29fd21fe93165e.zip
KVM: x86: Only reset TSC Deadline Timer in apic_timer_expired on KVM_RUN
On Intel platforms with a VMX preemption timer and APICv, if a VMM calls KVM_GET_LAPIC before KVM_GET_MSRS to save the vCPU state, it is possible to lose a pending timer interrupt. If the thread running these ioctls is migrated to another core after calling KVM_GET_LAPIC but before KVM_GET_MSRS and the guest is using their LAPIC timer in TSC-deadline mode, not only does the save LAPIC state not carry the pending interrupt, the TSCDEADLINE MSR will be zeroed. After migration across CPUs, KVM_GET_MSRS calls vcpu_load, posting the interrupt and clearing the MSR: vcpu_load() -> kvm_arch_vcpu_load() -> kvm_lapic_restart_hv_timer() -> start_hv_timer() -> apic_timer_expired() -> kvm_apic_inject_pending_timer_irqs() . post interrupt into the LAPIC state . clear IA32_TSCDEADLINE The saved LAPIC state will be missing the pending interrupt and the saved MSR will be zero. Oops. Fix by only posting an interrupt when we're attempting to enter the guest (vcpu->wants_to_run == true), not for vcpu_load from other paths. Assisted-by: gemini:gemini-3.1-pro-preview Debugged-by: David Matlack <dmatlack@google.com> Debugged-by: Sean Christopherson <seanjc@google.com> Debugged-by: Jim Mattson <jmattson@google.com> Debugged-by: James Houghton <jthoughton@google.com> Signed-off-by: Venkatesh Srinivas <venkateshs@chromium.org> Message-ID: <20260715234234.15382-2-venkateshs@chromium.org> Reviewed-by: James Houghton <jthoughton@google.com> Reviewed-by: Chao Gao <chao.gao@intel.com> Cc: stable@vger.kernel.org Fixes: ae95f566b3d2 ("KVM: X86: TSCDEADLINE MSR emulation fastpath", 2020-05-15) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'Documentation/core-api/debug-objects.rst')
0 files changed, 0 insertions, 0 deletions