From: Tim Deegan Subject: Re: [PATCHv7 2/3] gnttab: refactor locking for scalability Date: Fri, 1 May 2015 21:02:22 +0100 Message-ID: <20150501200222.GA58883@deinos.phlegethon.org> References: <1430400525-31064-1-git-send-email-david.vrabel@citrix.com> <1430400525-31064-3-git-send-email-david.vrabel@citrix.com> <20150430143409.GF13575@deinos.phlegethon.org> <5543BFD6.4010405@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YoH8m-0006GG-Oz for xen-devel@lists.xenproject.org; Fri, 01 May 2015 20:02:28 +0000 Content-Disposition: inline In-Reply-To: <5543BFD6.4010405@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Vrabel Cc: Keir Fraser , Jan Beulich , Christoph Egger , Matt Wilson , xen-devel@lists.xenproject.org, Malcolm Crossley , Ian Campbell List-Id: xen-devel@lists.xenproject.org At 19:03 +0100 on 01 May (1430506982), David Vrabel wrote: > On 30/04/15 15:34, Tim Deegan wrote: > > > > OK, so here we hold rd->grant_table->lock and act->lock (which is in > > the rd table) and are going to acquire lgt->maptrack_lock in mapcount(). > > > > That means we can't ever have a path holding domA's maptrack lock that > > acquires domB's gt lock or one of domB's act->locks. I think that's > > OK because after this patch the only paths left that hold the maptrack > > lock can't acquire anything except an act->lock of the same domain. > > Do I understand that correctly? > > > > Also: because mapcount() itself doesn't take any act->lock, there's no > > path that holds two act->locks at the same time? > > Um. I think it's easier if we just say you cannot take another lock > while holding a maptrack_lock since that's currently the case. Er, yes. I had misread the locking order, sorry. So we just need to say (a) no locks inside the maptrack lock and (b) never take two act->locks at once. Tim.