From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: [PATCH 4/6] kvm tools: Add rwlock wrapper Date: Thu, 26 May 2011 21:57:03 +0300 Message-ID: <1306436223.3065.36.camel@lappy> References: <1306419950-19064-1-git-send-email-levinsasha928@gmail.com> <1306419950-19064-4-git-send-email-levinsasha928@gmail.com> <1306426743.3065.34.camel@lappy> <20110526180518.GA3572@elte.hu> <4DDE97CE.4000302@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Ingo Molnar , john@jfloren.net, kvm@vger.kernel.org, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com, "Paul E. McKenney" , mathieu.desnoyers@efficios.com To: Pekka Enberg Return-path: Received: from mail-wy0-f174.google.com ([74.125.82.174]:59405 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932916Ab1EZS5L (ORCPT ); Thu, 26 May 2011 14:57:11 -0400 Received: by wya21 with SMTP id 21so743987wya.19 for ; Thu, 26 May 2011 11:57:10 -0700 (PDT) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Thu, 2011-05-26 at 21:21 +0300, Pekka Enberg wrote: > On Thu, May 26, 2011 at 9:11 PM, Avi Kivity wrote: > > On 05/26/2011 09:05 PM, Ingo Molnar wrote: > >> > >> > > >> > I've added some rwlocks because of what Ingo said yesterday about > >> > adding/removing devices after the first initialization phase. > >> > > >> > Take MMIO lock for example: Since we can now run SMP guests, we may > >> > have multiple MMIO exits (one from each VCPU thread). Each of those > >> > exits leads to searching the MMIO rbtree. > >> > > >> > We can use a mutex to lock it, but it just means that those threads > >> > will be blocked there instead of concurrently searching the MMIO > >> > tree which makes the search linear instead of parallel. > >> > > >> > It's hard to bring 'real' numbers at this stage because the only > >> > 'real' device we have which uses MMIO is the VESA driver, and we > >> > can't really simulate many VCPUs writing to it :) > >> > >> I'd suggest keeping it simple first - rwlocks are nasty and will > >> bounce a cacheline just as much. > > > > Well, this is the first case where tools/kvm can do better than qemu with > > its global lock, so I think it's worth it. > > > >> If lookup scalability is an issue we can extend RCU to tools/kvm/. > > > > Definitely rcu is a perfect patch for mmio dispatch. > > Userspace RCU code is here, Sasha, if you feel like tackling this: > > http://lttng.org/urcu > > :-) > > I'm CC'ing Paul and Mathieu as well for urcu. Sounds good! Should be quite an addition and could be used in more places than just the MMIO dispatcher. -- Sasha.