On Mon, Jul 13, 2009 at 04:53:15PM +0300, Michael S. Tsirkin wrote: > On Mon, Jul 13, 2009 at 04:28:09PM +0300, Gleb Natapov wrote: > > On Mon, Jul 13, 2009 at 04:23:36PM +0300, Michael S. Tsirkin wrote: > > > On Mon, Jul 13, 2009 at 12:12:30PM +0300, Gleb Natapov wrote: > > > > 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 logic use more fine grained locking. > > > > > > At least irq routing changes and notifier list changes > > > do not seem to be involved in irq injection. > > > So why do we want fine-grained locking there? > > > > > When you have one big lock and you want to eliminate it you look at all > > things it protects and you start introducing different locking for > > unrelated stuff. This is what this patch series does, so I don't really > > get you point. > > But why do you want to eliminate it? What is the operation that this > will speed up? Is there a contention issue and which operations > contend on the lock? > Interrupt injection. I want to be able to inject interrupts without the lock at all. At least msi one. PCI/ISA interrupts still take lock in ioapic code. It can be eliminated too if needed. > > > > 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 uses 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. > > > > > > > > The patch series is on top of my previous series that converts ack notifiers > > > > to the RCU locking. > > > > > > > > Gleb Natapov (5): > > > > 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. > > > > > > > > arch/ia64/kvm/kvm-ia64.c | 29 +++++++++++++++++++-------- > > > > arch/x86/kvm/i8254.c | 4 +- > > > > arch/x86/kvm/lapic.c | 7 +----- > > > > arch/x86/kvm/x86.c | 32 +++++++++++++++++++----------- > > > > include/linux/kvm_host.h | 3 +- > > > > virt/kvm/eventfd.c | 2 - > > > > virt/kvm/ioapic.c | 47 +++++++++++++++++++++++++++------------------ > > > > virt/kvm/ioapic.h | 1 + > > > > virt/kvm/irq_comm.c | 35 ++++++++++++++------------------- > > > > virt/kvm/kvm_main.c | 7 ++--- > > > > 10 files changed, 92 insertions(+), 75 deletions(-) > > > > > > > > -- > > > > To unsubscribe from this list: send the line "unsubscribe kvm" in > > > > the body of a message to majordomo@xxxxxxxxxxxxxxx > > > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > > > -- > > Gleb. > > -- > > To unsubscribe from this list: send the line "unsubscribe kvm" in > > the body of a message to majordomo@xxxxxxxxxxxxxxx > > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html