qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wen Congyang <wency@cn.fujitsu.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devl <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH for-2.5] rcu: Allow calling rcu_(un)register_thread() during synchronize_rcu()
Date: Mon, 27 Jul 2015 18:44:26 +0800	[thread overview]
Message-ID: <55B60B8A.3040703@cn.fujitsu.com> (raw)
In-Reply-To: <55B60536.4090006@redhat.com>

On 07/27/2015 06:17 PM, Paolo Bonzini wrote:
> 
> 
> On 27/07/2015 04:24, Wen Congyang wrote:
>> +        /* Wait for one thread to report a quiescent state and try again.
>> +         * Release rcu_registry_lock, so rcu_(un)register_thread() doesn't
>> +         * wait too much time. Note: rcu_unregister_thread() may remove
>> +         * the node from qsreaders. That's a bit tricky, but it should work.
> 
> "It should work" is a bit optimistic. :D
> 
> Does this description look okay?
> 
>         /* Wait for one thread to report a quiescent state and try again.
>          * Release rcu_registry_lock, so rcu_(un)register_thread() doesn't
>          * wait too much time.
>          *
>          * rcu_register_thread() may add nodes to &registry; it will not
>          * wake up synchronize_rcu, but that is okay because at least another
>          * thread must exit its RCU read-side critical section before
>          * synchronize_rcu is done.  The next iteration of the loop will
>          * process the new thread or set ->waiting for it.  Hence, this can
>          * at worst cause synchronize_rcu() to wait for longer.

I don't understand this. The next iteration of the loop will move the new thread's
rcu_reader from registry to qsreaders even if we call rcu_read_lock() in the new thread.
Because rcu_gp_ongoing() will return false.

Thanks
Wen Congyang

>          *
>          * rcu_unregister_thread() may remove nodes from &qsreaders instead
>          * of &registry if it runs during qemu_event_wait.  That's okay;
>          * the node then will not be added back to &registry by QLIST_SWAP
>          * below.  The invariant is that the node is part of one list when
>          * rcu_registry_lock is released.
>          */
> 
> Paolo
> .
> 

  reply	other threads:[~2015-07-27 10:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-27  2:24 [Qemu-devel] [PATCH for-2.5] rcu: Allow calling rcu_(un)register_thread() during synchronize_rcu() Wen Congyang
2015-07-27 10:17 ` Paolo Bonzini
2015-07-27 10:44   ` Wen Congyang [this message]
2015-07-27 10:52     ` Paolo Bonzini
2015-07-27 10:54       ` Wen Congyang

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=55B60B8A.3040703@cn.fujitsu.com \
    --to=wency@cn.fujitsu.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).