From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SuOOw-0007Xe-Nm for qemu-devel@nongnu.org; Thu, 26 Jul 2012 09:47:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SuOOv-0005pn-Fg for qemu-devel@nongnu.org; Thu, 26 Jul 2012 09:46:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49176) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SuOOv-0005pY-80 for qemu-devel@nongnu.org; Thu, 26 Jul 2012 09:46:49 -0400 Message-ID: <50114A42.2050702@redhat.com> Date: Thu, 26 Jul 2012 16:46:42 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1343187070-27371-1-git-send-email-qemulist@gmail.com> <1343187070-27371-2-git-send-email-qemulist@gmail.com> <500FB77E.9010703@redhat.com> <50113F84.6010802@redhat.com> <50114302.5050509@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: kvm@vger.kernel.org, Stefan Hajnoczi , Marcelo Tosatti , qemu-devel@nongnu.org, Anthony Liguori , Jan Kiszka , Paolo Bonzini On 07/26/2012 04:21 PM, liu ping fan wrote: > On Thu, Jul 26, 2012 at 9:15 PM, Avi Kivity wrote: >> On 07/26/2012 04:14 PM, liu ping fan wrote: >>>> >>>> From the description above, I don't see why it can't be a mutex. >>>> >>> Searching in the device tree (or MemoryRegion view) can be often in >>> parallel, especially in mmio-dispatch code path >> >> In mmio dispatch we have a pointer to the object, we don't need to >> search anything. Is device tree search a hot path? >> > I think, we need lock to protect searching --phys_page_find() from > deleter--DeviceClass:unmap, so rwlock? Better a lock on phys_map (because it is easily replaced by rcu, later). I think phys_map is also better isolated, so it will be easier to find all the placed that need protection and to avoid deadlock. -- error compiling committee.c: too many arguments to function