qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH 1/3] rcu: do not let RCU callbacks pile up indefinitely
Date: Thu, 12 Feb 2015 17:05:26 +0800	[thread overview]
Message-ID: <20150212090526.GA10309@ad.nay.redhat.com> (raw)
In-Reply-To: <1423674872-10676-2-git-send-email-pbonzini@redhat.com>

On Wed, 02/11 18:14, Paolo Bonzini wrote:
> Always process them within half a second.  Even though waiting a little
> is useful, it is not okay to delay e.g. qemu_opts_del forever.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  util/rcu.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/util/rcu.c b/util/rcu.c
> index c9c3e6e..486d7b6 100644
> --- a/util/rcu.c
> +++ b/util/rcu.c
> @@ -223,14 +223,16 @@ static void *call_rcu_thread(void *opaque)
>           * Fetch rcu_call_count now, we only must process elements that were
>           * added before synchronize_rcu() starts.
>           */
> -        while (n < RCU_CALL_MIN_SIZE && ++tries <= 5) {
> -            g_usleep(100000);
> -            qemu_event_reset(&rcu_call_ready_event);
> -            n = atomic_read(&rcu_call_count);
> -            if (n < RCU_CALL_MIN_SIZE) {
> -                qemu_event_wait(&rcu_call_ready_event);
> +        while (n == 0 || (n < RCU_CALL_MIN_SIZE && ++tries <= 5)) {
> +            g_usleep(10000);
> +            if (n == 0) {
> +                qemu_event_reset(&rcu_call_ready_event);
>                  n = atomic_read(&rcu_call_count);
> +                if (n == 0) {
> +                    qemu_event_wait(&rcu_call_ready_event);
> +                }
>              }
> +            n = atomic_read(&rcu_call_count);
>          }
>  
>          atomic_sub(&rcu_call_count, n);

Reviewed-by: Fam Zheng <famz@redhat.com>

  parent reply	other threads:[~2015-02-12  9:05 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 [this message]
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
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=20150212090526.GA10309@ad.nay.redhat.com \
    --to=famz@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.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 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).