Re: [PATCH] locking/mutex: Set and clear owner using WRITE_ONCE()

2016-05-23 Thread Jason Low
On Mon, 2016-05-23 at 14:31 -0700, Davidlohr Bueso wrote: > On Mon, 23 May 2016, Jason Low wrote: > > >On Fri, 2016-05-20 at 18:00 -0700, Davidlohr Bueso wrote: > >> On Fri, 20 May 2016, Waiman Long wrote: > >> > >> >I think mutex-debug.h also needs similar changes for completeness. > >> > >> Mayb

Re: [PATCH] locking/mutex: Set and clear owner using WRITE_ONCE()

2016-05-23 Thread Davidlohr Bueso
On Mon, 23 May 2016, Jason Low wrote: On Fri, 2016-05-20 at 18:00 -0700, Davidlohr Bueso wrote: On Fri, 20 May 2016, Waiman Long wrote: >I think mutex-debug.h also needs similar changes for completeness. Maybe, but given that with debug the wait_lock is unavoidable, doesn't this send the wron

Re: [PATCH] locking/mutex: Set and clear owner using WRITE_ONCE()

2016-05-23 Thread Jason Low
On Fri, 2016-05-20 at 18:00 -0700, Davidlohr Bueso wrote: > On Fri, 20 May 2016, Waiman Long wrote: > > >I think mutex-debug.h also needs similar changes for completeness. > > Maybe, but given that with debug the wait_lock is unavoidable, doesn't > this send the wrong message? The mutex_set_owne

Re: [PATCH] locking/mutex: Set and clear owner using WRITE_ONCE()

2016-05-20 Thread Waiman Long
On 05/20/2016 09:00 PM, Davidlohr Bueso wrote: On Fri, 20 May 2016, Waiman Long wrote: I think mutex-debug.h also needs similar changes for completeness. Maybe, but given that with debug the wait_lock is unavoidable, doesn't this send the wrong message? Thanks, Davidlohr You are right. Opt

Re: [PATCH] locking/mutex: Set and clear owner using WRITE_ONCE()

2016-05-20 Thread Davidlohr Bueso
On Fri, 20 May 2016, Waiman Long wrote: I think mutex-debug.h also needs similar changes for completeness. Maybe, but given that with debug the wait_lock is unavoidable, doesn't this send the wrong message? Thanks, Davidlohr

Re: [PATCH] locking/mutex: Set and clear owner using WRITE_ONCE()

2016-05-20 Thread Jason Low
On Fri, 2016-05-20 at 16:27 -0400, Waiman Long wrote: > On 05/19/2016 06:23 PM, Jason Low wrote: > > The mutex owner can get read and written to without the wait_lock. > > Use WRITE_ONCE when setting and clearing the owner field in order > > to avoid optimizations such as store tearing. This avoids

Re: [PATCH] locking/mutex: Set and clear owner using WRITE_ONCE()

2016-05-20 Thread Waiman Long
On 05/19/2016 06:23 PM, Jason Low wrote: The mutex owner can get read and written to without the wait_lock. Use WRITE_ONCE when setting and clearing the owner field in order to avoid optimizations such as store tearing. This avoids situations where the owner field gets written to with multiple st

Re: [PATCH] locking/mutex: Set and clear owner using WRITE_ONCE()

2016-05-19 Thread Davidlohr Bueso
On Thu, 19 May 2016, Jason Low wrote: The mutex owner can get read and written to without the wait_lock. Use WRITE_ONCE when setting and clearing the owner field in order to avoid optimizations such as store tearing. This avoids situations where the owner field gets written to with multiple stor

[PATCH] locking/mutex: Set and clear owner using WRITE_ONCE()

2016-05-19 Thread Jason Low
The mutex owner can get read and written to without the wait_lock. Use WRITE_ONCE when setting and clearing the owner field in order to avoid optimizations such as store tearing. This avoids situations where the owner field gets written to with multiple stores and another thread could concurrently