From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [patch 2/4] KVM: move coalesced_mmio locking to its own device Date: Sun, 31 May 2009 15:14:36 +0300 Message-ID: <4A2274AC.5050303@redhat.com> References: <20090528044552.151652861@localhost.localdomain> <20090528044808.205238362@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Marcelo Tosatti Return-path: Received: from mx2.redhat.com ([66.187.237.31]:48903 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752053AbZEaMOh (ORCPT ); Sun, 31 May 2009 08:14:37 -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 n4VCEdlb023496 for ; Sun, 31 May 2009 08:14:39 -0400 In-Reply-To: <20090528044808.205238362@localhost.localdomain> Sender: kvm-owner@vger.kernel.org List-ID: Marcelo Tosatti wrote: > Move coalesced_mmio locking to its own device, instead of relying on > kvm->lock. > > Signed-off-by: Marcelo Tosatti > > Index: kvm-irqlock/virt/kvm/coalesced_mmio.c > =================================================================== > --- kvm-irqlock.orig/virt/kvm/coalesced_mmio.c > +++ kvm-irqlock/virt/kvm/coalesced_mmio.c > @@ -26,9 +26,7 @@ static int coalesced_mmio_in_range(struc > if (!is_write) > return 0; > > - /* kvm->lock is taken by the caller and must be not released before > - * dev.read/write > - */ > + spin_lock(&dev->lock); > This unbalanced locking is still very displeasing. At a minimum you need a sparse annotation to indicate it. But I think it really indicates a problem with the io_device API. Potential solutions: - fold in_range() into ->write and ->read. Make those functions responsible for both determining whether they can handle the range and performing the I/O. - have a separate rwlock for the device list. -- error compiling committee.c: too many arguments to function