From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org,
fred.konrad@greensocs.com
Subject: Re: [Qemu-devel] [PATCH 7/9] rcu: prod call_rcu thread when calling synchronize_rcu
Date: Wed, 4 Feb 2015 11:13:23 +0800 [thread overview]
Message-ID: <20150204031323.GE12948@ad.nay.redhat.com> (raw)
In-Reply-To: <1422967948-3261-8-git-send-email-pbonzini@redhat.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 <pbonzini@redhat.com>
> ---
> 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 <famz@redhat.com>
next prev parent reply other threads:[~2015-02-04 3:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-03 12:52 [Qemu-devel] [PATCH v2 0/9] RCUification of the memory API, part 2 Paolo Bonzini
2015-02-03 12:52 ` [Qemu-devel] [PATCH 1/9] exec: introduce cpu_reload_memory_map Paolo Bonzini
2015-02-04 1:46 ` Fam Zheng
2015-02-03 12:52 ` [Qemu-devel] [PATCH 2/9] exec: make iotlb RCU-friendly Paolo Bonzini
2015-02-04 2:31 ` Fam Zheng
2015-02-03 12:52 ` [Qemu-devel] [PATCH 3/9] exec: RCUify AddressSpaceDispatch Paolo Bonzini
2015-02-04 2:56 ` Fam Zheng
2015-02-03 12:52 ` [Qemu-devel] [PATCH 4/9] rcu: introduce RCU-enabled QLIST Paolo Bonzini
2015-02-04 3:42 ` Fam Zheng
2015-02-04 12:46 ` Paolo Bonzini
2015-02-05 2:03 ` Fam Zheng
2015-02-03 12:52 ` [Qemu-devel] [PATCH 5/9] exec: protect mru_block with RCU Paolo Bonzini
2015-02-05 6:23 ` Fam Zheng
2015-02-05 8:37 ` Paolo Bonzini
2015-02-05 9:30 ` Fam Zheng
2015-02-03 12:52 ` [Qemu-devel] [PATCH 6/9] cosmetic changes preparing for the following patches Paolo Bonzini
2015-02-04 3:10 ` Fam Zheng
2015-02-04 12:51 ` Paolo Bonzini
2015-02-03 12:52 ` [Qemu-devel] [PATCH 7/9] rcu: prod call_rcu thread when calling synchronize_rcu Paolo Bonzini
2015-02-04 3:13 ` Fam Zheng [this message]
2015-02-03 12:52 ` [Qemu-devel] [PATCH 8/9] exec: convert ram_list to QLIST Paolo Bonzini
2015-02-03 12:52 ` [Qemu-devel] [PATCH 9/9] Convert ram_list to RCU Paolo Bonzini
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=20150204031323.GE12948@ad.nay.redhat.com \
--to=famz@redhat.com \
--cc=fred.konrad@greensocs.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).