From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 4/6] kvm tools: Add rwlock wrapper Date: Thu, 26 May 2011 21:11:26 +0300 Message-ID: <4DDE97CE.4000302@redhat.com> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Sasha Levin , Pekka Enberg , john@jfloren.net, kvm@vger.kernel.org, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com To: Ingo Molnar Return-path: Received: from mx1.redhat.com ([209.132.183.28]:59130 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757802Ab1EZSLo (ORCPT ); Thu, 26 May 2011 14:11:44 -0400 In-Reply-To: <20110526180518.GA3572@elte.hu> Sender: kvm-owner@vger.kernel.org List-ID: 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. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.