Re: [PATCH v5 4/4] MCS Lock: Barrier corrections

2013-11-19 Thread Paul E. McKenney
On Fri, Nov 08, 2013 at 11:52:38AM -0800, Tim Chen wrote: > From: Waiman Long > > This patch corrects the way memory barriers are used in the MCS lock > with smp_load_acquire and smp_store_release fucnction. > It removes ones that are not needed. > > It uses architecture specific load-acquire

Re: [PATCH v5 4/4] MCS Lock: Barrier corrections

2013-11-19 Thread Paul E. McKenney
On Fri, Nov 08, 2013 at 11:52:38AM -0800, Tim Chen wrote: From: Waiman Long waiman.l...@hp.com This patch corrects the way memory barriers are used in the MCS lock with smp_load_acquire and smp_store_release fucnction. It removes ones that are not needed. It uses architecture specific

Re: [PATCH v5 4/4] MCS Lock: Barrier corrections

2013-11-12 Thread George Spelvin
> On Mon, Nov 11, 2013 at 09:17:52PM +, Tim Chen wrote: >> An alternate implementation is >> while (!ACCESS_ONCE(node->locked)) >> arch_mutex_cpu_relax(); >> smp_load_acquire(>locked); >> >> Leaving the smp_load_acquire at the end to provide appropriate barrier. >> Will

Re: [PATCH v5 4/4] MCS Lock: Barrier corrections

2013-11-12 Thread Waiman Long
On 11/11/2013 04:17 PM, Tim Chen wrote: You could then augment that with [cmp]xchg_{acquire,release} as appropriate. +/* * In order to acquire the lock, the caller should declare a local node and * pass a reference of the node to this function in addition to the lock. * If the lock

Re: [PATCH v5 4/4] MCS Lock: Barrier corrections

2013-11-12 Thread Waiman Long
On 11/11/2013 04:17 PM, Tim Chen wrote: You could then augment that with [cmp]xchg_{acquire,release} as appropriate. +/* * In order to acquire the lock, the caller should declare a local node and * pass a reference of the node to this function in addition to the lock. * If the lock

Re: [PATCH v5 4/4] MCS Lock: Barrier corrections

2013-11-12 Thread George Spelvin
On Mon, Nov 11, 2013 at 09:17:52PM +, Tim Chen wrote: An alternate implementation is while (!ACCESS_ONCE(node-locked)) arch_mutex_cpu_relax(); smp_load_acquire(node-locked); Leaving the smp_load_acquire at the end to provide appropriate barrier. Will that be

[PATCH v5 4/4] MCS Lock: Barrier corrections

2013-11-08 Thread Tim Chen
From: Waiman Long This patch corrects the way memory barriers are used in the MCS lock with smp_load_acquire and smp_store_release fucnction. It removes ones that are not needed. It uses architecture specific load-acquire and store-release primitives for synchronization, if available. Generic

[PATCH v5 4/4] MCS Lock: Barrier corrections

2013-11-08 Thread Tim Chen
From: Waiman Long waiman.l...@hp.com This patch corrects the way memory barriers are used in the MCS lock with smp_load_acquire and smp_store_release fucnction. It removes ones that are not needed. It uses architecture specific load-acquire and store-release primitives for synchronization, if