From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH 3/5] Move irq notifiers lists to its own locking. Date: Mon, 13 Jul 2009 13:31:06 -0300 Message-ID: <20090713163106.GA7920@amt.cnet> References: <1247476355-27284-1-git-send-email-gleb@redhat.com> <1247476355-27284-4-git-send-email-gleb@redhat.com> <20090713114550.GA10387@redhat.com> <20090713114844.GF28046@redhat.com> <20090713142320.GJ10402@redhat.com> <20090713143750.GS28046@redhat.com> <20090713162338.GA7713@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "Michael S. Tsirkin" , kvm@vger.kernel.org, avi@redhat.com To: Gleb Natapov Return-path: Received: from mx2.redhat.com ([66.187.237.31]:33487 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754696AbZGMQbv (ORCPT ); Mon, 13 Jul 2009 12:31:51 -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 n6DGVpPb001809 for ; Mon, 13 Jul 2009 12:31:51 -0400 Content-Disposition: inline In-Reply-To: <20090713162338.GA7713@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Jul 13, 2009 at 01:23:38PM -0300, Marcelo Tosatti wrote: > On Mon, Jul 13, 2009 at 05:37:50PM +0300, Gleb Natapov wrote: > > On Mon, Jul 13, 2009 at 05:23:20PM +0300, Michael S. Tsirkin wrote: > > > On Mon, Jul 13, 2009 at 02:48:44PM +0300, Gleb Natapov wrote: > > > > On Mon, Jul 13, 2009 at 02:45:51PM +0300, Michael S. Tsirkin wrote: > > > > > On Mon, Jul 13, 2009 at 12:12:33PM +0300, Gleb Natapov wrote: > > > > > > > > > > > > Signed-off-by: Gleb Natapov > > > > > > > > > > This one is probably better off left as is, > > > > What do you mean "as is"? > > > > > > This is a slow operation. It seems that we could use irq_lock or switch > > > to slot lock or kvm lock here. Why do we need another one? > > > > > irq_lock is completely removed. So either we don't remove it and use it > > here (and we don't need mutex so we change it to spinlock too), or we add > > another lock with the name that actually tell us what its purpose. I prefer > > second option. I am not sure you can use kvm lock without deadlock, and > > slot lock? How this connected to slots management?! > > slots_lock is just a bad name now. See slots_lock is taken for read on > every exit. So taking slots_lock for write means all guests are stopped ^^^^^^ all vcpus > in a known synchronization state. > > If the write side of the operation is very unfrequent (such as > registration of irq ack/mask notifiers), down_write(slots_lock) works as > a simpler replacement for RCU. > > We want to get rid of slots_lock on every exit at some point, though. > > > And this is not about speed of the operation. It is about making reader > > lockless.