From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sz2m6-0004Eh-FK for qemu-devel@nongnu.org; Wed, 08 Aug 2012 05:42:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sz2m2-0002Qw-5S for qemu-devel@nongnu.org; Wed, 08 Aug 2012 05:41:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52219) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sz2m1-0002Qm-Sl for qemu-devel@nongnu.org; Wed, 08 Aug 2012 05:41:54 -0400 Message-ID: <5022345A.5090805@redhat.com> Date: Wed, 08 Aug 2012 11:41:46 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1344407156-25562-1-git-send-email-qemulist@gmail.com> <1344407156-25562-12-git-send-email-qemulist@gmail.com> In-Reply-To: <1344407156-25562-12-git-send-email-qemulist@gmail.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 11/15] lock: introduce global lock for device tree List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Ping Fan Cc: kvm@vger.kernel.org, Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, Blue Swirl , Avi Kivity , Anthony Liguori , Stefan Hajnoczi , =?ISO-8859-15?Q?Andreas_F=E4rber?= Il 08/08/2012 08:25, Liu Ping Fan ha scritto: > From: Liu Ping Fan > > Signed-off-by: Liu Ping Fan > --- > cpus.c | 12 ++++++++++++ > main-loop.h | 3 +++ > 2 files changed, 15 insertions(+), 0 deletions(-) > > diff --git a/cpus.c b/cpus.c > index b182b3d..a734b36 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -611,6 +611,7 @@ static void qemu_tcg_init_cpu_signals(void) > } > #endif /* _WIN32 */ > > +QemuMutex qemu_device_tree_mutex; > QemuMutex qemu_global_mutex; > static QemuCond qemu_io_proceeded_cond; > static bool iothread_requesting_mutex; > @@ -634,6 +635,7 @@ void qemu_init_cpu_loop(void) > qemu_cond_init(&qemu_work_cond); > qemu_cond_init(&qemu_io_proceeded_cond); > qemu_mutex_init(&qemu_global_mutex); > + qemu_mutex_init(&qemu_device_tree_mutex); > > qemu_thread_get_self(&io_thread); > } > @@ -911,6 +913,16 @@ void qemu_mutex_unlock_iothread(void) > qemu_mutex_unlock(&qemu_global_mutex); > } > > +void qemu_lock_devtree(void) > +{ > + qemu_mutex_lock(&qemu_device_tree_mutex); > +} > + > +void qemu_unlock_devtree(void) > +{ > + qemu_mutex_unlock(&qemu_device_tree_mutex); > +} We don't need the wrappers. They are there for the big lock just because TCG needs extra work for iothread_requesting_mutex. Paolo > static int all_vcpus_paused(void) > { > CPUArchState *penv = first_cpu; > diff --git a/main-loop.h b/main-loop.h > index dce1cd9..17e959a 100644 > --- a/main-loop.h > +++ b/main-loop.h > @@ -353,6 +353,9 @@ void qemu_mutex_lock_iothread(void); > */ > void qemu_mutex_unlock_iothread(void); > > +void qemu_lock_devtree(void); > +void qemu_unlock_devtree(void); > + > /* internal interfaces */ > > void qemu_fd_register(int fd); >