From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCH 0/5][RFC] more fine grained locking for IRQ injection Date: Mon, 13 Jul 2009 17:21:48 +0300 Message-ID: <20090713142148.GI10402@redhat.com> References: <1247476355-27284-1-git-send-email-gleb@redhat.com> <20090713132335.GB10387@redhat.com> <20090713132809.GM28046@redhat.com> <20090713135315.GH10402@redhat.com> <20090713135858.GP28046@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, avi@redhat.com, mtosatti@redhat.com To: Gleb Natapov Return-path: Received: from mx2.redhat.com ([66.187.237.31]:60744 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755135AbZGMOWe (ORCPT ); Mon, 13 Jul 2009 10:22:34 -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 n6DEMYUe027697 for ; Mon, 13 Jul 2009 10:22:34 -0400 Content-Disposition: inline In-Reply-To: <20090713135858.GP28046@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Jul 13, 2009 at 04:58:58PM +0300, Gleb Natapov wrote: > 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. You are talking about the lapic changes below, right? OK. But how do the other changes help, specifically? I'm less familiar with ioapic, but I think irq routing and irq notifier list changes are done off data path. > 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@vger.kernel.org > > > > > 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@vger.kernel.org > > > 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@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html