Skip to content

Commit 8e6ed96

Browse files
lrq-maxsean-jc
authored andcommitted
KVM: x86: fire timer when it is migrated and expired, and in oneshot mode
when the vCPU was migrated, if its timer is expired, KVM _should_ fire the timer ASAP, zeroing the deadline here will cause the timer to immediately fire on the destination Cc: Sean Christopherson <seanjc@google.com> Cc: Peter Shier <pshier@google.com> Cc: Jim Mattson <jmattson@google.com> Cc: Wanpeng Li <wanpengli@tencent.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Li RongQing <lirongqing@baidu.com> Link: https://lore.kernel.org/r/20230106040625.8404-1-lirongqing@baidu.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 02efd81 commit 8e6ed96

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

arch/x86/kvm/lapic.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,8 +1968,12 @@ static bool set_target_expiration(struct kvm_lapic *apic, u32 count_reg)
19681968
if (unlikely(count_reg != APIC_TMICT)) {
19691969
deadline = tmict_to_ns(apic,
19701970
kvm_lapic_get_reg(apic, count_reg));
1971-
if (unlikely(deadline <= 0))
1972-
deadline = apic->lapic_timer.period;
1971+
if (unlikely(deadline <= 0)) {
1972+
if (apic_lvtt_period(apic))
1973+
deadline = apic->lapic_timer.period;
1974+
else
1975+
deadline = 0;
1976+
}
19731977
else if (unlikely(deadline > apic->lapic_timer.period)) {
19741978
pr_info_ratelimited(
19751979
"vcpu %i: requested lapic timer restore with "

0 commit comments

Comments
 (0)