[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 7/9] rcu: prod call_rcu thread when calling sync
From: |
Fam Zheng |
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 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
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 <address@hidden>
> ---
> 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 <address@hidden>
- Re: [Qemu-devel] [PATCH 4/9] rcu: introduce RCU-enabled QLIST, (continued)
[Qemu-devel] [PATCH 6/9] cosmetic changes preparing for the following patches, Paolo Bonzini, 2015/02/03
[Qemu-devel] [PATCH 8/9] exec: convert ram_list to QLIST, Paolo Bonzini, 2015/02/03
[Qemu-devel] [PATCH 2/9] exec: make iotlb RCU-friendly, Paolo Bonzini, 2015/02/03
[Qemu-devel] [PATCH 7/9] rcu: prod call_rcu thread when calling synchronize_rcu, Paolo Bonzini, 2015/02/03
- Re: [Qemu-devel] [PATCH 7/9] rcu: prod call_rcu thread when calling synchronize_rcu,
Fam Zheng <=
[Qemu-devel] [PATCH 9/9] Convert ram_list to RCU, Paolo Bonzini, 2015/02/03