KVM: lapic: Explicitly cancel the hv timer if it's pre-expired
authorSean Christopherson <sean.j.christopherson@intel.com>
Tue, 16 Apr 2019 20:32:45 +0000 (13:32 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 30 Apr 2019 19:32:16 +0000 (21:32 +0200)
commitf1ba5cfbe47a90f801598a908fd2157bbab2ce1a
treefda2f6b1a015bc44490c27f6a0f3f61ff9c38831
parentee66e453db13d4837a0dcf9d43efa7a88603161b
KVM: lapic: Explicitly cancel the hv timer if it's pre-expired

Explicitly call cancel_hv_timer() instead of returning %false to coerce
restart_apic_timer() into canceling it by way of start_sw_timer().

Functionally, the existing code is correct in the sense that it doesn't
doing anything visibily wrong, e.g. generate spurious interrupts or miss
an interrupt.  But it's extremely confusing and inefficient, e.g. there
are multiple extraneous calls to apic_timer_expired() that effectively
get dropped due to @timer_pending being %true.

Cc: Wanpeng Li <wanpengli@tencent.com>
Cc: Liran Alon <liran.alon@oracle.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/lapic.c