On Wed, Aug 10, 2016 at 12:17:57PM -0700, Davidlohr Bueso wrote:Can you explain the function name, why smp_mb__after_unlock_lock()?
[...]In this case, from what I can see, we do need a store-load fence.
CPU0 CPU1
complex_mode = true spin_lock(l)
smp_mb() <--- do we want a smp_mb() here?
spin_unlock_wait(l) if (!smp_load_acquire(complex_mode))
foo() foo()
We should not be doing an smp_mb() right after a spin_lock(), makes no sense. The
spinlock machinery should guarantee us the barriers in the unorthodox locking cases,
such as this.
That said, yes, it really should be smp_mb__after_unlock_lock() rather
than smp_mb(). So if this code pattern is both desired and legitimate,
the smp_mb__after_unlock_lock() definitions probably need to move out
of kernel/rcu/tree.h to barrier.h or some such.