Received: from eggs.gnu.org ([2001:4830:134:3::10]:52846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLdyD-0003n7-Gh for qemu-devel@nongnu.org; Wed, 11 Feb 2015 15:33:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLdyA-00019b-AC for qemu-devel@nongnu.org; Wed, 11 Feb 2015 15:33:13 -0500 Received: from e31.co.us.ibm.com ([32.97.110.149]:41636) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLdyA-00019O-3i for qemu-devel@nongnu.org; Wed, 11 Feb 2015 15:33:10 -0500 Received: from /spool/local by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 11 Feb 2015 13:33:06 -0700 Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id D7B8F19D8045 for ; Wed, 11 Feb 2015 13:24:14 -0700 (MST) Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t1BKX7Zi25231390 for ; Wed, 11 Feb 2015 13:33:07 -0700 Received: from d03av05.boulder.ibm.com (localhost [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t1BKX48k018277 for ; Wed, 11 Feb 2015 13:33:05 -0700 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth References: <1423674872-10676-1-git-send-email-pbonzini@redhat.com> <1423674872-10676-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1423674872-10676-3-git-send-email-pbonzini@redhat.com> Message-ID: <20150211202649.3809.84600@loki> Date: Wed, 11 Feb 2015 14:26:49 -0600 Subject: Re: [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: Paolo Bonzini , qemu-devel@nongnu.org Quoting Paolo Bonzini (2015-02-11 11:14:31) > 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 =3D try_dequeue(); > while (!node) { > + qemu_mutex_unlock_iothread(); > qemu_event_reset(&rcu_call_ready_event); > node =3D try_dequeue(); > if (!node) { > qemu_event_wait(&rcu_call_ready_event); > node =3D try_dequeue(); > } > + qemu_mutex_lock_iothread(); > } > = > n--; > node->func(node); Not sure I understand the reasoning for lock/unlock beyond just guarding the ->func() call, what else are we serializing? > } > + qemu_mutex_unlock_iothread(); > } > abort(); > } > -- = > 1.8.3.1