Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-03 Thread Paul E. McKenney
On Thu, Aug 03, 2017 at 05:12:24PM +0100, Will Deacon wrote: > On Thu, Aug 03, 2017 at 07:55:14AM -0700, Paul E. McKenney wrote: > > On Thu, Aug 03, 2017 at 10:05:16PM +0800, Boqun Feng wrote: > > > Hi Will, > > > > > > On Wed, Aug 02, 2017 at 10:45:32AM +0100, Will Deacon wrote: > > > [...] > >

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-03 Thread Paul E. McKenney
On Thu, Aug 03, 2017 at 05:12:24PM +0100, Will Deacon wrote: > On Thu, Aug 03, 2017 at 07:55:14AM -0700, Paul E. McKenney wrote: > > On Thu, Aug 03, 2017 at 10:05:16PM +0800, Boqun Feng wrote: > > > Hi Will, > > > > > > On Wed, Aug 02, 2017 at 10:45:32AM +0100, Will Deacon wrote: > > > [...] > >

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-03 Thread Will Deacon
On Thu, Aug 03, 2017 at 07:55:14AM -0700, Paul E. McKenney wrote: > On Thu, Aug 03, 2017 at 10:05:16PM +0800, Boqun Feng wrote: > > Hi Will, > > > > On Wed, Aug 02, 2017 at 10:45:32AM +0100, Will Deacon wrote: > > [...] > > > > > > It's worth noting that we don't have the problem with any

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-03 Thread Will Deacon
On Thu, Aug 03, 2017 at 07:55:14AM -0700, Paul E. McKenney wrote: > On Thu, Aug 03, 2017 at 10:05:16PM +0800, Boqun Feng wrote: > > Hi Will, > > > > On Wed, Aug 02, 2017 at 10:45:32AM +0100, Will Deacon wrote: > > [...] > > > > > > It's worth noting that we don't have the problem with any

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-03 Thread Paul E. McKenney
On Thu, Aug 03, 2017 at 10:05:16PM +0800, Boqun Feng wrote: > Hi Will, > > On Wed, Aug 02, 2017 at 10:45:32AM +0100, Will Deacon wrote: > [...] > > > > It's worth noting that we don't have the problem with any value-returning > > atomics, so all flavours of xchg in this test would be forbidden

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-03 Thread Paul E. McKenney
On Thu, Aug 03, 2017 at 10:05:16PM +0800, Boqun Feng wrote: > Hi Will, > > On Wed, Aug 02, 2017 at 10:45:32AM +0100, Will Deacon wrote: > [...] > > > > It's worth noting that we don't have the problem with any value-returning > > atomics, so all flavours of xchg in this test would be forbidden

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-03 Thread Boqun Feng
Hi Will, On Wed, Aug 02, 2017 at 10:45:32AM +0100, Will Deacon wrote: [...] > > It's worth noting that we don't have the problem with any value-returning > atomics, so all flavours of xchg in this test would be forbidden on arm64 > too. > > > C C-WillDeacon-MP+o-r+ai-rmb-o.litmus > > > >

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-03 Thread Boqun Feng
Hi Will, On Wed, Aug 02, 2017 at 10:45:32AM +0100, Will Deacon wrote: [...] > > It's worth noting that we don't have the problem with any value-returning > atomics, so all flavours of xchg in this test would be forbidden on arm64 > too. > > > C C-WillDeacon-MP+o-r+ai-rmb-o.litmus > > > >

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-02 Thread Paul E. McKenney
On Wed, Aug 02, 2017 at 10:45:32AM +0100, Will Deacon wrote: > Hi Paul, > > On Tue, Aug 01, 2017 at 09:14:12AM -0700, Paul E. McKenney wrote: > > On Tue, Aug 01, 2017 at 01:17:13PM +0100, Will Deacon wrote: > > > On Tue, Aug 01, 2017 at 01:47:44PM +0200, Peter Zijlstra wrote: > > > > On Tue, Aug

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-02 Thread Paul E. McKenney
On Wed, Aug 02, 2017 at 10:45:32AM +0100, Will Deacon wrote: > Hi Paul, > > On Tue, Aug 01, 2017 at 09:14:12AM -0700, Paul E. McKenney wrote: > > On Tue, Aug 01, 2017 at 01:17:13PM +0100, Will Deacon wrote: > > > On Tue, Aug 01, 2017 at 01:47:44PM +0200, Peter Zijlstra wrote: > > > > On Tue, Aug

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-02 Thread Will Deacon
Hi Paul, On Tue, Aug 01, 2017 at 09:14:12AM -0700, Paul E. McKenney wrote: > On Tue, Aug 01, 2017 at 01:17:13PM +0100, Will Deacon wrote: > > On Tue, Aug 01, 2017 at 01:47:44PM +0200, Peter Zijlstra wrote: > > > On Tue, Aug 01, 2017 at 11:19:00AM +0100, Will Deacon wrote: > > > > On Tue, Aug 01,

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-02 Thread Will Deacon
Hi Paul, On Tue, Aug 01, 2017 at 09:14:12AM -0700, Paul E. McKenney wrote: > On Tue, Aug 01, 2017 at 01:17:13PM +0100, Will Deacon wrote: > > On Tue, Aug 01, 2017 at 01:47:44PM +0200, Peter Zijlstra wrote: > > > On Tue, Aug 01, 2017 at 11:19:00AM +0100, Will Deacon wrote: > > > > On Tue, Aug 01,

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-02 Thread Will Deacon
On Tue, Aug 01, 2017 at 03:18:18PM -0700, Paul E. McKenney wrote: > On Tue, Aug 01, 2017 at 06:42:00PM +0200, Peter Zijlstra wrote: > > On Tue, Aug 01, 2017 at 09:14:12AM -0700, Paul E. McKenney wrote: > > > So if ARM really needs the litmus test with smp_rmb() to be allowed, > > > we need to

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-02 Thread Will Deacon
On Tue, Aug 01, 2017 at 03:18:18PM -0700, Paul E. McKenney wrote: > On Tue, Aug 01, 2017 at 06:42:00PM +0200, Peter Zijlstra wrote: > > On Tue, Aug 01, 2017 at 09:14:12AM -0700, Paul E. McKenney wrote: > > > So if ARM really needs the litmus test with smp_rmb() to be allowed, > > > we need to

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Paul E. McKenney
On Tue, Aug 01, 2017 at 06:42:00PM +0200, Peter Zijlstra wrote: > On Tue, Aug 01, 2017 at 09:14:12AM -0700, Paul E. McKenney wrote: > > So if ARM really needs the litmus test with smp_rmb() to be allowed, > > we need to adjust the Linux-kernel memory model appropriately. Which > > means that one

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Paul E. McKenney
On Tue, Aug 01, 2017 at 06:42:00PM +0200, Peter Zijlstra wrote: > On Tue, Aug 01, 2017 at 09:14:12AM -0700, Paul E. McKenney wrote: > > So if ARM really needs the litmus test with smp_rmb() to be allowed, > > we need to adjust the Linux-kernel memory model appropriately. Which > > means that one

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Paul E. McKenney
On Tue, Aug 01, 2017 at 09:14:12AM -0700, Paul E. McKenney wrote: > On Tue, Aug 01, 2017 at 01:17:13PM +0100, Will Deacon wrote: > > On Tue, Aug 01, 2017 at 01:47:44PM +0200, Peter Zijlstra wrote: > > > On Tue, Aug 01, 2017 at 11:19:00AM +0100, Will Deacon wrote: > > > > On Tue, Aug 01, 2017 at

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Paul E. McKenney
On Tue, Aug 01, 2017 at 09:14:12AM -0700, Paul E. McKenney wrote: > On Tue, Aug 01, 2017 at 01:17:13PM +0100, Will Deacon wrote: > > On Tue, Aug 01, 2017 at 01:47:44PM +0200, Peter Zijlstra wrote: > > > On Tue, Aug 01, 2017 at 11:19:00AM +0100, Will Deacon wrote: > > > > On Tue, Aug 01, 2017 at

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Will Deacon
On Tue, Aug 01, 2017 at 06:42:00PM +0200, Peter Zijlstra wrote: > On Tue, Aug 01, 2017 at 09:14:12AM -0700, Paul E. McKenney wrote: > > So if ARM really needs the litmus test with smp_rmb() to be allowed, > > we need to adjust the Linux-kernel memory model appropriately. Which > > means that one

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Will Deacon
On Tue, Aug 01, 2017 at 06:42:00PM +0200, Peter Zijlstra wrote: > On Tue, Aug 01, 2017 at 09:14:12AM -0700, Paul E. McKenney wrote: > > So if ARM really needs the litmus test with smp_rmb() to be allowed, > > we need to adjust the Linux-kernel memory model appropriately. Which > > means that one

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Peter Zijlstra
On Tue, Aug 01, 2017 at 09:14:12AM -0700, Paul E. McKenney wrote: > So if ARM really needs the litmus test with smp_rmb() to be allowed, > we need to adjust the Linux-kernel memory model appropriately. Which > means that one of us needs to reach out to the usual suspects. Would > you like to do

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Peter Zijlstra
On Tue, Aug 01, 2017 at 09:14:12AM -0700, Paul E. McKenney wrote: > So if ARM really needs the litmus test with smp_rmb() to be allowed, > we need to adjust the Linux-kernel memory model appropriately. Which > means that one of us needs to reach out to the usual suspects. Would > you like to do

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Paul E. McKenney
On Tue, Aug 01, 2017 at 01:17:13PM +0100, Will Deacon wrote: > On Tue, Aug 01, 2017 at 01:47:44PM +0200, Peter Zijlstra wrote: > > On Tue, Aug 01, 2017 at 11:19:00AM +0100, Will Deacon wrote: > > > On Tue, Aug 01, 2017 at 11:01:21AM +0200, Peter Zijlstra wrote: > > > > On Mon, Jul 31, 2017 at

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Paul E. McKenney
On Tue, Aug 01, 2017 at 01:17:13PM +0100, Will Deacon wrote: > On Tue, Aug 01, 2017 at 01:47:44PM +0200, Peter Zijlstra wrote: > > On Tue, Aug 01, 2017 at 11:19:00AM +0100, Will Deacon wrote: > > > On Tue, Aug 01, 2017 at 11:01:21AM +0200, Peter Zijlstra wrote: > > > > On Mon, Jul 31, 2017 at

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Paul E. McKenney
On Tue, Aug 01, 2017 at 11:01:21AM +0200, Peter Zijlstra wrote: > On Mon, Jul 31, 2017 at 10:43:45AM -0700, Paul E. McKenney wrote: > > > Why wouldn't the following have ACQUIRE semantics? > > > > atomic_inc(); > > smp_mb__after_atomic(); > > > > Is the issue that there is no actual

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Paul E. McKenney
On Tue, Aug 01, 2017 at 11:01:21AM +0200, Peter Zijlstra wrote: > On Mon, Jul 31, 2017 at 10:43:45AM -0700, Paul E. McKenney wrote: > > > Why wouldn't the following have ACQUIRE semantics? > > > > atomic_inc(); > > smp_mb__after_atomic(); > > > > Is the issue that there is no actual

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Peter Zijlstra
On Tue, Aug 01, 2017 at 01:17:13PM +0100, Will Deacon wrote: > Also, wouldn't this problem also arise if your atomics were built using a > spinlock where unlock had release semantics? I'm hoping none of our spnilock based atomics have weak ordering. Spinlock based atomics are a little crazy to

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Peter Zijlstra
On Tue, Aug 01, 2017 at 01:17:13PM +0100, Will Deacon wrote: > Also, wouldn't this problem also arise if your atomics were built using a > spinlock where unlock had release semantics? I'm hoping none of our spnilock based atomics have weak ordering. Spinlock based atomics are a little crazy to

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Will Deacon
On Tue, Aug 01, 2017 at 01:47:44PM +0200, Peter Zijlstra wrote: > On Tue, Aug 01, 2017 at 11:19:00AM +0100, Will Deacon wrote: > > On Tue, Aug 01, 2017 at 11:01:21AM +0200, Peter Zijlstra wrote: > > > On Mon, Jul 31, 2017 at 10:43:45AM -0700, Paul E. McKenney wrote: > > > > > > > Why wouldn't the

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Will Deacon
On Tue, Aug 01, 2017 at 01:47:44PM +0200, Peter Zijlstra wrote: > On Tue, Aug 01, 2017 at 11:19:00AM +0100, Will Deacon wrote: > > On Tue, Aug 01, 2017 at 11:01:21AM +0200, Peter Zijlstra wrote: > > > On Mon, Jul 31, 2017 at 10:43:45AM -0700, Paul E. McKenney wrote: > > > > > > > Why wouldn't the

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Peter Zijlstra
On Tue, Aug 01, 2017 at 11:19:00AM +0100, Will Deacon wrote: > On Tue, Aug 01, 2017 at 11:01:21AM +0200, Peter Zijlstra wrote: > > On Mon, Jul 31, 2017 at 10:43:45AM -0700, Paul E. McKenney wrote: > > > > > Why wouldn't the following have ACQUIRE semantics? > > > > > > atomic_inc(); > > >

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Peter Zijlstra
On Tue, Aug 01, 2017 at 11:19:00AM +0100, Will Deacon wrote: > On Tue, Aug 01, 2017 at 11:01:21AM +0200, Peter Zijlstra wrote: > > On Mon, Jul 31, 2017 at 10:43:45AM -0700, Paul E. McKenney wrote: > > > > > Why wouldn't the following have ACQUIRE semantics? > > > > > > atomic_inc(); > > >

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Will Deacon
On Tue, Aug 01, 2017 at 11:01:21AM +0200, Peter Zijlstra wrote: > On Mon, Jul 31, 2017 at 10:43:45AM -0700, Paul E. McKenney wrote: > > > Why wouldn't the following have ACQUIRE semantics? > > > > atomic_inc(); > > smp_mb__after_atomic(); > > > > Is the issue that there is no actual

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Will Deacon
On Tue, Aug 01, 2017 at 11:01:21AM +0200, Peter Zijlstra wrote: > On Mon, Jul 31, 2017 at 10:43:45AM -0700, Paul E. McKenney wrote: > > > Why wouldn't the following have ACQUIRE semantics? > > > > atomic_inc(); > > smp_mb__after_atomic(); > > > > Is the issue that there is no actual

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Peter Zijlstra
On Mon, Jul 31, 2017 at 10:43:45AM -0700, Paul E. McKenney wrote: > Why wouldn't the following have ACQUIRE semantics? > > atomic_inc(); > smp_mb__after_atomic(); > > Is the issue that there is no actual value returned or some such? Yes, so that the inc is a load-store, and thus

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-08-01 Thread Peter Zijlstra
On Mon, Jul 31, 2017 at 10:43:45AM -0700, Paul E. McKenney wrote: > Why wouldn't the following have ACQUIRE semantics? > > atomic_inc(); > smp_mb__after_atomic(); > > Is the issue that there is no actual value returned or some such? Yes, so that the inc is a load-store, and thus

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-07-31 Thread Boqun Feng
On Mon, Jul 31, 2017 at 10:43:45AM -0700, Paul E. McKenney wrote: > On Mon, Jul 31, 2017 at 07:04:03PM +0800, Boqun Feng wrote: > > On Mon, Jul 31, 2017 at 11:05:35AM +0200, Peter Zijlstra wrote: > > > On Wed, Jul 26, 2017 at 08:47:50PM +0800, Boqun Feng wrote: > > > > > > > > + > > > > >

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-07-31 Thread Boqun Feng
On Mon, Jul 31, 2017 at 10:43:45AM -0700, Paul E. McKenney wrote: > On Mon, Jul 31, 2017 at 07:04:03PM +0800, Boqun Feng wrote: > > On Mon, Jul 31, 2017 at 11:05:35AM +0200, Peter Zijlstra wrote: > > > On Wed, Jul 26, 2017 at 08:47:50PM +0800, Boqun Feng wrote: > > > > > > > > + > > > > >

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-07-31 Thread Paul E. McKenney
On Mon, Jul 31, 2017 at 07:04:03PM +0800, Boqun Feng wrote: > On Mon, Jul 31, 2017 at 11:05:35AM +0200, Peter Zijlstra wrote: > > On Wed, Jul 26, 2017 at 08:47:50PM +0800, Boqun Feng wrote: > > > > > > + > > > > +Further, while something like: > > > > + > > > > + smp_mb__before_atomic(); > > > >

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-07-31 Thread Paul E. McKenney
On Mon, Jul 31, 2017 at 07:04:03PM +0800, Boqun Feng wrote: > On Mon, Jul 31, 2017 at 11:05:35AM +0200, Peter Zijlstra wrote: > > On Wed, Jul 26, 2017 at 08:47:50PM +0800, Boqun Feng wrote: > > > > > > + > > > > +Further, while something like: > > > > + > > > > + smp_mb__before_atomic(); > > > >

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-07-31 Thread Boqun Feng
On Mon, Jul 31, 2017 at 11:05:35AM +0200, Peter Zijlstra wrote: > On Wed, Jul 26, 2017 at 08:47:50PM +0800, Boqun Feng wrote: > > > > + > > > +Further, while something like: > > > + > > > + smp_mb__before_atomic(); > > > + atomic_dec(); > > > + > > > +is a 'typical' RELEASE pattern, the barrier

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-07-31 Thread Boqun Feng
On Mon, Jul 31, 2017 at 11:05:35AM +0200, Peter Zijlstra wrote: > On Wed, Jul 26, 2017 at 08:47:50PM +0800, Boqun Feng wrote: > > > > + > > > +Further, while something like: > > > + > > > + smp_mb__before_atomic(); > > > + atomic_dec(); > > > + > > > +is a 'typical' RELEASE pattern, the barrier

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-07-31 Thread Peter Zijlstra
On Wed, Jul 26, 2017 at 08:47:50PM +0800, Boqun Feng wrote: > > + > > +Further, while something like: > > + > > + smp_mb__before_atomic(); > > + atomic_dec(); > > + > > +is a 'typical' RELEASE pattern, the barrier is strictly stronger than > > +a RELEASE. Similarly for something like: > > + >

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-07-31 Thread Peter Zijlstra
On Wed, Jul 26, 2017 at 08:47:50PM +0800, Boqun Feng wrote: > > + > > +Further, while something like: > > + > > + smp_mb__before_atomic(); > > + atomic_dec(); > > + > > +is a 'typical' RELEASE pattern, the barrier is strictly stronger than > > +a RELEASE. Similarly for something like: > > + >

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-07-26 Thread Randy Dunlap
nits... On 07/26/2017 04:53 AM, Peter Zijlstra wrote: > --- > Subject: documentation,atomic: Add new documents > From: Peter Zijlstra > Date: Mon Jun 12 14:50:27 CEST 2017 > > Since we've vastly expanded the atomic_t interface in recent years the > existing documentation

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-07-26 Thread Randy Dunlap
nits... On 07/26/2017 04:53 AM, Peter Zijlstra wrote: > --- > Subject: documentation,atomic: Add new documents > From: Peter Zijlstra > Date: Mon Jun 12 14:50:27 CEST 2017 > > Since we've vastly expanded the atomic_t interface in recent years the > existing documentation is woefully out of

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-07-26 Thread Boqun Feng
On Wed, Jul 26, 2017 at 01:53:28PM +0200, Peter Zijlstra wrote: > > New version.. > > > --- > Subject: documentation,atomic: Add new documents > From: Peter Zijlstra > Date: Mon Jun 12 14:50:27 CEST 2017 > > Since we've vastly expanded the atomic_t interface in recent

Re: [RFC][PATCH v3]: documentation,atomic: Add new documents

2017-07-26 Thread Boqun Feng
On Wed, Jul 26, 2017 at 01:53:28PM +0200, Peter Zijlstra wrote: > > New version.. > > > --- > Subject: documentation,atomic: Add new documents > From: Peter Zijlstra > Date: Mon Jun 12 14:50:27 CEST 2017 > > Since we've vastly expanded the atomic_t interface in recent years the > existing

[RFC][PATCH v3]: documentation,atomic: Add new documents

2017-07-26 Thread Peter Zijlstra
New version.. --- Subject: documentation,atomic: Add new documents From: Peter Zijlstra Date: Mon Jun 12 14:50:27 CEST 2017 Since we've vastly expanded the atomic_t interface in recent years the existing documentation is woefully out of date and people seem to get

[RFC][PATCH v3]: documentation,atomic: Add new documents

2017-07-26 Thread Peter Zijlstra
New version.. --- Subject: documentation,atomic: Add new documents From: Peter Zijlstra Date: Mon Jun 12 14:50:27 CEST 2017 Since we've vastly expanded the atomic_t interface in recent years the existing documentation is woefully out of date and people seem to get confused a bit. Start a new