From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIqPH-0002Pe-T6 for qemu-devel@nongnu.org; Tue, 03 Feb 2015 22:13:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YIqPC-0002tP-BE for qemu-devel@nongnu.org; Tue, 03 Feb 2015 22:13:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIqPC-0002sH-2S for qemu-devel@nongnu.org; Tue, 03 Feb 2015 22:13:30 -0500 Date: Wed, 4 Feb 2015 11:13:23 +0800 From: Fam Zheng Message-ID: <20150204031323.GE12948@ad.nay.redhat.com> References: <1422967948-3261-1-git-send-email-pbonzini@redhat.com> <1422967948-3261-8-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1422967948-3261-8-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH 7/9] rcu: prod call_rcu thread when calling synchronize_rcu List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, fred.konrad@greensocs.com On Tue, 02/03 13:52, Paolo Bonzini wrote: > call_rcu operates on the principle that either there is a steady stream of > incoming RCU callbacks, or it is not worthwhile to wake up and process the > few that are there. > > This however makes it hard to assert in testcases that all RCU callbacks > are processed. To avoid this, make call_rcu also process callbacks if there > is a steady stream of synchronize_rcu calls. > > This avoids deadlocks in the upcoming test-rcu-list unit test, which waits > for call_rcu to reclaim all nodes that it allocates. Especially with very > high load on the host, call_rcu decided to wait for a few more callbacks > to pile up, but the test was done and was not going to produce more. > > Signed-off-by: Paolo Bonzini > --- > util/rcu.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/util/rcu.c b/util/rcu.c > index c9c3e6e..aa9f639 100644 > --- a/util/rcu.c > +++ b/util/rcu.c > @@ -48,6 +48,9 @@ unsigned long rcu_gp_ctr = RCU_GP_LOCKED; > QemuEvent rcu_gp_event; > static QemuMutex rcu_gp_lock; > > +static int rcu_call_count; > +static QemuEvent rcu_call_ready_event; > + > /* > * Check whether a quiescent state was crossed between the beginning of > * update_counter_and_wait and now. > @@ -149,6 +152,9 @@ void synchronize_rcu(void) > } > > qemu_mutex_unlock(&rcu_gp_lock); > + if (atomic_read(&rcu_call_count)) { > + qemu_event_set(&rcu_call_ready_event); > + } > } > > > @@ -159,8 +165,6 @@ void synchronize_rcu(void) > */ > static struct rcu_head dummy; > static struct rcu_head *head = &dummy, **tail = &dummy.next; > -static int rcu_call_count; > -static QemuEvent rcu_call_ready_event; > > static void enqueue(struct rcu_head *node) > { > -- > 1.8.3.1 > > Reviewed-by: Fam Zheng