From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it Date: Wed, 25 Jul 2012 11:08:14 +0200 Message-ID: <500FB77E.9010703@redhat.com> References: <1343187070-27371-1-git-send-email-qemulist@gmail.com> <1343187070-27371-2-git-send-email-qemulist@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Stefan Hajnoczi , Marcelo Tosatti , Avi Kivity , Anthony Liguori , Jan Kiszka To: Liu Ping Fan Return-path: Received: from mail-pb0-f46.google.com ([209.85.160.46]:35130 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932767Ab2GYJIY (ORCPT ); Wed, 25 Jul 2012 05:08:24 -0400 Received: by pbbrp8 with SMTP id rp8so1104635pbb.19 for ; Wed, 25 Jul 2012 02:08:23 -0700 (PDT) In-Reply-To: <1343187070-27371-2-git-send-email-qemulist@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: Il 25/07/2012 05:31, Liu Ping Fan ha scritto: > From: Liu Ping Fan > > rwlock: > qemu_device_tree_mutex > > rd side: > --device_del(destruction of device will be postphoned until unplug > ack from guest), > --pci hot-unplug > --iteration (qdev_reset_all) > > wr side: > --device_add > > Signed-off-by: Liu Ping Fan > --- > hw/pci-hotplug.c | 4 ++++ > hw/qdev-monitor.c | 17 ++++++++++++++++- > hw/qdev.c | 2 ++ > 3 files changed, 22 insertions(+), 1 deletions(-) > > diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c > index e7fb780..b3b88c1 100644 > --- a/hw/pci-hotplug.c > +++ b/hw/pci-hotplug.c > @@ -265,9 +265,11 @@ static int pci_device_hot_remove(Monitor *mon, const char *pci_addr) > return -1; > } > > + qemu_rwlock_rdlock_devtree(); This is not defined anywhere, is a piece missing in the patch? Paolo