RE: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-21 Thread David Laight
From: Paul E. McKenney > Sent: 21 October 2015 00:35 ... > There is also the question of whether the barrier forces ordering > of unrelated stores, everything initially zero and all accesses > READ_ONCE() or WRITE_ONCE(): > > P0 P1 P2 P3 > X = 1;

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-21 Thread Paul E. McKenney
On Wed, Oct 21, 2015 at 10:24:52AM +0200, Peter Zijlstra wrote: > On Tue, Oct 20, 2015 at 04:34:51PM -0700, Paul E. McKenney wrote: > > There is also the question of whether the barrier forces ordering > > of unrelated stores, everything initially zero and all accesses > > READ_ONCE() or

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-21 Thread Peter Zijlstra
On Wed, Oct 21, 2015 at 12:29:23PM -0700, Paul E. McKenney wrote: > On Wed, Oct 21, 2015 at 10:24:52AM +0200, Peter Zijlstra wrote: > > On Tue, Oct 20, 2015 at 04:34:51PM -0700, Paul E. McKenney wrote: > > > There is also the question of whether the barrier forces ordering > > > of unrelated

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-21 Thread Paul E. McKenney
On Wed, Oct 21, 2015 at 09:36:44PM +0200, Peter Zijlstra wrote: > On Wed, Oct 21, 2015 at 12:29:23PM -0700, Paul E. McKenney wrote: > > On Wed, Oct 21, 2015 at 10:24:52AM +0200, Peter Zijlstra wrote: > > > On Tue, Oct 20, 2015 at 04:34:51PM -0700, Paul E. McKenney wrote: > > > > There is also the

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-21 Thread Paul E. McKenney
On Wed, Oct 21, 2015 at 04:04:04PM +, David Laight wrote: > From: Paul E. McKenney > > Sent: 21 October 2015 00:35 > ... > > There is also the question of whether the barrier forces ordering > > of unrelated stores, everything initially zero and all accesses > > READ_ONCE() or WRITE_ONCE(): >

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-21 Thread Peter Zijlstra
On Tue, Oct 20, 2015 at 04:34:51PM -0700, Paul E. McKenney wrote: > There is also the question of whether the barrier forces ordering > of unrelated stores, everything initially zero and all accesses > READ_ONCE() or WRITE_ONCE(): > > P0 P1 P2 P3 >

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-20 Thread Boqun Feng
On Mon, Oct 19, 2015 at 12:23:24PM +0200, Peter Zijlstra wrote: > On Mon, Oct 19, 2015 at 09:17:18AM +0800, Boqun Feng wrote: > > This is confusing me right now. ;-) > > > > Let's use a simple example for only one primitive, as I understand it, > > if we say a primitive A is "fully ordered", we

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-20 Thread Boqun Feng
On Mon, Oct 12, 2015 at 04:30:48PM -0700, Paul E. McKenney wrote: > On Fri, Oct 09, 2015 at 07:33:28PM +0100, Will Deacon wrote: > > On Fri, Oct 09, 2015 at 10:43:27AM -0700, Paul E. McKenney wrote: > > > On Fri, Oct 09, 2015 at 10:51:29AM +0100, Will Deacon wrote: [snip] > > > > > We could also

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-20 Thread Paul E. McKenney
On Mon, Oct 19, 2015 at 09:17:18AM +0800, Boqun Feng wrote: > On Fri, Oct 09, 2015 at 10:40:39AM +0100, Will Deacon wrote: > > On Fri, Oct 09, 2015 at 10:31:38AM +0200, Peter Zijlstra wrote: > [snip] > > > > > > So lots of little confusions added up to complete fail :-{ > > > > > > Mostly I

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-19 Thread Peter Zijlstra
On Mon, Oct 19, 2015 at 09:17:18AM +0800, Boqun Feng wrote: > This is confusing me right now. ;-) > > Let's use a simple example for only one primitive, as I understand it, > if we say a primitive A is "fully ordered", we actually mean: > > 1.The memory operations preceding(in program order)

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-18 Thread Boqun Feng
On Fri, Oct 09, 2015 at 10:40:39AM +0100, Will Deacon wrote: > On Fri, Oct 09, 2015 at 10:31:38AM +0200, Peter Zijlstra wrote: [snip] > > > > So lots of little confusions added up to complete fail :-{ > > > > Mostly I think it was the UNLOCK x + LOCK x are fully ordered (where I > > forgot: but

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-12 Thread Paul E. McKenney
On Fri, Oct 09, 2015 at 07:33:28PM +0100, Will Deacon wrote: > On Fri, Oct 09, 2015 at 10:43:27AM -0700, Paul E. McKenney wrote: > > On Fri, Oct 09, 2015 at 10:51:29AM +0100, Will Deacon wrote: > > > How do people feel about including these in memory-barriers.txt? I find > > > them considerably

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-09 Thread Peter Zijlstra
On Thu, Oct 08, 2015 at 02:44:39PM -0700, Paul E. McKenney wrote: > On Thu, Oct 08, 2015 at 01:16:38PM +0200, Peter Zijlstra wrote: > > On Thu, Oct 08, 2015 at 02:50:36PM +1100, Michael Ellerman wrote: > > > On Wed, 2015-10-07 at 08:25 -0700, Paul E. McKenney wrote: > > > > > > Currently, we do

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-09 Thread Will Deacon
On Fri, Oct 09, 2015 at 10:31:38AM +0200, Peter Zijlstra wrote: > On Thu, Oct 08, 2015 at 02:44:39PM -0700, Paul E. McKenney wrote: > > On Thu, Oct 08, 2015 at 01:16:38PM +0200, Peter Zijlstra wrote: > > > On Thu, Oct 08, 2015 at 02:50:36PM +1100, Michael Ellerman wrote: > > > > On Wed, 2015-10-07

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-09 Thread Will Deacon
Hi Paul, On Thu, Oct 08, 2015 at 03:17:16PM -0700, Paul E. McKenney wrote: > On Thu, Oct 08, 2015 at 01:59:38PM +0100, Will Deacon wrote: > > I thought Paul was talking about something like this case: > > > > CPU A CPU B CPU C > > foo = 1 > > UNLOCK x > > LOCK x > >

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-09 Thread Peter Zijlstra
On Thu, Oct 08, 2015 at 02:44:39PM -0700, Paul E. McKenney wrote: > > > > I am with Peter -- we do need the benchmark results for PPC. > > > > > > Urgh, sorry guys. I have been slowly doing some benchmarks, but time is > > > not > > > plentiful at the moment. > > > > > > If we do a straight

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-09 Thread Peter Zijlstra
On Fri, Oct 09, 2015 at 10:40:39AM +0100, Will Deacon wrote: > Stepping back a second, I believe that there are three cases: > > > RELEASE X -> ACQUIRE Y (same CPU) >* Needs a barrier on TSO architectures for full ordering +PPC > UNLOCK X -> LOCK Y (same CPU) >* Needs a

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-09 Thread Peter Zijlstra
On Fri, Oct 09, 2015 at 10:51:29AM +0100, Will Deacon wrote: > > The corresponding litmus tests are below. > > How do people feel about including these in memory-barriers.txt? I find > them considerably easier to read than our current kernel code + list of > possible orderings + wall of text, but

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-09 Thread Peter Zijlstra
On Fri, Oct 09, 2015 at 10:40:39AM +0100, Will Deacon wrote: > > Which leads me to think I would like to suggest alternative rules for > > RELEASE/ACQUIRE (to replace those Will suggested; as I think those are > > partly responsible for my confusion). > > Yeah, sorry. I originally used the phrase

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-09 Thread Will Deacon
On Fri, Oct 09, 2015 at 01:02:46PM +0200, Peter Zijlstra wrote: > On Fri, Oct 09, 2015 at 10:40:39AM +0100, Will Deacon wrote: > > Stepping back a second, I believe that there are three cases: > > > > > > RELEASE X -> ACQUIRE Y (same CPU) > >* Needs a barrier on TSO architectures for full

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-09 Thread Will Deacon
On Fri, Oct 09, 2015 at 01:12:02PM +0200, Peter Zijlstra wrote: > On Fri, Oct 09, 2015 at 10:40:39AM +0100, Will Deacon wrote: > > > Which leads me to think I would like to suggest alternative rules for > > > RELEASE/ACQUIRE (to replace those Will suggested; as I think those are > > > partly

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-09 Thread Paul E. McKenney
On Fri, Oct 09, 2015 at 10:51:29AM +0100, Will Deacon wrote: > Hi Paul, > > On Thu, Oct 08, 2015 at 03:17:16PM -0700, Paul E. McKenney wrote: > > On Thu, Oct 08, 2015 at 01:59:38PM +0100, Will Deacon wrote: > > > I thought Paul was talking about something like this case: > > > > > > CPU A

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-09 Thread Paul E. McKenney
On Fri, Oct 09, 2015 at 10:40:39AM +0100, Will Deacon wrote: > On Fri, Oct 09, 2015 at 10:31:38AM +0200, Peter Zijlstra wrote: > > On Thu, Oct 08, 2015 at 02:44:39PM -0700, Paul E. McKenney wrote: > > > On Thu, Oct 08, 2015 at 01:16:38PM +0200, Peter Zijlstra wrote: > > > > On Thu, Oct 08, 2015 at

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-09 Thread Paul E. McKenney
On Fri, Oct 09, 2015 at 01:25:54PM +0200, Peter Zijlstra wrote: > On Fri, Oct 09, 2015 at 10:51:29AM +0100, Will Deacon wrote: > > > The corresponding litmus tests are below. > > > > How do people feel about including these in memory-barriers.txt? I find > > them considerably easier to read than

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-09 Thread Peter Zijlstra
On Fri, Oct 09, 2015 at 01:51:11PM +0100, Will Deacon wrote: > On Fri, Oct 09, 2015 at 01:12:02PM +0200, Peter Zijlstra wrote: > > On Fri, Oct 09, 2015 at 10:40:39AM +0100, Will Deacon wrote: > > > > Which leads me to think I would like to suggest alternative rules for > > > > RELEASE/ACQUIRE (to

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-09 Thread Will Deacon
On Fri, Oct 09, 2015 at 10:43:27AM -0700, Paul E. McKenney wrote: > On Fri, Oct 09, 2015 at 10:51:29AM +0100, Will Deacon wrote: > > How do people feel about including these in memory-barriers.txt? I find > > them considerably easier to read than our current kernel code + list of > > possible

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-08 Thread Peter Zijlstra
On Thu, Oct 08, 2015 at 02:50:36PM +1100, Michael Ellerman wrote: > On Wed, 2015-10-07 at 08:25 -0700, Paul E. McKenney wrote: > > Currently, we do need smp_mb__after_unlock_lock() to be after the > > acquisition on PPC -- putting it between the unlock and the lock > > of course doesn't cut it

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-08 Thread Will Deacon
On Thu, Oct 08, 2015 at 01:16:38PM +0200, Peter Zijlstra wrote: > On Thu, Oct 08, 2015 at 02:50:36PM +1100, Michael Ellerman wrote: > > On Wed, 2015-10-07 at 08:25 -0700, Paul E. McKenney wrote: > > > > Currently, we do need smp_mb__after_unlock_lock() to be after the > > > acquisition on PPC --

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-08 Thread Paul E. McKenney
On Thu, Oct 08, 2015 at 01:16:38PM +0200, Peter Zijlstra wrote: > On Thu, Oct 08, 2015 at 02:50:36PM +1100, Michael Ellerman wrote: > > On Wed, 2015-10-07 at 08:25 -0700, Paul E. McKenney wrote: > > > > Currently, we do need smp_mb__after_unlock_lock() to be after the > > > acquisition on PPC --

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-08 Thread Paul E. McKenney
On Thu, Oct 08, 2015 at 01:59:38PM +0100, Will Deacon wrote: > On Thu, Oct 08, 2015 at 01:16:38PM +0200, Peter Zijlstra wrote: > > On Thu, Oct 08, 2015 at 02:50:36PM +1100, Michael Ellerman wrote: > > > On Wed, 2015-10-07 at 08:25 -0700, Paul E. McKenney wrote: > > > > > > Currently, we do need

Re: [PATCH v2] barriers: introduce smp_mb__release_acquire and update documentation

2015-10-07 Thread Michael Ellerman
On Wed, 2015-10-07 at 08:25 -0700, Paul E. McKenney wrote: > On Wed, Oct 07, 2015 at 02:23:17PM +0100, Will Deacon wrote: > > Hi Peter, > > > > Thanks for the headache ;) > > > > On Wed, Oct 07, 2015 at 01:19:15PM +0200, Peter Zijlstra wrote: > > > On Wed, Oct 07, 2015 at 11:59:28AM +0100, Will