On Thu, Mar 10, 2022 at 09:05:54AM +0000, Visa Hankala wrote:
> > As a bonus alpha gets the membar it needs.
> 
> In general, atomic_* functions have not provided implicit memory
> barriers on OpenBSD.
> 
> I am not sure if the data dependency barrier is needed where
> atomic_load_int() and atomic_load_long() are used. The memory ordering
> guarantee is very weak and does not seem useful in any of the use cases
> in the patch. However, the barrier does not appear to make things worse
> in terms of correctness. Except maybe in assertions where they cause
> subtle side effects.

Our atomic functions don't provide barriers.  The only exception
is reading on Alpha.  The idea of membar_datadep_consumer() is taken
from Linux arch/alpha/include/asm/rwonce.h.

As I understand it, Alpha CPU may have more than one data cache.
So you need a barrier between reading a pointer and using its value.
Without knowing the details, we just do what Linux does.

bluhm

Reply via email to