From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43049) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLasH-0002zf-S5 for qemu-devel@nongnu.org; Wed, 11 Feb 2015 12:15:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLas8-0002y8-R3 for qemu-devel@nongnu.org; Wed, 11 Feb 2015 12:14:53 -0500 Received: from mail-wg0-x236.google.com ([2a00:1450:400c:c00::236]:61100) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLas8-0002y1-Jx for qemu-devel@nongnu.org; Wed, 11 Feb 2015 12:14:44 -0500 Received: by mail-wg0-f54.google.com with SMTP id y19so4796139wgg.13 for ; Wed, 11 Feb 2015 09:14:44 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 11 Feb 2015 18:14:31 +0100 Message-Id: <1423674872-10676-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1423674872-10676-1-git-send-email-pbonzini@redhat.com> References: <1423674872-10676-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 2/3] rcu: run RCU callbacks under the BQL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mdroth@linux.vnet.ibm.com 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. 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 d5df168..e11bfe7 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -257,7 +257,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(); } -- 1.8.3.1