Re: [c++std-parallel-2008] Re: Compilers and RCU readers: Once more unto the breach!

2015-09-23 Thread Paul E. McKenney
On Wed, Sep 23, 2015 at 03:30:34PM -0700, Hans Boehm wrote: > I'd really like this to converge. It's great that it tries to focus on a > couple of alternatives. But I'm not sure they're the right ones. > > I kind of like the 7.9 approach of restricting dependency chain to those > case in which n

Re: Compilers and RCU readers: Once more unto the breach!

2015-09-22 Thread Paul E. McKenney
On Mon, Jul 13, 2015 at 05:44:59PM -0700, Paul E. McKenney wrote: > On Tue, May 19, 2015 at 05:55:10PM -0700, Paul E. McKenney wrote: > > Hello! > > > > Following up on last year's discussion (https://lwn.net/Articles/586838/, > > https://lwn.net/Articles/588300/), I believe that we have a solutio

Re: Compilers and RCU readers: Once more unto the breach!

2015-07-13 Thread Paul E. McKenney
On Tue, May 19, 2015 at 05:55:10PM -0700, Paul E. McKenney wrote: > Hello! > > Following up on last year's discussion (https://lwn.net/Articles/586838/, > https://lwn.net/Articles/588300/), I believe that we have a solution. If > I am wrong, I am sure you all will let me know, and in great detail

Re: [c++std-parallel-1651] Re: Compilers and RCU readers: Once more unto the breach!

2015-05-26 Thread Paul E. McKenney
On Tue, May 26, 2015 at 07:08:35PM +0200, Torvald Riegel wrote: > On Tue, 2015-05-19 at 17:55 -0700, Paul E. McKenney wrote: > > http://www.rdrop.com/users/paulmck/RCU/consume.2015.05.18a.pdf > > I have been discussing Section 7.9 with Paul during last week. > > While I think that 7.9 helps

Re: [c++std-parallel-1641] Re: Compilers and RCU readers: Once more unto the breach!

2015-05-26 Thread Torvald Riegel
On Thu, 2015-05-21 at 13:42 -0700, Linus Torvalds wrote: > On Thu, May 21, 2015 at 1:02 PM, Paul E. McKenney > wrote: > > > > The compiler can (and does) speculate non-atomic non-volatile writes > > in some cases, but I do not believe that it is permitted to speculate > > either volatile or atomic

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-22 Thread Paul E. McKenney
On Fri, May 22, 2015 at 06:30:29PM +0100, Will Deacon wrote: > Hi Paul, > > On Thu, May 21, 2015 at 09:02:12PM +0100, Paul E. McKenney wrote: > > On Thu, May 21, 2015 at 08:24:22PM +0100, Will Deacon wrote: > > > On Wed, May 20, 2015 at 07:16:06PM +0100, Paul E. McKenney wrote: > > > > On to #5: >

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-22 Thread Will Deacon
Hi Paul, On Thu, May 21, 2015 at 09:02:12PM +0100, Paul E. McKenney wrote: > On Thu, May 21, 2015 at 08:24:22PM +0100, Will Deacon wrote: > > On Wed, May 20, 2015 at 07:16:06PM +0100, Paul E. McKenney wrote: > > > On to #5: > > > > > > r1 = atomic_load_explicit(&x, memory_order_consume); > > >

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-22 Thread Paul E. McKenney
On Fri, May 22, 2015 at 08:43:44AM +0200, Ingo Molnar wrote: > > * Linus Torvalds wrote: > > > (a) the "official" rules are completely pointless, and make sense > > only because the standard is written for some random "abstract > > machine" that doesn't actually exist. > > Presuming the inte

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-22 Thread Paul E. McKenney
On Fri, May 22, 2015 at 06:43:32AM -0400, Richard Kenner wrote: > > (Assuming it's a goal of this standard to be human parseable to more > > than a few dozen people on the planet.) > > Unfortunately, that's rarely a goal of most standards. ;-) My experience does match Richard's, sad to say. The

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-22 Thread Richard Kenner
> (Assuming it's a goal of this standard to be human parseable to more > than a few dozen people on the planet.) Unfortunately, that's rarely a goal of most standards. ;-)

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-21 Thread Ingo Molnar
* Linus Torvalds wrote: > (a) the "official" rules are completely pointless, and make sense > only because the standard is written for some random "abstract > machine" that doesn't actually exist. Presuming the intent of the abstract machine specification is to avoid being seen as biased to

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-21 Thread Paul E. McKenney
On Thu, May 21, 2015 at 01:42:11PM -0700, Linus Torvalds wrote: > On Thu, May 21, 2015 at 1:02 PM, Paul E. McKenney > wrote: > > > > The compiler can (and does) speculate non-atomic non-volatile writes > > in some cases, but I do not believe that it is permitted to speculate > > either volatile or

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-21 Thread Linus Torvalds
On Thu, May 21, 2015 at 1:02 PM, Paul E. McKenney wrote: > > The compiler can (and does) speculate non-atomic non-volatile writes > in some cases, but I do not believe that it is permitted to speculate > either volatile or atomic writes. I do *not* believe that a compiler is ever allowed to specu

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-21 Thread Paul E. McKenney
On Thu, May 21, 2015 at 08:24:22PM +0100, Will Deacon wrote: > On Wed, May 20, 2015 at 07:16:06PM +0100, Paul E. McKenney wrote: > > On Wed, May 20, 2015 at 04:46:17PM +0100, Will Deacon wrote: > > > On Wed, May 20, 2015 at 01:15:22PM +0100, Paul E. McKenney wrote: > > > > Indeed, something like th

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-21 Thread Will Deacon
On Wed, May 20, 2015 at 07:16:06PM +0100, Paul E. McKenney wrote: > On Wed, May 20, 2015 at 04:46:17PM +0100, Will Deacon wrote: > > On Wed, May 20, 2015 at 01:15:22PM +0100, Paul E. McKenney wrote: > > > Indeed, something like this does -not- carry a dependency from the > > > memory_order_consume

Re: [c++std-parallel-1632] Re: Compilers and RCU readers: Once more unto the breach!

2015-05-21 Thread Paul E. McKenney
On Thu, May 21, 2015 at 06:17:43PM +0200, Michael Matz wrote: > Hi, > > On Thu, 21 May 2015, Paul E. McKenney wrote: > > > The point is -exactly- to codify the current state of affairs. > > Ah, I see, so it's not yet about creating a more useful (for compilers, > that is) model. There are seve

Re: [c++std-parallel-1632] Re: Compilers and RCU readers: Once more unto the breach!

2015-05-21 Thread Michael Matz
Hi, On Thu, 21 May 2015, Paul E. McKenney wrote: > The point is -exactly- to codify the current state of affairs. Ah, I see, so it's not yet about creating a more useful (for compilers, that is) model. > > char * fancy_assign (char *in) { return in; } > > ... > > char *x, *y; > > > >

Re: [c++std-parallel-1632] Re: Compilers and RCU readers: Once more unto the breach!

2015-05-21 Thread Paul E. McKenney
On Thu, May 21, 2015 at 04:22:38PM +0200, Michael Matz wrote: > Hi, > > On Wed, 20 May 2015, Paul E. McKenney wrote: > > > > > I'm not sure... you'd require the compiler to perform static analysis of > > > > loops to determine the state of the machine when they exit (if they > > > > exit!) > > >

Re: [c++std-parallel-1632] Re: Compilers and RCU readers: Once more unto the breach!

2015-05-21 Thread Michael Matz
Hi, On Wed, 20 May 2015, Paul E. McKenney wrote: > > > I'm not sure... you'd require the compiler to perform static analysis of > > > loops to determine the state of the machine when they exit (if they exit!) > > > in order to show whether or not a dependency is carried to subsequent > > > operat

Re: [c++std-parallel-1632] Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread Paul E. McKenney
On Wed, May 20, 2015 at 04:54:51PM +0100, Andrew Haley wrote: > On 05/20/2015 04:46 PM, Will Deacon wrote: > > I'm not sure... you'd require the compiler to perform static analysis of > > loops to determine the state of the machine when they exit (if they exit!) > > in order to show whether or not

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread Paul E. McKenney
On Wed, May 20, 2015 at 04:46:17PM +0100, Will Deacon wrote: > On Wed, May 20, 2015 at 01:15:22PM +0100, Paul E. McKenney wrote: > > On Wed, May 20, 2015 at 12:47:45PM +0100, Will Deacon wrote: > > > On Wed, May 20, 2015 at 03:41:48AM +0100, Paul E. McKenney wrote: > > > > If a pointer is p

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread Andrew Haley
On 05/20/2015 04:46 PM, Will Deacon wrote: > I'm not sure... you'd require the compiler to perform static analysis of > loops to determine the state of the machine when they exit (if they exit!) > in order to show whether or not a dependency is carried to subsequent > operations. If it can't prove

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread Will Deacon
On Wed, May 20, 2015 at 01:15:22PM +0100, Paul E. McKenney wrote: > On Wed, May 20, 2015 at 12:47:45PM +0100, Will Deacon wrote: > > On Wed, May 20, 2015 at 03:41:48AM +0100, Paul E. McKenney wrote: > > > If a pointer is part of a dependency chain, and if the values > > > added to or subtracted

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread David Howells
Paul E. McKenney wrote: > Ah, I was assuming between x and z. David, what was your intent? ;-) Clarification. David

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread Paul E. McKenney
On Wed, May 20, 2015 at 03:15:48PM +0100, Ramana Radhakrishnan wrote: > > > On 20/05/15 15:03, Paul E. McKenney wrote: > >On Wed, May 20, 2015 at 02:44:30PM +0100, Ramana Radhakrishnan wrote: > >> > >> > >>On 20/05/15 14:37, David Howells wrote: > >>>Paul E. McKenney wrote: > >>> > I was thi

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread Ramana Radhakrishnan
On 20/05/15 15:03, Paul E. McKenney wrote: On Wed, May 20, 2015 at 02:44:30PM +0100, Ramana Radhakrishnan wrote: On 20/05/15 14:37, David Howells wrote: Paul E. McKenney wrote: I was thinking of "y" as a simple variable, but if it is something more complex, then the compiler could do thi

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread Paul E. McKenney
On Wed, May 20, 2015 at 02:44:30PM +0100, Ramana Radhakrishnan wrote: > > > On 20/05/15 14:37, David Howells wrote: > >Paul E. McKenney wrote: > > > >>I was thinking of "y" as a simple variable, but if it is something more > >>complex, then the compiler could do this, right? > >> > >>char *x

Re: [c++std-parallel-1624] Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread Paul E. McKenney
On Wed, May 20, 2015 at 02:37:05PM +0100, David Howells wrote: > Paul E. McKenney wrote: > > > I was thinking of "y" as a simple variable, but if it is something more > > complex, then the compiler could do this, right? > > > > char *x; > > > > y; > > x = z; > > Yeah. I presume it

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread Ramana Radhakrishnan
On 20/05/15 14:37, David Howells wrote: Paul E. McKenney wrote: I was thinking of "y" as a simple variable, but if it is something more complex, then the compiler could do this, right? char *x; y; x = z; Yeah. I presume it has to maintain the ordering, though.

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread David Howells
Paul E. McKenney wrote: > I was thinking of "y" as a simple variable, but if it is something more > complex, then the compiler could do this, right? > > char *x; > > y; > x = z; Yeah. I presume it has to maintain the ordering, though. David

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread Paul E. McKenney
On Wed, May 20, 2015 at 02:18:37PM +0100, David Howells wrote: > Paul E. McKenney wrote: > > > > Additionally, what about the following code? > > > > > > char *x = y ? z : z; > > > > > > Does that extend a dependency chain from z to x? If so, I can imagine a > > > CPU breaking that in practic

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread David Howells
Paul E. McKenney wrote: > > Additionally, what about the following code? > > > > char *x = y ? z : z; > > > > Does that extend a dependency chain from z to x? If so, I can imagine a > > CPU breaking that in practice. > > I am not seeing this. I would expect the compiler to optimize to > som

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread Paul E. McKenney
On Wed, May 20, 2015 at 12:47:45PM +0100, Will Deacon wrote: > Hi Paul, > > On Wed, May 20, 2015 at 03:41:48AM +0100, Paul E. McKenney wrote: > > On Tue, May 19, 2015 at 07:10:12PM -0700, Linus Torvalds wrote: > > > On Tue, May 19, 2015 at 6:57 PM, Linus Torvalds > > > wrote: > > > So I think you

Re: [c++std-parallel-1614] Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread Paul E. McKenney
On Wed, May 20, 2015 at 11:03:00AM +0200, Richard Biener wrote: > On Wed, May 20, 2015 at 9:34 AM, Jens Maurer wrote: > > On 05/20/2015 04:34 AM, Paul E. McKenney wrote: > >> On Tue, May 19, 2015 at 06:57:02PM -0700, Linus Torvalds wrote: > > > >>> - the "you can add/subtract integral values" sti

Re: [c++std-parallel-1616] Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread Paul E. McKenney
On Wed, May 20, 2015 at 09:34:10AM +0200, Jens Maurer wrote: > On 05/20/2015 04:34 AM, Paul E. McKenney wrote: > > On Tue, May 19, 2015 at 06:57:02PM -0700, Linus Torvalds wrote: > > >> - the "you can add/subtract integral values" still opens you up to > >> language lawyers claiming "(char *)ptr

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread Will Deacon
Hi Paul, On Wed, May 20, 2015 at 03:41:48AM +0100, Paul E. McKenney wrote: > On Tue, May 19, 2015 at 07:10:12PM -0700, Linus Torvalds wrote: > > On Tue, May 19, 2015 at 6:57 PM, Linus Torvalds > > wrote: > > So I think you're better off just saying that operations designed to > > drop significant

Re: [c++std-parallel-1614] Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread Richard Biener
On Wed, May 20, 2015 at 9:34 AM, Jens Maurer wrote: > On 05/20/2015 04:34 AM, Paul E. McKenney wrote: >> On Tue, May 19, 2015 at 06:57:02PM -0700, Linus Torvalds wrote: > >>> - the "you can add/subtract integral values" still opens you up to >>> language lawyers claiming "(char *)ptr - (intptr_t)

Re: [c++std-parallel-1614] Re: Compilers and RCU readers: Once more unto the breach!

2015-05-20 Thread Jens Maurer
On 05/20/2015 04:34 AM, Paul E. McKenney wrote: > On Tue, May 19, 2015 at 06:57:02PM -0700, Linus Torvalds wrote: >> - the "you can add/subtract integral values" still opens you up to >> language lawyers claiming "(char *)ptr - (intptr_t)ptr" preserving the >> dependency, which it clearly doesn't

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-19 Thread Paul E. McKenney
On Tue, May 19, 2015 at 07:10:12PM -0700, Linus Torvalds wrote: > On Tue, May 19, 2015 at 6:57 PM, Linus Torvalds > wrote: > > > > - the "you can add/subtract integral values" still opens you up to > > language lawyers claiming "(char *)ptr - (intptr_t)ptr" preserving the > > dependency, which it

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-19 Thread Paul E. McKenney
On Tue, May 19, 2015 at 06:57:02PM -0700, Linus Torvalds wrote: > On Tue, May 19, 2015 at 5:55 PM, Paul E. McKenney > wrote: > > > > http://www.rdrop.com/users/paulmck/RCU/consume.2015.05.18a.pdf > > >From a very quick read-through, the restricted dependency chain in 7.9 > seems to be rea

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-19 Thread Linus Torvalds
On Tue, May 19, 2015 at 6:57 PM, Linus Torvalds wrote: > > - the "you can add/subtract integral values" still opens you up to > language lawyers claiming "(char *)ptr - (intptr_t)ptr" preserving the > dependency, which it clearly doesn't. But language-lawyering it does, > since all those operatio

Re: Compilers and RCU readers: Once more unto the breach!

2015-05-19 Thread Linus Torvalds
On Tue, May 19, 2015 at 5:55 PM, Paul E. McKenney wrote: > > http://www.rdrop.com/users/paulmck/RCU/consume.2015.05.18a.pdf >From a very quick read-through, the restricted dependency chain in 7.9 seems to be reasonable, and essentially covers "thats' what hardware gives us anyway", making