From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60063) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNQFZ-0001DC-2J for qemu-devel@nongnu.org; Mon, 16 Feb 2015 13:18:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNQFW-0001NU-1x for qemu-devel@nongnu.org; Mon, 16 Feb 2015 13:18:28 -0500 Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]:41909) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNQFV-0001NQ-Rc for qemu-devel@nongnu.org; Mon, 16 Feb 2015 13:18:26 -0500 Received: by mail-wg0-f41.google.com with SMTP id b13so30947887wgh.0 for ; Mon, 16 Feb 2015 10:18:25 -0800 (PST) Received: from playground.station (net-93-66-73-217.cust.vodafonedsl.it. [93.66.73.217]) by mx.google.com with ESMTPSA id p6sm20746248wia.14.2015.02.16.10.18.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Feb 2015 10:18:24 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 16 Feb 2015 19:17:49 +0100 Message-Id: <1424110682-14334-9-git-send-email-pbonzini@redhat.com> In-Reply-To: <1424110682-14334-1-git-send-email-pbonzini@redhat.com> References: <1424110682-14334-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 08/21] rcu: run RCU callbacks under the BQL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This needs to go away sooner or later, but one complication is the complex VFIO data structures that are modified in instance_finalize. Take a shortcut for now. Reviewed-by: Michael Roth Tested-by: Michael Roth Signed-off-by: Paolo Bonzini --- tests/Makefile | 2 +- util/rcu.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index 5caccf7..06acfa1 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -255,7 +255,7 @@ tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o page_cache.o libqemuutil.a tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o tests/test-int128$(EXESUF): tests/test-int128.o -tests/rcutorture$(EXESUF): tests/rcutorture.o libqemuutil.a +tests/rcutorture$(EXESUF): tests/rcutorture.o libqemuutil.a libqemustub.a tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \ hw/core/qdev.o hw/core/qdev-properties.o hw/core/hotplug.o\ diff --git a/util/rcu.c b/util/rcu.c index 486d7b6..bd73b8e 100644 --- a/util/rcu.c +++ b/util/rcu.c @@ -35,6 +35,7 @@ #include "qemu/rcu.h" #include "qemu/atomic.h" #include "qemu/thread.h" +#include "qemu/main-loop.h" /* * Global grace period counter. Bit 0 is always one in rcu_gp_ctr. @@ -237,20 +238,24 @@ static void *call_rcu_thread(void *opaque) atomic_sub(&rcu_call_count, n); synchronize_rcu(); + qemu_mutex_lock_iothread(); while (n > 0) { node = try_dequeue(); while (!node) { + qemu_mutex_unlock_iothread(); qemu_event_reset(&rcu_call_ready_event); node = try_dequeue(); if (!node) { qemu_event_wait(&rcu_call_ready_event); node = try_dequeue(); } + qemu_mutex_lock_iothread(); } n--; node->func(node); } + qemu_mutex_unlock_iothread(); } abort(); } -- 2.3.0