From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJ3gU-0002c0-M2 for qemu-devel@nongnu.org; Wed, 04 Feb 2015 12:24:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJ3gP-0000k6-NZ for qemu-devel@nongnu.org; Wed, 04 Feb 2015 12:24:14 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:40132) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJ3gP-0000jq-JJ for qemu-devel@nongnu.org; Wed, 04 Feb 2015 12:24:09 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id AE24D208CB for ; Wed, 4 Feb 2015 12:24:08 -0500 (EST) Date: Wed, 4 Feb 2015 12:25:10 -0500 From: "Emilio G. Cota" Message-ID: <20150204172510.GA15571@flamenco> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54D1EDDC.3000907@redhat.com> <1423001299-11761-3-git-send-email-cota@braap.org> Subject: Re: [Qemu-devel] [PATCH 2/3] rcu: use rcu_{dereference, assign_pointer} instead of atomic_rcu_{read, set} List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.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