On 04/02/2015 18:25, Emilio G. Cota wrote:
> 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.

You're right, I was imprecise---I meant they are interoperable.  You can
use atomic_rcu_read/write together with liburcu, you do not need to use
the liburcu-provided rcu_dereference/rcu_assign_pointer.

Paolo

> 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
> 

Reply via email to