On Wed, Jun 07, 2017 at 02:58:50PM +0200, Peter Zijlstra wrote: > On Wed, Jun 07, 2017 at 02:36:27PM +0200, Peter Zijlstra wrote: > > Which (pending the sub confusion) will generate the entire set of: > > > > atomic_add, atomic_add_return{_relaxed,_acquire,_release,} atomic_fetch_add{_relaxed,_acquire,_release,} > > atomic_sub, atomic_sub_return{_relaxed,_acquire,_release,} atomic_fetch_sub{_relaxed,_acquire,_release,} > > > > atomic_and, atomic_fetch_and{_relaxed,_acquire,_release,} > > atomic_or, atomic_fetch_or{_relaxed,_acquire,_release,} > > atomic_xor, atomic_fetch_xor{_relaxed,_acquire,_release,} > > > > Another approach would be to override __atomic_op_{acquire,release} and > use things like: > > "FENCE r,rw" -- (load) ACQUIRE > "FENCE rw,w" -- (store) RELEASE > > And then you only need to provide _relaxed atomics. > > Also, and I didn't check for that, you need to provide: > > smp_load_acquire(), smp_store_release(), atomic_read_acquire(), > atomic_store_release(). Also, you probably need to provide smp_mb__before_spinlock(), but also see: https://lkml.kernel.org/r/20170607161501.819948352@xxxxxxxxxxxxx