Re: [RFC PATCH 3/4] hp: Implement Hazard Pointers
From: Boqun Feng
Date: Mon Oct 07 2024 - 09:49:19 EST
On Thu, Oct 03, 2024 at 09:30:53AM -0400, Mathieu Desnoyers wrote:
[...]
> > > + /*
> > > + * Use RCU dereference without lockdep checks, because
> > > + * lockdep is not aware of HP guarantees.
> > > + */
> > > + addr2 = rcu_access_pointer(*addr_p); /* Load A */
> >
> > Why rcu_access_pointer() instead of READ_ONCE()? Because you want to
> > mark the head of address dependency?
>
> Yes, the intent here is to mark the address dependency and provide
> a publication guarantee similar to RCU pairing rcu_assign_pointer
> and rcu_dereference. Do you see any reason why READ_ONCE() would
> suffice here ?
READ_ONCE() also provides address dependencies. See the "DEPENDENCY
RELATIONS: data, addr, and ctrl" section in
tools/memory-model/Documentation/explanantion.txt.
Regards,
Boqun
>
> Thanks,
>
> Mathieu
>