From: Paolo Bonzini <pbonzini@redhat.com>
To: Michael Roth <mdroth@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/3] rcu: run RCU callbacks under the BQL
Date: Wed, 11 Feb 2015 21:39:47 +0100 [thread overview]
Message-ID: <54DBBE13.9010100@redhat.com> (raw)
In-Reply-To: <20150211202649.3809.84600@loki>
On 11/02/2015 21:26, Michael Roth wrote:
> 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 <pbonzini@redhat.com>
>> ---
>> 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);
>
> Not sure I understand the reasoning for lock/unlock beyond just guarding
> the ->func() call, what else are we serializing?
I'm trying to avoid multiple back-to-back unlocks and locks. Being
coarse-grained qemu_mutex_lock_iothread/qemu_mutex_unlock_iothread is
likely to hit the slow path---and also slow down _other_ threads.
Paolo
>> }
>> + qemu_mutex_unlock_iothread();
>> }
>> abort();
>> }
>> --
>> 1.8.3.1
>
>
>
next prev parent reply other threads:[~2015-02-11 20:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-11 17:14 [Qemu-devel] [PATCH 0/3] run RCU callbacks within the iothread mutex, fix PCI hotplug Paolo Bonzini
2015-02-11 17:14 ` [Qemu-devel] [PATCH 1/3] rcu: do not let RCU callbacks pile up indefinitely Paolo Bonzini
2015-02-11 17:30 ` Paolo Bonzini
2015-02-12 9:05 ` Fam Zheng
2015-02-11 17:14 ` [Qemu-devel] [PATCH 2/3] rcu: run RCU callbacks under the BQL Paolo Bonzini
2015-02-11 20:26 ` Michael Roth
2015-02-11 20:39 ` Paolo Bonzini [this message]
2015-02-11 17:14 ` [Qemu-devel] [PATCH 3/3] memory: keep the owner of the AddressSpace alive until do_address_space_destroy Paolo Bonzini
2015-02-11 20:33 ` Michael Roth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54DBBE13.9010100@redhat.com \
--to=pbonzini@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.