qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Emilio G. Cota" <cota@braap.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/3] rcu: use rcu_{dereference, assign_pointer} instead of atomic_rcu_{read, set}
Date: Wed, 4 Feb 2015 12:25:10 -0500	[thread overview]
Message-ID: <20150204172510.GA15571@flamenco> (raw)
In-Reply-To: <54D1EDDC.3000907@redhat.com> <1423001299-11761-3-git-send-email-cota@braap.org>

On Wed, Feb 04, 2015 at 11:01:00 +0100, Paolo Bonzini wrote:
> On 03/02/2015 23:08, Emilio G. Cota wrote:
> > This matches the semantics of liburcu.
> 
> This is not necessary.  The two sets of macros are exactly the same, so
> it's okay to use atomic_rcu_read/write.

They're not exactly the same, otherwise the patch would be trivial.

The difference can be seen in the change to the macros' documentation:

On Tue, Feb 03, 2015 at 17:08:18 -0500, Emilio G. Cota wrote:
> This matches the semantics of liburcu.
> --- a/docs/rcu.txt
> +++ b/docs/rcu.txt
(snip)
> -     typeof(*p) atomic_rcu_read(p);
> +     typeof(p) rcu_dereference(p);
(snip)
> -     void atomic_rcu_set(p, typeof(*p) v);
> +     void rcu_assign_pointer(p, typeof(p) v);

The liburcu macros take a variable (usually a pointer, hence the
macros' names, but unsigned long is also common), not its address.

These changes require modifications to the calling code as well, e.g.
memory.c:

struct AddressSpace {
...
    /* Accessed via RCU.  */
    struct FlatView *current_map;
...
};
...
struct FlatView *view;
...
-    view = atomic_rcu_read(&as->current_map);                                                                                                                                                                                                                                                
+    view = rcu_dereference(as->current_map);
...
-    atomic_rcu_set(&as->current_map, new_view);                                                                                                                                                                                                                                              
+    rcu_assign_pointer(as->current_map, new_view);  

Thanks,

		Emilio

  parent reply	other threads:[~2015-02-04 17:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03 22:08 [Qemu-devel] [PATCH 0/3] rcu: add option to use upstream liburcu Emilio G. Cota
2015-02-03 22:08 ` [Qemu-devel] [PATCH 1/3] rcu: use call_rcu semantics from liburcu Emilio G. Cota
2015-02-03 22:08 ` [Qemu-devel] [PATCH 2/3] rcu: use rcu_{dereference, assign_pointer} instead of atomic_rcu_{read, set} Emilio G. Cota
2015-02-04 10:01   ` Paolo Bonzini
2015-02-04 17:25   ` Emilio G. Cota [this message]
2015-02-04 17:31     ` Paolo Bonzini
2015-02-03 22:08 ` [Qemu-devel] [PATCH 3/3] rcu: add liburcu knob to configure script Emilio G. Cota
2015-02-04 10:32 ` [Qemu-devel] [PATCH 0/3] rcu: add option to use upstream liburcu Paolo Bonzini
2015-02-04 21:01   ` Emilio G. Cota
2015-02-04 21:17     ` Paolo Bonzini
2015-02-04 23:12       ` Emilio G. Cota

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=20150204172510.GA15571@flamenco \
    --to=cota@braap.org \
    --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).