]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/5.0.18/kvm-lapic-busy-wait-for-timer-to-expire-when-using-hv_timer.patch
Linux 5.0.18
[thirdparty/kernel/stable-queue.git] / releases / 5.0.18 / kvm-lapic-busy-wait-for-timer-to-expire-when-using-hv_timer.patch
CommitLineData
c11248ed
GKH
1From ee66e453db13d4837a0dcf9d43efa7a88603161b Mon Sep 17 00:00:00 2001
2From: Sean Christopherson <sean.j.christopherson@intel.com>
3Date: Tue, 16 Apr 2019 13:32:44 -0700
4Subject: KVM: lapic: Busy wait for timer to expire when using hv_timer
5
6From: Sean Christopherson <sean.j.christopherson@intel.com>
7
8commit ee66e453db13d4837a0dcf9d43efa7a88603161b upstream.
9
10...now that VMX's preemption timer, i.e. the hv_timer, also adjusts its
11programmed time based on lapic_timer_advance_ns. Without the delay, a
12guest can see a timer interrupt arrive before the requested time when
13KVM is using the hv_timer to emulate the guest's interrupt.
14
15Fixes: c5ce8235cffa0 ("KVM: VMX: Optimize tscdeadline timer latency")
16Cc: <stable@vger.kernel.org>
17Cc: Wanpeng Li <wanpengli@tencent.com>
18Reviewed-by: Liran Alon <liran.alon@oracle.com>
19Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
20Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
21Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22
23---
24 arch/x86/kvm/lapic.c | 2 +-
25 1 file changed, 1 insertion(+), 1 deletion(-)
26
27--- a/arch/x86/kvm/lapic.c
28+++ b/arch/x86/kvm/lapic.c
29@@ -1453,7 +1453,7 @@ static void apic_timer_expired(struct kv
30 if (swait_active(q))
31 swake_up_one(q);
32
33- if (apic_lvtt_tscdeadline(apic))
34+ if (apic_lvtt_tscdeadline(apic) || ktimer->hv_timer_in_use)
35 ktimer->expired_tscdeadline = ktimer->tscdeadline;
36 }
37