Re: Linux-kernel examples for LKMM recipes

2017-10-18 Thread Paul E. McKenney
On Wed, Oct 18, 2017 at 05:18:37PM -0400, Alan Stern wrote: > On Wed, 18 Oct 2017, Paul E. McKenney wrote: > > > > Well, you could explicitly mention that in the multi-thread case, this > > > means all accesses to the shared variable had better use READ_ONCE() or > > > WRITE_ONCE(). > > > > Like

Re: Linux-kernel examples for LKMM recipes

2017-10-18 Thread Paul E. McKenney
On Wed, Oct 18, 2017 at 05:18:37PM -0400, Alan Stern wrote: > On Wed, 18 Oct 2017, Paul E. McKenney wrote: > > > > Well, you could explicitly mention that in the multi-thread case, this > > > means all accesses to the shared variable had better use READ_ONCE() or > > > WRITE_ONCE(). > > > > Like

Re: Linux-kernel examples for LKMM recipes

2017-10-18 Thread Alan Stern
On Wed, 18 Oct 2017, Paul E. McKenney wrote: > > Well, you could explicitly mention that in the multi-thread case, this > > means all accesses to the shared variable had better use READ_ONCE() or > > WRITE_ONCE(). > > Like this? > > Thanx,

Re: Linux-kernel examples for LKMM recipes

2017-10-18 Thread Alan Stern
On Wed, 18 Oct 2017, Paul E. McKenney wrote: > > Well, you could explicitly mention that in the multi-thread case, this > > means all accesses to the shared variable had better use READ_ONCE() or > > WRITE_ONCE(). > > Like this? > > Thanx,

Re: Linux-kernel examples for LKMM recipes

2017-10-18 Thread Paul E. McKenney
On Wed, Oct 18, 2017 at 10:43:42AM -0400, Alan Stern wrote: > On Tue, 17 Oct 2017, Paul E. McKenney wrote: > > > > > > > b. Compilers are permitted to use the "as-if" rule. > > > > > > That is, a compiler can emit whatever code it likes, > > > > > > as long as the

Re: Linux-kernel examples for LKMM recipes

2017-10-18 Thread Paul E. McKenney
On Wed, Oct 18, 2017 at 10:43:42AM -0400, Alan Stern wrote: > On Tue, 17 Oct 2017, Paul E. McKenney wrote: > > > > > > > b. Compilers are permitted to use the "as-if" rule. > > > > > > That is, a compiler can emit whatever code it likes, > > > > > > as long as the

Re: Linux-kernel examples for LKMM recipes

2017-10-18 Thread Alan Stern
On Tue, 17 Oct 2017, Paul E. McKenney wrote: > > > > > b. Compilers are permitted to use the "as-if" rule. > > > > > That is, a compiler can emit whatever code it likes, > > > > > as long as the results appear just as if the compiler > > > > >

Re: Linux-kernel examples for LKMM recipes

2017-10-18 Thread Alan Stern
On Tue, 17 Oct 2017, Paul E. McKenney wrote: > > > > > b. Compilers are permitted to use the "as-if" rule. > > > > > That is, a compiler can emit whatever code it likes, > > > > > as long as the results appear just as if the compiler > > > > >

Re: Linux-kernel examples for LKMM recipes

2017-10-17 Thread Paul E. McKenney
On Tue, Oct 17, 2017 at 05:03:01PM -0400, Alan Stern wrote: > On Tue, 17 Oct 2017, Paul E. McKenney wrote: > > > On Tue, Oct 17, 2017 at 03:38:23PM -0400, Alan Stern wrote: > > > On Tue, 17 Oct 2017, Paul E. McKenney wrote: > > > > > > > How about this? > > > > > > > > 0. Simple special

Re: Linux-kernel examples for LKMM recipes

2017-10-17 Thread Paul E. McKenney
On Tue, Oct 17, 2017 at 05:03:01PM -0400, Alan Stern wrote: > On Tue, 17 Oct 2017, Paul E. McKenney wrote: > > > On Tue, Oct 17, 2017 at 03:38:23PM -0400, Alan Stern wrote: > > > On Tue, 17 Oct 2017, Paul E. McKenney wrote: > > > > > > > How about this? > > > > > > > > 0. Simple special

Re: Linux-kernel examples for LKMM recipes

2017-10-17 Thread Alan Stern
On Tue, 17 Oct 2017, Paul E. McKenney wrote: > On Tue, Oct 17, 2017 at 03:38:23PM -0400, Alan Stern wrote: > > On Tue, 17 Oct 2017, Paul E. McKenney wrote: > > > > > How about this? > > > > > > 0.Simple special cases > > > > > > If there is only one CPU on the one hand or only one

Re: Linux-kernel examples for LKMM recipes

2017-10-17 Thread Alan Stern
On Tue, 17 Oct 2017, Paul E. McKenney wrote: > On Tue, Oct 17, 2017 at 03:38:23PM -0400, Alan Stern wrote: > > On Tue, 17 Oct 2017, Paul E. McKenney wrote: > > > > > How about this? > > > > > > 0.Simple special cases > > > > > > If there is only one CPU on the one hand or only one

Re: Linux-kernel examples for LKMM recipes

2017-10-17 Thread Paul E. McKenney
On Thu, Oct 12, 2017 at 09:23:59AM +0800, Boqun Feng wrote: > On Wed, Oct 11, 2017 at 10:32:30PM +, Paul E. McKenney wrote: > > Hello! > > > > At Linux Plumbers Conference, we got requests for a recipes document, > > and a further request to point to actual code in the Linux kernel. > > I

Re: Linux-kernel examples for LKMM recipes

2017-10-17 Thread Paul E. McKenney
On Thu, Oct 12, 2017 at 09:23:59AM +0800, Boqun Feng wrote: > On Wed, Oct 11, 2017 at 10:32:30PM +, Paul E. McKenney wrote: > > Hello! > > > > At Linux Plumbers Conference, we got requests for a recipes document, > > and a further request to point to actual code in the Linux kernel. > > I

Re: Linux-kernel examples for LKMM recipes

2017-10-17 Thread Paul E. McKenney
On Thu, Oct 12, 2017 at 12:27:19PM +0100, Will Deacon wrote: > On Thu, Oct 12, 2017 at 09:23:59AM +0800, Boqun Feng wrote: > > On Wed, Oct 11, 2017 at 10:32:30PM +, Paul E. McKenney wrote: > > > I am not aware of any three-CPU release-acquire chains in the > > > Linux kernel. There are

Re: Linux-kernel examples for LKMM recipes

2017-10-17 Thread Paul E. McKenney
On Thu, Oct 12, 2017 at 12:27:19PM +0100, Will Deacon wrote: > On Thu, Oct 12, 2017 at 09:23:59AM +0800, Boqun Feng wrote: > > On Wed, Oct 11, 2017 at 10:32:30PM +, Paul E. McKenney wrote: > > > I am not aware of any three-CPU release-acquire chains in the > > > Linux kernel. There are

Re: Linux-kernel examples for LKMM recipes

2017-10-17 Thread Paul E. McKenney
On Tue, Oct 17, 2017 at 03:38:23PM -0400, Alan Stern wrote: > On Tue, 17 Oct 2017, Paul E. McKenney wrote: > > > How about this? > > > > 0. Simple special cases > > > > If there is only one CPU on the one hand or only one variable > > on the other, the code will execute in order.

Re: Linux-kernel examples for LKMM recipes

2017-10-17 Thread Paul E. McKenney
On Tue, Oct 17, 2017 at 03:38:23PM -0400, Alan Stern wrote: > On Tue, 17 Oct 2017, Paul E. McKenney wrote: > > > How about this? > > > > 0. Simple special cases > > > > If there is only one CPU on the one hand or only one variable > > on the other, the code will execute in order.

Re: Linux-kernel examples for LKMM recipes

2017-10-17 Thread Paul E. McKenney
On Thu, Oct 12, 2017 at 03:27:44PM +0200, Andrea Parri wrote: > Hi Paul, > > On Wed, Oct 11, 2017 at 03:32:30PM -0700, Paul E. McKenney wrote: > > Hello! > > > > At Linux Plumbers Conference, we got requests for a recipes document, > > and a further request to point to actual code in the Linux

Re: Linux-kernel examples for LKMM recipes

2017-10-17 Thread Paul E. McKenney
On Thu, Oct 12, 2017 at 03:27:44PM +0200, Andrea Parri wrote: > Hi Paul, > > On Wed, Oct 11, 2017 at 03:32:30PM -0700, Paul E. McKenney wrote: > > Hello! > > > > At Linux Plumbers Conference, we got requests for a recipes document, > > and a further request to point to actual code in the Linux

Re: Linux-kernel examples for LKMM recipes

2017-10-17 Thread Alan Stern
On Tue, 17 Oct 2017, Paul E. McKenney wrote: > How about this? > > 0.Simple special cases > > If there is only one CPU on the one hand or only one variable > on the other, the code will execute in order. There are (as > usual) some things to be careful of: > > a.

Re: Linux-kernel examples for LKMM recipes

2017-10-17 Thread Alan Stern
On Tue, 17 Oct 2017, Paul E. McKenney wrote: > How about this? > > 0.Simple special cases > > If there is only one CPU on the one hand or only one variable > on the other, the code will execute in order. There are (as > usual) some things to be careful of: > > a.

Re: Linux-kernel examples for LKMM recipes

2017-10-17 Thread Paul E. McKenney
On Fri, Oct 13, 2017 at 04:09:26PM -0400, Alan Stern wrote: > On Fri, 13 Oct 2017, Paul E. McKenney wrote: > > On Fri, Oct 13, 2017 at 03:44:07PM -0400, Alan Stern wrote: > > > On Wed, 11 Oct 2017, Paul E. McKenney wrote: [ . . . ] > > Perhaps the recipes document should just baldly state that

Re: Linux-kernel examples for LKMM recipes

2017-10-17 Thread Paul E. McKenney
On Fri, Oct 13, 2017 at 04:09:26PM -0400, Alan Stern wrote: > On Fri, 13 Oct 2017, Paul E. McKenney wrote: > > On Fri, Oct 13, 2017 at 03:44:07PM -0400, Alan Stern wrote: > > > On Wed, 11 Oct 2017, Paul E. McKenney wrote: [ . . . ] > > Perhaps the recipes document should just baldly state that

Re: Linux-kernel examples for LKMM recipes

2017-10-13 Thread Alan Stern
On Fri, 13 Oct 2017, Paul E. McKenney wrote: > On Fri, Oct 13, 2017 at 03:44:07PM -0400, Alan Stern wrote: > > On Wed, 11 Oct 2017, Paul E. McKenney wrote: > > > > > This document lists the litmus-test patterns that we have been discussing, > > > along with examples from the Linux kernel. This

Re: Linux-kernel examples for LKMM recipes

2017-10-13 Thread Alan Stern
On Fri, 13 Oct 2017, Paul E. McKenney wrote: > On Fri, Oct 13, 2017 at 03:44:07PM -0400, Alan Stern wrote: > > On Wed, 11 Oct 2017, Paul E. McKenney wrote: > > > > > This document lists the litmus-test patterns that we have been discussing, > > > along with examples from the Linux kernel. This

Re: Linux-kernel examples for LKMM recipes

2017-10-13 Thread Paul E. McKenney
On Fri, Oct 13, 2017 at 03:44:07PM -0400, Alan Stern wrote: > On Wed, 11 Oct 2017, Paul E. McKenney wrote: > > > This document lists the litmus-test patterns that we have been discussing, > > along with examples from the Linux kernel. This is intended to feed into > > the recipes document. All

Re: Linux-kernel examples for LKMM recipes

2017-10-13 Thread Paul E. McKenney
On Fri, Oct 13, 2017 at 03:44:07PM -0400, Alan Stern wrote: > On Wed, 11 Oct 2017, Paul E. McKenney wrote: > > > This document lists the litmus-test patterns that we have been discussing, > > along with examples from the Linux kernel. This is intended to feed into > > the recipes document. All

Re: Linux-kernel examples for LKMM recipes

2017-10-13 Thread Alan Stern
On Wed, 11 Oct 2017, Paul E. McKenney wrote: > This document lists the litmus-test patterns that we have been discussing, > along with examples from the Linux kernel. This is intended to feed into > the recipes document. All examples are from v4.13. > > 0.Single-variable SC. > > a.

Re: Linux-kernel examples for LKMM recipes

2017-10-13 Thread Alan Stern
On Wed, 11 Oct 2017, Paul E. McKenney wrote: > This document lists the litmus-test patterns that we have been discussing, > along with examples from the Linux kernel. This is intended to feed into > the recipes document. All examples are from v4.13. > > 0.Single-variable SC. > > a.

Re: Linux-kernel examples for LKMM recipes

2017-10-12 Thread Andrea Parri
Hi Paul, On Wed, Oct 11, 2017 at 03:32:30PM -0700, Paul E. McKenney wrote: > Hello! > > At Linux Plumbers Conference, we got requests for a recipes document, > and a further request to point to actual code in the Linux kernel. > I have pulled together some examples for various litmus-test

Re: Linux-kernel examples for LKMM recipes

2017-10-12 Thread Andrea Parri
Hi Paul, On Wed, Oct 11, 2017 at 03:32:30PM -0700, Paul E. McKenney wrote: > Hello! > > At Linux Plumbers Conference, we got requests for a recipes document, > and a further request to point to actual code in the Linux kernel. > I have pulled together some examples for various litmus-test

Re: Linux-kernel examples for LKMM recipes

2017-10-12 Thread Will Deacon
On Thu, Oct 12, 2017 at 09:23:59AM +0800, Boqun Feng wrote: > On Wed, Oct 11, 2017 at 10:32:30PM +, Paul E. McKenney wrote: > > I am not aware of any three-CPU release-acquire chains in the > > Linux kernel. There are three-CPU lock-based chains in RCU, > > but these are not at

Re: Linux-kernel examples for LKMM recipes

2017-10-12 Thread Will Deacon
On Thu, Oct 12, 2017 at 09:23:59AM +0800, Boqun Feng wrote: > On Wed, Oct 11, 2017 at 10:32:30PM +, Paul E. McKenney wrote: > > I am not aware of any three-CPU release-acquire chains in the > > Linux kernel. There are three-CPU lock-based chains in RCU, > > but these are not at

Re: Linux-kernel examples for LKMM recipes

2017-10-11 Thread Boqun Feng
On Wed, Oct 11, 2017 at 10:32:30PM +, Paul E. McKenney wrote: > Hello! > > At Linux Plumbers Conference, we got requests for a recipes document, > and a further request to point to actual code in the Linux kernel. > I have pulled together some examples for various litmus-test families, > as

Re: Linux-kernel examples for LKMM recipes

2017-10-11 Thread Boqun Feng
On Wed, Oct 11, 2017 at 10:32:30PM +, Paul E. McKenney wrote: > Hello! > > At Linux Plumbers Conference, we got requests for a recipes document, > and a further request to point to actual code in the Linux kernel. > I have pulled together some examples for various litmus-test families, > as

Linux-kernel examples for LKMM recipes

2017-10-11 Thread Paul E. McKenney
Hello! At Linux Plumbers Conference, we got requests for a recipes document, and a further request to point to actual code in the Linux kernel. I have pulled together some examples for various litmus-test families, as shown below. The decoder ring for the abbreviations (ISA2, LB, SB, MP, ...) is

Linux-kernel examples for LKMM recipes

2017-10-11 Thread Paul E. McKenney
Hello! At Linux Plumbers Conference, we got requests for a recipes document, and a further request to point to actual code in the Linux kernel. I have pulled together some examples for various litmus-test families, as shown below. The decoder ring for the abbreviations (ISA2, LB, SB, MP, ...) is