]>
Commit | Line | Data |
---|---|---|
c11248ed GKH |
1 | From ee66e453db13d4837a0dcf9d43efa7a88603161b Mon Sep 17 00:00:00 2001 |
2 | From: Sean Christopherson <sean.j.christopherson@intel.com> | |
3 | Date: Tue, 16 Apr 2019 13:32:44 -0700 | |
4 | Subject: KVM: lapic: Busy wait for timer to expire when using hv_timer | |
5 | ||
6 | From: Sean Christopherson <sean.j.christopherson@intel.com> | |
7 | ||
8 | commit ee66e453db13d4837a0dcf9d43efa7a88603161b upstream. | |
9 | ||
10 | ...now that VMX's preemption timer, i.e. the hv_timer, also adjusts its | |
11 | programmed time based on lapic_timer_advance_ns. Without the delay, a | |
12 | guest can see a timer interrupt arrive before the requested time when | |
13 | KVM is using the hv_timer to emulate the guest's interrupt. | |
14 | ||
15 | Fixes: c5ce8235cffa0 ("KVM: VMX: Optimize tscdeadline timer latency") | |
16 | Cc: <stable@vger.kernel.org> | |
17 | Cc: Wanpeng Li <wanpengli@tencent.com> | |
18 | Reviewed-by: Liran Alon <liran.alon@oracle.com> | |
19 | Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> | |
20 | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> | |
21 | Signed-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 |