From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 8/8 v2] Change irq_lock from mutex to spinlock. Date: Wed, 12 Aug 2009 12:47:42 +0300 Message-ID: <20090812094742.GC4764@redhat.com> References: <1249993895-11119-1-git-send-email-gleb@redhat.com> <1249993895-11119-9-git-send-email-gleb@redhat.com> <4A827D4C.6070709@redhat.com> <20090812091108.GA4764@redhat.com> <4A8289DA.8000806@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx2.redhat.com ([66.187.237.31]:46835 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932287AbZHLJrn (ORCPT ); Wed, 12 Aug 2009 05:47:43 -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 n7C9lisB000451 for ; Wed, 12 Aug 2009 05:47:44 -0400 Content-Disposition: inline In-Reply-To: <4A8289DA.8000806@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Aug 12, 2009 at 12:22:34PM +0300, Avi Kivity wrote: > On 08/12/2009 12:11 PM, Gleb Natapov wrote: >> On Wed, Aug 12, 2009 at 11:29:00AM +0300, Avi Kivity wrote: >> >>> On 08/11/2009 03:31 PM, Gleb Natapov wrote: >>> >>>> Change irq_lock from mutex to spinlock. We do not sleep while holding >>>> it. >>>> >>>> >>> But why change? >>> >>> >> Isn't it more lightweight? For the remaining use of the lock it doesn't >> really matters, but if I see mutex used somewhere I assume there are >> users that sleeps. >> > > Before the recent change, a mutex was more expensive if there was > contention (waiter would schedule out). Recently the mutex code was > changed to spin while the holder was running. > >>> The only motivation I can see is to allow injection from irqfd and >>> interrupt contexts without requiring a tasklet/work. But that needs >>> spin_lock_irqsave(), not spin_lock(). >>> >>> >> After this series the lock is used only to protect modification of irq >> table, add/delete of ack notifiers and irq source id allocator. None of >> this affects injection from irqfd. >> >> > > Then it can be definitely left as mutex. > OK. -- Gleb.