summaryrefslogtreecommitdiffstats
path: root/virt/kvm/ioapic.h
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2012-07-19 13:45:20 +0300
committerMarcelo Tosatti <mtosatti@redhat.com>2012-07-20 16:12:00 -0300
commit1a577b72475d161b6677c05abe57301362023bb2 (patch)
treed8a9910f0016ada479c5a88c1a330b5e1cbc7ef1 /virt/kvm/ioapic.h
parentd63d3e6217c49b81d74141b7920bbe5950532432 (diff)
downloadlinux-1a577b72475d161b6677c05abe57301362023bb2.tar.gz
linux-1a577b72475d161b6677c05abe57301362023bb2.tar.bz2
linux-1a577b72475d161b6677c05abe57301362023bb2.zip
KVM: fix race with level interrupts
When more than 1 source id is in use for the same GSI, we have the following race related to handling irq_states race: CPU 0 clears bit 0. CPU 0 read irq_state as 0. CPU 1 sets level to 1. CPU 1 calls kvm_ioapic_set_irq(1). CPU 0 calls kvm_ioapic_set_irq(0). Now ioapic thinks the level is 0 but irq_state is not 0. Fix by performing all irq_states bitmap handling under pic/ioapic lock. This also removes the need for atomics with irq_states handling. Reported-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt/kvm/ioapic.h')
-rw-r--r--virt/kvm/ioapic.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/virt/kvm/ioapic.h b/virt/kvm/ioapic.h
index 32872a09b63f..a30abfe6ed16 100644
--- a/virt/kvm/ioapic.h
+++ b/virt/kvm/ioapic.h
@@ -74,7 +74,9 @@ void kvm_ioapic_update_eoi(struct kvm *kvm, int vector, int trigger_mode);
bool kvm_ioapic_handles_vector(struct kvm *kvm, int vector);
int kvm_ioapic_init(struct kvm *kvm);
void kvm_ioapic_destroy(struct kvm *kvm);
-int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level);
+int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int irq_source_id,
+ int level);
+void kvm_ioapic_clear_all(struct kvm_ioapic *ioapic, int irq_source_id);
void kvm_ioapic_reset(struct kvm_ioapic *ioapic);
int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src,
struct kvm_lapic_irq *irq);