From 46a929bc15fcd48e1e0e770a44040a6949cae133 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Mon, 28 Dec 2009 14:08:30 +0200 Subject: KVM: avoid taking ioapic mutex for non-ioapic EOIs When the guest acknowledges an interrupt, it sends an EOI message to the local apic, which broadcasts it to the ioapic. To handle the EOI, we need to take the ioapic mutex. On large guests, this causes a lot of contention on this mutex. Since large guests usually don't route interrupts via the ioapic (they use msi instead), this is completely unnecessary. Avoid taking the mutex by introducing a handled_vectors bitmap. Before taking the mutex, check if the ioapic was actually responsible for the acked vector. If not, we can return early. Signed-off-by: Avi Kivity Signed-off-by: Marcelo Tosatti --- virt/kvm/ioapic.h | 1 + 1 file changed, 1 insertion(+) (limited to 'virt/kvm/ioapic.h') diff --git a/virt/kvm/ioapic.h b/virt/kvm/ioapic.h index 419c43b667ab..a505ce9054f3 100644 --- a/virt/kvm/ioapic.h +++ b/virt/kvm/ioapic.h @@ -46,6 +46,7 @@ struct kvm_ioapic { struct kvm *kvm; void (*ack_notifier)(void *opaque, int irq); struct mutex lock; + DECLARE_BITMAP(handled_vectors, 256); }; #ifdef DEBUG -- cgit v1.2.2