On Tue, Nov 25, 2014 at 1:44 AM, Eduardo Horvath <e...@netbsd.org> wrote: > Yes, the existing code assumes TSO. A while back I was looking in to fixing > that. > > I enhanced membar_ops with proper memory barriers and then was looking at > the mutex code. Unfortunately, I didn't get very far. It seemed at the > time that the mutex code has two hooks for memory barriers after the > atomic operations, however it's missing memory barrier hooks to ensure > consistency before accessing the lock.
My understanding is that checking mtx_owner, which is usually "volatile uintptr_t mtxa_owner", doesn't need memory barrier, assuming "volatile" works as expected (always read from memory).