From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it Date: Thu, 26 Jul 2012 16:46:42 +0300 Message-ID: <50114A42.2050702@redhat.com> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Paolo Bonzini , qemu-devel@nongnu.org, kvm@vger.kernel.org, Stefan Hajnoczi , Marcelo Tosatti , Anthony Liguori , Jan Kiszka To: liu ping fan Return-path: Received: from mx1.redhat.com ([209.132.183.28]:50979 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751211Ab2GZNqv (ORCPT ); Thu, 26 Jul 2012 09:46:51 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: 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