From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: [PATCH 00/10] make interrupt injection lockless (almost) Date: Sun, 9 Aug 2009 15:41:01 +0300 Message-ID: <1249821671-32356-1-git-send-email-gleb@redhat.com> Cc: kvm@vger.kernel.org To: avi@redhat.com Return-path: Received: from mx2.redhat.com ([66.187.237.31]:45489 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752904AbZHIMlM (ORCPT ); Sun, 9 Aug 2009 08:41:12 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n79CfE84026401 for ; Sun, 9 Aug 2009 08:41:14 -0400 Sender: kvm-owner@vger.kernel.org List-ID: kvm->irq_lock protects too much stuff, but still fail to protect everything it was design to protect (see ack notifiers call in pic). I want to make IRQ injection fast path as lockless as possible. This patch series split kvm->irq_lock mutex to smaller spinlocks each one protects only one thing. Irq routing, irq notifier lists and ioapic gain their own spinlock. Pic is already has its own lock. This patch series also makes interrupt injection to lapic lockless (several kvm_irq_delivery_to_apic() may run in parallel), but access to lapic was never fully locked in the first place. VCPU could access lapic in parallel with interrupt injection. Patch 1 changes irq routing data structure to much more efficient one. Patch 10 introduce API that allows to send MSI message without going through irq routing table. This allows us, among other thing, to limit irq routing table to a small number of entries. Gleb Natapov (10): Change irq routing table to use gsi indexed array. Move irq routing data structure to rcu locking Move irq ack notifier list to arch independent code. Convert irq notifiers lists to RCU locking. Protect irq_sources_bitmap by kvm->lock instead of kvm->irq_lock Move irq routing to its own locking. Move irq notifiers lists to its own locking. Move IO APIC to its own lock. Drop kvm->irq_lock lock. Introduce MSI message sending interface that bypass IRQ routing. arch/ia64/include/asm/kvm_host.h | 1 - arch/ia64/kvm/kvm-ia64.c | 55 +++++++++-- arch/x86/include/asm/kvm_host.h | 3 +- arch/x86/kvm/i8254.c | 4 +- arch/x86/kvm/i8259.c | 8 +- arch/x86/kvm/lapic.c | 7 +- arch/x86/kvm/x86.c | 58 +++++++++--- include/linux/kvm.h | 10 ++- include/linux/kvm_host.h | 21 +++- virt/kvm/eventfd.c | 2 - virt/kvm/ioapic.c | 53 +++++++---- virt/kvm/ioapic.h | 4 +- virt/kvm/irq_comm.c | 196 +++++++++++++++++++++---------------- virt/kvm/kvm_main.c | 11 +- 14 files changed, 277 insertions(+), 156 deletions(-)