]> git.proxmox.com Git - pve-kernel-jessie.git/blame - 0001-kvm-x86-correctly-reset-dest_map-vector-when-restori.patch
use GCC-6 for building
[pve-kernel-jessie.git] / 0001-kvm-x86-correctly-reset-dest_map-vector-when-restori.patch
CommitLineData
76f2c8a3
FG
1From b0eaf4506f5f95d15d6731d72c0ddf4a2179eefa Mon Sep 17 00:00:00 2001
2From: Paolo Bonzini <pbonzini@redhat.com>
3Date: Wed, 14 Sep 2016 23:39:12 +0200
4Subject: [PATCH] kvm: x86: correctly reset dest_map->vector when restoring
5 LAPIC state
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10When userspace sends KVM_SET_LAPIC, KVM schedules a check between
11the vCPU's IRR and ISR and the IOAPIC redirection table, in order
12to re-establish the IOAPIC's dest_map (the list of CPUs servicing
13the real-time clock interrupt with the corresponding vectors).
14
15However, __rtc_irq_eoi_tracking_restore_one was forgetting to
16set dest_map->vectors. Because of this, the IOAPIC did not process
17the real-time clock interrupt EOI, ioapic->rtc_status.pending_eoi
18got stuck at a non-zero value, and further RTC interrupts were
19reported to userspace as coalesced.
20
21Fixes: 9e4aabe2bb3454c83dac8139cf9974503ee044db
22Fixes: 4d99ba898dd0c521ca6cdfdde55c9b58aea3cb3d
23Cc: stable@vger.kernel.org
24Cc: Joerg Roedel <jroedel@suse.de>
25Cc: David Gilbert <dgilbert@redhat.com>
26Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
27Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
28Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
29---
30 arch/x86/kvm/ioapic.c | 8 +++++---
31 1 file changed, 5 insertions(+), 3 deletions(-)
32
33diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c
34index 5f42d03..c7220ba 100644
35--- a/arch/x86/kvm/ioapic.c
36+++ b/arch/x86/kvm/ioapic.c
37@@ -109,6 +109,7 @@ static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu)
38 {
39 bool new_val, old_val;
40 struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic;
41+ struct dest_map *dest_map = &ioapic->rtc_status.dest_map;
42 union kvm_ioapic_redirect_entry *e;
43
44 e = &ioapic->redirtbl[RTC_GSI];
45@@ -117,16 +118,17 @@ static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu)
46 return;
47
48 new_val = kvm_apic_pending_eoi(vcpu, e->fields.vector);
49- old_val = test_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map);
50+ old_val = test_bit(vcpu->vcpu_id, dest_map->map);
51
52 if (new_val == old_val)
53 return;
54
55 if (new_val) {
56- __set_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map);
57+ __set_bit(vcpu->vcpu_id, dest_map->map);
58+ dest_map->vectors[vcpu->vcpu_id] = e->fields.vector;
59 ioapic->rtc_status.pending_eoi++;
60 } else {
61- __clear_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map);
62+ __clear_bit(vcpu->vcpu_id, dest_map->map);
63 ioapic->rtc_status.pending_eoi--;
64 rtc_status_pending_eoi_check_valid(ioapic);
65 }
66--
672.1.4
68