summaryrefslogtreecommitdiff
path: root/arch/x86/kvm/irq_comm.c
diff options
context:
space:
mode:
authorRadim Krčmář <rkrcmar@redhat.com>2015-10-08 21:23:34 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2015-10-14 17:41:08 +0300
commitdb2bdcbbbd32e5500b822d5e74ef8b5bd777e687 (patch)
treeddcb2bf5b396e9e24f5926f380f85455dc630ad5 /arch/x86/kvm/irq_comm.c
parentc77f3fab441c3e466b4c3601a475fc31ce156b06 (diff)
downloadlinux-db2bdcbbbd32e5500b822d5e74ef8b5bd777e687.tar.xz
KVM: x86: fix edge EOI and IOAPIC reconfig race
KVM uses eoi_exit_bitmap to track vectors that need an action on EOI. The problem is that IOAPIC can be reconfigured while an interrupt with old configuration is pending and eoi_exit_bitmap only remembers the newest configuration; thus EOI from the pending interrupt is not recognized. (Reconfiguration is not a problem for level interrupts, because IOAPIC sends interrupt with the new configuration.) For an edge interrupt with ACK notifiers, like i8254 timer; things can happen in this order 1) IOAPIC inject a vector from i8254 2) guest reconfigures that vector's VCPU and therefore eoi_exit_bitmap on original VCPU gets cleared 3) guest's handler for the vector does EOI 4) KVM's EOI handler doesn't pass that vector to IOAPIC because it is not in that VCPU's eoi_exit_bitmap 5) i8254 stops working A simple solution is to set the IOAPIC vector in eoi_exit_bitmap if the vector is in PIR/IRR/ISR. This creates an unwanted situation if the vector is reused by a non-IOAPIC source, but I think it is so rare that we don't want to make the solution more sophisticated. The simple solution also doesn't work if we are reconfiguring the vector. (Shouldn't happen in the wild and I'd rather fix users of ACK notifiers instead of working around that.) The are no races because ioapic injection and reconfig are locked. Fixes: b053b2aef25d ("KVM: x86: Add EOI exit bitmap inference") [Before b053b2aef25d, this bug happened only with APICv.] Fixes: c7c9c56ca26f ("x86, apicv: add virtual interrupt delivery support") Cc: <stable@vger.kernel.org> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/irq_comm.c')
0 files changed, 0 insertions, 0 deletions