From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH v3 7/8] Move IO APIC to its own lock. Date: Thu, 13 Aug 2009 13:09:28 +0300 Message-ID: <20090813100928.GC23736@redhat.com> References: <1250079442-5163-1-git-send-email-gleb@redhat.com> <1250079442-5163-8-git-send-email-gleb@redhat.com> <20090813091330.GB17022@amt.cnet> <20090813094810.GB23736@redhat.com> <4A83E1B9.3040508@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Marcelo Tosatti , kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx2.redhat.com ([66.187.237.31]:50134 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753902AbZHMKJa (ORCPT ); Thu, 13 Aug 2009 06:09:30 -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 n7DA9VK1018735 for ; Thu, 13 Aug 2009 06:09:31 -0400 Content-Disposition: inline In-Reply-To: <4A83E1B9.3040508@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Aug 13, 2009 at 12:49:45PM +0300, Avi Kivity wrote: > On 08/13/2009 12:48 PM, Gleb Natapov wrote: > >On Thu, Aug 13, 2009 at 06:13:30AM -0300, Marcelo Tosatti wrote: > >>>+++ b/virt/kvm/ioapic.c > >>>@@ -182,6 +182,7 @@ int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level) > >>> union kvm_ioapic_redirect_entry entry; > >>> int ret = 1; > >>> > >>>+ mutex_lock(&ioapic->lock); > >>> if (irq>= 0&& irq< IOAPIC_NUM_PINS) { > >>> entry = ioapic->redirtbl[irq]; > >>> level ^= entry.fields.polarity; > >>But this is an RCU critical section now, right? > >> > >Correct! Forget about that. It was spinlock, but Avi prefers mutexes. > > Well, I prefer correct code to mutexes. > > >>If so, you can't sleep, must use a spinlock. > >Either that or I can collect callbacks in critical section and call them > >afterwords. > > There's also srcu. > What are the disadvantages? There should be some, otherwise why not use it all the time. -- Gleb.