All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: liu ping fan <qemulist@gmail.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	qemu-devel@nongnu.org, David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH 03/12] rcu: add rcu library
Date: Fri, 17 May 2013 09:35:15 +0200	[thread overview]
Message-ID: <5195DDB3.3070903@redhat.com> (raw)
In-Reply-To: <CAJnKYQkZx1QhvVTy-ue6kUrjwoOkZXabNYuOuY+3Xz_fubPxHA@mail.gmail.com>

Il 17/05/2013 06:36, liu ping fan ha scritto:
>> > +    /* Mark the writer thread offline to make sure we don't wait for
>> > +     * our own quiescent state. This allows using synchronize_rcu()
>> > +     * in threads registered as readers.
>> > +     *
>> > +     * rcu_thread_offline() and rcu_thread_online() include a
>> > +     * memory barrier.
>> > +     */
>> > +    if (was_online) {
>> > +        rcu_thread_offline();
> Encourage the user to call synchronize_rcu() in reader?

Not in a read-side critical section, but in a *thread registered as
reader*.  And in QEMU, all threads actually are registered as readers.

> I think the caller should ensure it is outside read-section.

That would be possible by adding a small overhead to rcu_read_lock/unlock.

> Also online can be
> nested which make the situation even worse.

It's not online that can be nested, only offline.  So:

- if the thread is already marked as offline, there will be no effect.

- if the thread is not marked as offline, it will be.

Paolo

  parent reply	other threads:[~2013-05-17  7:38 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-15 15:48 [Qemu-devel] [RFC PATCH 00/12] RCU implementation for QEMU Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 01/12] add a header file for atomic operations Paolo Bonzini
2013-05-15 16:11   ` Peter Maydell
2013-05-15 15:48 ` [Qemu-devel] [PATCH 02/12] qemu-thread: add QemuEvent Paolo Bonzini
2013-05-16 10:15   ` Stefan Hajnoczi
2013-05-16 10:49     ` Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 03/12] rcu: add rcu library Paolo Bonzini
2013-05-16 11:46   ` Stefan Hajnoczi
2013-05-17  4:36   ` liu ping fan
2013-05-17  7:08     ` liu ping fan
2013-05-17  7:35     ` Paolo Bonzini [this message]
2013-05-15 15:48 ` [Qemu-devel] [PATCH 04/12] qemu-thread: register threads with RCU Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 05/12] rcu: add call_rcu Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 06/12] rcu: add rcutorture Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 07/12] rcu: allow nested calls to rcu_thread_offline/rcu_thread_online Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 08/12] qemu-thread: report RCU quiescent states Paolo Bonzini
2013-05-16  8:33   ` liu ping fan
2013-05-16  8:43     ` Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 09/12] event loop: " Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 10/12] cpus: " Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 11/12] block: " Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 12/12] migration: " Paolo Bonzini
2013-05-15 16:03 ` [Qemu-devel] [RFC PATCH 00/12] RCU implementation for QEMU Peter Maydell
2013-05-15 16:17   ` Paolo Bonzini
2013-05-15 16:16 ` Peter Maydell
2013-05-15 16:19   ` Paolo Bonzini
2013-05-15 19:28 ` Peter Maydell

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=5195DDB3.3070903@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemulist@gmail.com \
    /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.