[lvc-project] [PATCH 5.10 1/3] KVM: LAPIC: Advancing the timer expiration on guest initiated write

Roman Demidov roman.demidov.nn at gmail.com
Mon Oct 5 15:36:58 MSK 2026


From: Wanpeng Li <wanpengli at tencent.com>

commit 35737d2db2f4567106c90060ad110b27cb354fa4 upstream.

Advancing the timer expiration should only be necessary on guest initiated
writes. When we cancel the timer and clear .pending during state restore,
clear expired_tscdeadline as well.

Reviewed-by: Sean Christopherson <seanjc at google.com>
Signed-off-by: Wanpeng Li <wanpengli at tencent.com>
Message-Id: <1614818118-965-1-git-send-email-wanpengli at tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
Stable-dep-of: 54b3439c8e70 ("KVM: LAPIC: Also cancel preemption timer during SET_LAPIC")
Signed-off-by: Roman Demidov <roman.demidov.nn at gmail.com>
---
 arch/x86/kvm/lapic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 8b7c3f773d70..0b6fc5395798 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -2629,6 +2629,7 @@ int kvm_apic_set_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s)
 
 	apic_update_ppr(apic);
 	hrtimer_cancel(&apic->lapic_timer.timer);
+	apic->lapic_timer.expired_tscdeadline = 0;
 	apic_update_lvtt(apic);
 	apic_manage_nmi_watchdog(apic, kvm_lapic_get_reg(apic, APIC_LVT0));
 	update_divide_count(apic);
-- 
2.53.0




More information about the lvc-project mailing list