Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-07 Thread Paul E. McKenney
On Fri, Mar 07, 2014 at 07:33:25PM +0100, Torvald Riegel wrote: > On Wed, 2014-03-05 at 10:15 -0800, Paul E. McKenney wrote: > > On Wed, Mar 05, 2014 at 05:54:59PM +0100, Torvald Riegel wrote: > > > On Tue, 2014-03-04 at 13:35 -0800, Paul E. McKenney wrote: > > > > On Tue, Mar 04, 2014 at 11:00:32A

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-07 Thread Paul E. McKenney
On Fri, Mar 07, 2014 at 06:45:57PM +0100, Torvald Riegel wrote: > xagsmtp5.20140307174618.3...@vmsdvm6.vnet.ibm.com > X-Xagent-Gateway: vmsdvm6.vnet.ibm.com (XAGSMTP5 at VMSDVM6) > > On Wed, 2014-03-05 at 10:01 -0800, Paul E. McKenney wrote: > > On Wed, Mar 05, 2014 at 05:26:36PM +0100, Torvald Ri

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-07 Thread Torvald Riegel
On Wed, 2014-03-05 at 10:15 -0800, Paul E. McKenney wrote: > On Wed, Mar 05, 2014 at 05:54:59PM +0100, Torvald Riegel wrote: > > On Tue, 2014-03-04 at 13:35 -0800, Paul E. McKenney wrote: > > > On Tue, Mar 04, 2014 at 11:00:32AM -0800, Paul E. McKenney wrote: > > > > On Mon, Mar 03, 2014 at 09:46:1

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-07 Thread Torvald Riegel
On Wed, 2014-03-05 at 10:01 -0800, Paul E. McKenney wrote: > On Wed, Mar 05, 2014 at 05:26:36PM +0100, Torvald Riegel wrote: > > xagsmtp3.20140305162928.8...@uk1vsc.vnet.ibm.com > > X-Xagent-Gateway: uk1vsc.vnet.ibm.com (XAGSMTP3 at UK1VSC) > > > > On Tue, 2014-03-04 at 11:00 -0800, Paul E. McKenn

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-05 Thread Peter Sewell
On 5 March 2014 17:15, Torvald Riegel wrote: > On Tue, 2014-03-04 at 22:11 +, Peter Sewell wrote: >> On 3 March 2014 20:44, Torvald Riegel wrote: >> > On Sun, 2014-03-02 at 04:05 -0600, Peter Sewell wrote: >> >> On 1 March 2014 08:03, Paul E. McKenney >> >> wrote: >> >> > On Sat, Mar 01, 20

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-05 Thread Paul E. McKenney
On Wed, Mar 05, 2014 at 05:54:59PM +0100, Torvald Riegel wrote: > On Tue, 2014-03-04 at 13:35 -0800, Paul E. McKenney wrote: > > On Tue, Mar 04, 2014 at 11:00:32AM -0800, Paul E. McKenney wrote: > > > On Mon, Mar 03, 2014 at 09:46:19PM +0100, Torvald Riegel wrote: > > > > xagsmtp2.20140303204700.3.

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-05 Thread Paul E. McKenney
On Wed, Mar 05, 2014 at 05:26:36PM +0100, Torvald Riegel wrote: > xagsmtp3.20140305162928.8...@uk1vsc.vnet.ibm.com > X-Xagent-Gateway: uk1vsc.vnet.ibm.com (XAGSMTP3 at UK1VSC) > > On Tue, 2014-03-04 at 11:00 -0800, Paul E. McKenney wrote: > > On Mon, Mar 03, 2014 at 09:46:19PM +0100, Torvald Riege

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-05 Thread Torvald Riegel
On Tue, 2014-03-04 at 22:11 +, Peter Sewell wrote: > On 3 March 2014 20:44, Torvald Riegel wrote: > > On Sun, 2014-03-02 at 04:05 -0600, Peter Sewell wrote: > >> On 1 March 2014 08:03, Paul E. McKenney wrote: > >> > On Sat, Mar 01, 2014 at 04:06:34AM -0600, Peter Sewell wrote: > >> >> Hi Paul

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-05 Thread Torvald Riegel
On Tue, 2014-03-04 at 13:35 -0800, Paul E. McKenney wrote: > On Tue, Mar 04, 2014 at 11:00:32AM -0800, Paul E. McKenney wrote: > > On Mon, Mar 03, 2014 at 09:46:19PM +0100, Torvald Riegel wrote: > > > xagsmtp2.20140303204700.3...@vmsdvma.vnet.ibm.com > > > X-Xagent-Gateway: vmsdvma.vnet.ibm.com (XA

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-05 Thread Torvald Riegel
On Tue, 2014-03-04 at 11:00 -0800, Paul E. McKenney wrote: > On Mon, Mar 03, 2014 at 09:46:19PM +0100, Torvald Riegel wrote: > > xagsmtp2.20140303204700.3...@vmsdvma.vnet.ibm.com > > X-Xagent-Gateway: vmsdvma.vnet.ibm.com (XAGSMTP2 at VMSDVMA) > > > > On Mon, 2014-03-03 at 11:20 -0800, Paul E. McK

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-04 Thread Peter Sewell
On 3 March 2014 20:44, Torvald Riegel wrote: > On Sun, 2014-03-02 at 04:05 -0600, Peter Sewell wrote: >> On 1 March 2014 08:03, Paul E. McKenney wrote: >> > On Sat, Mar 01, 2014 at 04:06:34AM -0600, Peter Sewell wrote: >> >> Hi Paul, >> >> >> >> On 28 February 2014 18:50, Paul E. McKenney >> >>

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-04 Thread Paul E. McKenney
On Tue, Mar 04, 2014 at 11:00:32AM -0800, Paul E. McKenney wrote: > On Mon, Mar 03, 2014 at 09:46:19PM +0100, Torvald Riegel wrote: > > xagsmtp2.20140303204700.3...@vmsdvma.vnet.ibm.com > > X-Xagent-Gateway: vmsdvma.vnet.ibm.com (XAGSMTP2 at VMSDVMA) > > > > On Mon, 2014-03-03 at 11:20 -0800, Paul

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-04 Thread Paul E. McKenney
On Mon, Mar 03, 2014 at 09:46:19PM +0100, Torvald Riegel wrote: > xagsmtp2.20140303204700.3...@vmsdvma.vnet.ibm.com > X-Xagent-Gateway: vmsdvma.vnet.ibm.com (XAGSMTP2 at VMSDVMA) > > On Mon, 2014-03-03 at 11:20 -0800, Paul E. McKenney wrote: > > On Mon, Mar 03, 2014 at 07:55:08PM +0100, Torvald Ri

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-03 Thread Torvald Riegel
On Mon, 2014-03-03 at 11:20 -0800, Paul E. McKenney wrote: > On Mon, Mar 03, 2014 at 07:55:08PM +0100, Torvald Riegel wrote: > > xagsmtp2.20140303190831.9...@uk1vsc.vnet.ibm.com > > X-Xagent-Gateway: uk1vsc.vnet.ibm.com (XAGSMTP2 at UK1VSC) > > > > On Fri, 2014-02-28 at 16:50 -0800, Paul E. McKenn

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-03 Thread Torvald Riegel
On Sun, 2014-03-02 at 04:05 -0600, Peter Sewell wrote: > On 1 March 2014 08:03, Paul E. McKenney wrote: > > On Sat, Mar 01, 2014 at 04:06:34AM -0600, Peter Sewell wrote: > >> Hi Paul, > >> > >> On 28 February 2014 18:50, Paul E. McKenney > >> wrote: > >> > On Thu, Feb 27, 2014 at 12:53:12PM -080

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-03 Thread Paul E. McKenney
On Mon, Mar 03, 2014 at 07:55:08PM +0100, Torvald Riegel wrote: > xagsmtp2.20140303190831.9...@uk1vsc.vnet.ibm.com > X-Xagent-Gateway: uk1vsc.vnet.ibm.com (XAGSMTP2 at UK1VSC) > > On Fri, 2014-02-28 at 16:50 -0800, Paul E. McKenney wrote: > > +o Do not use the results from the boolean "&&" and "|

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-03 Thread Torvald Riegel
On Fri, 2014-02-28 at 16:50 -0800, Paul E. McKenney wrote: > +oDo not use the results from the boolean "&&" and "||" when > + dereferencing. For example, the following (rather improbable) > + code is buggy: > + > + int a[2]; > + int index; > + int fo

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-03 Thread Torvald Riegel
On Thu, 2014-02-27 at 09:50 -0800, Paul E. McKenney wrote: > Your proposal looks quite promising at first glance. But rather than > try and comment on it immediately, I am going to take a number of uses of > RCU from the Linux kernel and apply your proposal to them, then respond > with the results

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-03 Thread Torvald Riegel
On Thu, 2014-02-27 at 11:47 -0800, Linus Torvalds wrote: > On Thu, Feb 27, 2014 at 11:06 AM, Paul E. McKenney > wrote: > > > > 3. The comparison was against another RCU-protected pointer, > > where that other pointer was properly fetched using one > > of the RCU primitives. H

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-03 Thread Torvald Riegel
On Thu, 2014-02-27 at 09:01 -0800, Linus Torvalds wrote: > On Thu, Feb 27, 2014 at 7:37 AM, Torvald Riegel wrote: > > Regarding the latter, we make a fresh start at each mo_consume load (ie, > > we assume we know nothing -- L could have returned any possible value); > > I believe this is easier to

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-02 Thread Paul E. McKenney
On Sun, Mar 02, 2014 at 11:44:52PM +, Peter Sewell wrote: > On 2 March 2014 23:20, Paul E. McKenney wrote: > > On Sun, Mar 02, 2014 at 04:05:52AM -0600, Peter Sewell wrote: > >> On 1 March 2014 08:03, Paul E. McKenney wrote: > >> > On Sat, Mar 01, 2014 at 04:06:34AM -0600, Peter Sewell wrote:

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-02 Thread Peter Sewell
On 2 March 2014 23:20, Paul E. McKenney wrote: > On Sun, Mar 02, 2014 at 04:05:52AM -0600, Peter Sewell wrote: >> On 1 March 2014 08:03, Paul E. McKenney wrote: >> > On Sat, Mar 01, 2014 at 04:06:34AM -0600, Peter Sewell wrote: >> >> Hi Paul, >> >> >> >> On 28 February 2014 18:50, Paul E. McKenne

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-02 Thread Paul E. McKenney
On Sun, Mar 02, 2014 at 04:05:52AM -0600, Peter Sewell wrote: > On 1 March 2014 08:03, Paul E. McKenney wrote: > > On Sat, Mar 01, 2014 at 04:06:34AM -0600, Peter Sewell wrote: > >> Hi Paul, > >> > >> On 28 February 2014 18:50, Paul E. McKenney > >> wrote: > >> > On Thu, Feb 27, 2014 at 12:53:12

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-02 Thread Peter Sewell
On 1 March 2014 08:03, Paul E. McKenney wrote: > On Sat, Mar 01, 2014 at 04:06:34AM -0600, Peter Sewell wrote: >> Hi Paul, >> >> On 28 February 2014 18:50, Paul E. McKenney >> wrote: >> > On Thu, Feb 27, 2014 at 12:53:12PM -0800, Paul E. McKenney wrote: >> >> On Thu, Feb 27, 2014 at 11:47:08AM -

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-01 Thread Paul E. McKenney
On Sat, Mar 01, 2014 at 04:06:34AM -0600, Peter Sewell wrote: > Hi Paul, > > On 28 February 2014 18:50, Paul E. McKenney > wrote: > > On Thu, Feb 27, 2014 at 12:53:12PM -0800, Paul E. McKenney wrote: > >> On Thu, Feb 27, 2014 at 11:47:08AM -0800, Linus Torvalds wrote: > >> > On Thu, Feb 27, 2014

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-03-01 Thread Peter Sewell
Hi Paul, On 28 February 2014 18:50, Paul E. McKenney wrote: > On Thu, Feb 27, 2014 at 12:53:12PM -0800, Paul E. McKenney wrote: >> On Thu, Feb 27, 2014 at 11:47:08AM -0800, Linus Torvalds wrote: >> > On Thu, Feb 27, 2014 at 11:06 AM, Paul E. McKenney >> > wrote: >> > > >> > > 3. The compari

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-28 Thread Paul E. McKenney
On Thu, Feb 27, 2014 at 12:53:12PM -0800, Paul E. McKenney wrote: > On Thu, Feb 27, 2014 at 11:47:08AM -0800, Linus Torvalds wrote: > > On Thu, Feb 27, 2014 at 11:06 AM, Paul E. McKenney > > wrote: > > > > > > 3. The comparison was against another RCU-protected pointer, > > > where th

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-27 Thread Paul E. McKenney
On Thu, Feb 27, 2014 at 09:50:21AM -0800, Paul E. McKenney wrote: > On Thu, Feb 27, 2014 at 04:37:33PM +0100, Torvald Riegel wrote: > > xagsmtp2.20140227154925.3...@vmsdvm9.vnet.ibm.com > > > > On Mon, 2014-02-24 at 11:54 -0800, Linus Torvalds wrote: > > > On Mon, Feb 24, 2014 at 10:53 AM, Paul E.

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-27 Thread Paul E. McKenney
On Thu, Feb 27, 2014 at 11:47:08AM -0800, Linus Torvalds wrote: > On Thu, Feb 27, 2014 at 11:06 AM, Paul E. McKenney > wrote: > > > > 3. The comparison was against another RCU-protected pointer, > > where that other pointer was properly fetched using one > > of the RCU primiti

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-27 Thread Linus Torvalds
On Thu, Feb 27, 2014 at 11:06 AM, Paul E. McKenney wrote: > > 3. The comparison was against another RCU-protected pointer, > where that other pointer was properly fetched using one > of the RCU primitives. Here it doesn't matter which pointer > you use. At least as l

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-27 Thread Paul E. McKenney
On Thu, Feb 27, 2014 at 09:50:21AM -0800, Paul E. McKenney wrote: > On Thu, Feb 27, 2014 at 04:37:33PM +0100, Torvald Riegel wrote: > > xagsmtp2.20140227154925.3...@vmsdvm9.vnet.ibm.com > > > > On Mon, 2014-02-24 at 11:54 -0800, Linus Torvalds wrote: > > > On Mon, Feb 24, 2014 at 10:53 AM, Paul E.

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-27 Thread Paul E. McKenney
On Thu, Feb 27, 2014 at 09:01:40AM -0800, Linus Torvalds wrote: > On Thu, Feb 27, 2014 at 7:37 AM, Torvald Riegel wrote: > > > > I agree that just considering syntactic properties of the program seems > > to be insufficient. Making it instead depend on whether there is a > > "semantic" dependency

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-27 Thread Paul E. McKenney
On Thu, Feb 27, 2014 at 04:37:33PM +0100, Torvald Riegel wrote: > xagsmtp2.20140227154925.3...@vmsdvm9.vnet.ibm.com > > On Mon, 2014-02-24 at 11:54 -0800, Linus Torvalds wrote: > > On Mon, Feb 24, 2014 at 10:53 AM, Paul E. McKenney > > wrote: > > > > > > Good points. How about the following repl

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-27 Thread Linus Torvalds
On Thu, Feb 27, 2014 at 7:37 AM, Torvald Riegel wrote: > > I agree that just considering syntactic properties of the program seems > to be insufficient. Making it instead depend on whether there is a > "semantic" dependency due to a value being "necessary" to compute a > result seems better. How

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-27 Thread Torvald Riegel
On Mon, 2014-02-24 at 11:54 -0800, Linus Torvalds wrote: > On Mon, Feb 24, 2014 at 10:53 AM, Paul E. McKenney > wrote: > > > > Good points. How about the following replacements? > > > > 3. Adding or subtracting an integer to/from a chained pointer > > results in another chained point

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-26 Thread Torvald Riegel
On Wed, 2014-02-26 at 18:43 +, Joseph S. Myers wrote: > On Wed, 26 Feb 2014, Torvald Riegel wrote: > > > On Fri, 2014-02-21 at 22:10 +, Joseph S. Myers wrote: > > > On Fri, 21 Feb 2014, Paul E. McKenney wrote: > > > > > > > This needs to be as follows: > > > > > > > > [[carries_dependenc

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-26 Thread Joseph S. Myers
On Wed, 26 Feb 2014, Torvald Riegel wrote: > On Fri, 2014-02-21 at 22:10 +, Joseph S. Myers wrote: > > On Fri, 21 Feb 2014, Paul E. McKenney wrote: > > > > > This needs to be as follows: > > > > > > [[carries_dependency]] int getzero(int i [[carries_dependency]]) > > > { > > > return i - i

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-26 Thread Paul E. McKenney
On Wed, Feb 26, 2014 at 02:04:30PM +0100, Torvald Riegel wrote: > xagsmtp2.20140226130517.3...@vmsdvma.vnet.ibm.com > X-Xagent-Gateway: vmsdvma.vnet.ibm.com (XAGSMTP2 at VMSDVMA) > > On Fri, 2014-02-21 at 11:13 -0800, Paul E. McKenney wrote: > > On Fri, Feb 21, 2014 at 07:35:37PM +0100, Michael Ma

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-26 Thread Torvald Riegel
On Mon, 2014-02-24 at 09:28 -0800, Paul E. McKenney wrote: > On Mon, Feb 24, 2014 at 05:55:50PM +0100, Michael Matz wrote: > > Hi, > > > > On Mon, 24 Feb 2014, Linus Torvalds wrote: > > > > > > To me that reads like > > > > > > > > int i; > > > > int *q = &i; > > > > int **p = &q; > > > > >

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-26 Thread Torvald Riegel
On Mon, 2014-02-24 at 09:38 -0800, Linus Torvalds wrote: > On Mon, Feb 24, 2014 at 8:55 AM, Michael Matz wrote: > > > > So, let me try to poke holes into your definition or increase my > > understanding :) . You said "chain of pointers"(dereferences I assume), > > e.g. if p is result of consume l

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-26 Thread Torvald Riegel
On Fri, 2014-02-21 at 22:10 +, Joseph S. Myers wrote: > On Fri, 21 Feb 2014, Paul E. McKenney wrote: > > > This needs to be as follows: > > > > [[carries_dependency]] int getzero(int i [[carries_dependency]]) > > { > > return i - i; > > } > > > > Otherwise dependencies won't get carried

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-26 Thread Torvald Riegel
On Fri, 2014-02-21 at 11:13 -0800, Paul E. McKenney wrote: > On Fri, Feb 21, 2014 at 07:35:37PM +0100, Michael Matz wrote: > > Hi, > > > > On Thu, 20 Feb 2014, Linus Torvalds wrote: > > > > > But I'm pretty sure that any compiler guy must *hate* that current odd > > > dependency-generation part,

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-25 Thread Paul E. McKenney
On Tue, Feb 25, 2014 at 08:32:38PM -0700, Jeff Law wrote: > On 02/25/14 17:15, Paul E. McKenney wrote: > >>I have for the last several years been 100% convinced that the Intel > >>memory ordering is the right thing, and that people who like weak > >>memory ordering are wrong and should try to avoid

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-25 Thread Paul E. McKenney
On Tue, Feb 25, 2014 at 10:06:53PM -0500, George Spelvin wrote: > wrote: > > wrote: > >> I have for the last several years been 100% convinced that the Intel > >> memory ordering is the right thing, and that people who like weak > >> memory ordering are wrong and should try to avoid reproducing i

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-25 Thread Paul E. McKenney
On Tue, Feb 25, 2014 at 05:47:03PM -0800, Linus Torvalds wrote: > On Mon, Feb 24, 2014 at 10:00 PM, Paul E. McKenney > wrote: > > > > So let me see if I understand your reasoning. My best guess is that it > > goes something like this: > > > > 1. The Linux kernel contains code that passes poi

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-25 Thread Jeff Law
On 02/25/14 17:15, Paul E. McKenney wrote: I have for the last several years been 100% convinced that the Intel memory ordering is the right thing, and that people who like weak memory ordering are wrong and should try to avoid reproducing if at all possible. But given that we have memory orderin

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-25 Thread George Spelvin
wrote: > wrote: >> I have for the last several years been 100% convinced that the Intel >> memory ordering is the right thing, and that people who like weak >> memory ordering are wrong and should try to avoid reproducing if at >> all possible. > > Are ARM and Power really the bad boys here? Or

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-25 Thread Linus Torvalds
On Mon, Feb 24, 2014 at 10:00 PM, Paul E. McKenney wrote: > > So let me see if I understand your reasoning. My best guess is that it > goes something like this: > > 1. The Linux kernel contains code that passes pointers from > rcu_dereference() through external functions. No, actual

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-25 Thread Paul E. McKenney
On Mon, Feb 24, 2014 at 10:05:52PM -0800, Linus Torvalds wrote: > On Mon, Feb 24, 2014 at 3:35 PM, Linus Torvalds > wrote: > > > > Litmus test 1: > > > > p = atomic_read(pp, consume); > > if (p == &variable) > > return p->val; > > > >is *NOT* ordered > > Btw, don't get me wron

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Linus Torvalds
On Mon, Feb 24, 2014 at 3:35 PM, Linus Torvalds wrote: > > Litmus test 1: > > p = atomic_read(pp, consume); > if (p == &variable) > return p->val; > >is *NOT* ordered Btw, don't get me wrong. I don't _like_ it not being ordered, and I actually did spend some time thinking abou

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Paul E. McKenney
On Mon, Feb 24, 2014 at 03:35:04PM -0800, Linus Torvalds wrote: > On Mon, Feb 24, 2014 at 2:37 PM, Paul E. McKenney > wrote: > >> > >> What if the "nothing modifies 'p'" part looks like this: > >> > >> if (p != &myvariable) > >> return; > >> > >> and now any sane compiler will happily

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Linus Torvalds
On Mon, Feb 24, 2014 at 2:37 PM, Paul E. McKenney wrote: >> >> What if the "nothing modifies 'p'" part looks like this: >> >> if (p != &myvariable) >> return; >> >> and now any sane compiler will happily optimize "q = *p" into "q = >> myvariable", and we're all done - nothing invalid w

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Paul E. McKenney
On Mon, Feb 24, 2014 at 11:54:46AM -0800, Linus Torvalds wrote: > On Mon, Feb 24, 2014 at 10:53 AM, Paul E. McKenney > wrote: > > > > Good points. How about the following replacements? > > > > 3. Adding or subtracting an integer to/from a chained pointer > > results in another chaine

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Linus Torvalds
On Mon, Feb 24, 2014 at 10:53 AM, Paul E. McKenney wrote: > > Good points. How about the following replacements? > > 3. Adding or subtracting an integer to/from a chained pointer > results in another chained pointer in that same pointer chain. > The results of addition and su

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Paul E. McKenney
On Mon, Feb 24, 2014 at 10:14:01AM -0800, Linus Torvalds wrote: > On Mon, Feb 24, 2014 at 9:21 AM, Paul E. McKenney > wrote: > > > > 4. Bitwise operators ("&", "|", "^", and I suppose also "~") > > applied to a chained pointer and an integer results in another > > chained poin

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Linus Torvalds
On Mon, Feb 24, 2014 at 9:21 AM, Paul E. McKenney wrote: > > 4. Bitwise operators ("&", "|", "^", and I suppose also "~") > applied to a chained pointer and an integer results in another > chained pointer in that same pointer chain. No. You cannot define it this way. Taking t

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Paul E. McKenney
On Mon, Feb 24, 2014 at 09:38:46AM -0800, Linus Torvalds wrote: > On Mon, Feb 24, 2014 at 8:55 AM, Michael Matz wrote: > > > > So, let me try to poke holes into your definition or increase my > > understanding :) . You said "chain of pointers"(dereferences I assume), > > e.g. if p is result of co

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Paul E. McKenney
On Mon, Feb 24, 2014 at 09:28:56AM -0800, Paul E. McKenney wrote: > On Mon, Feb 24, 2014 at 05:55:50PM +0100, Michael Matz wrote: > > Hi, > > > > On Mon, 24 Feb 2014, Linus Torvalds wrote: > > > > > > To me that reads like > > > > > > > > int i; > > > > int *q = &i; > > > > int **p = &q; >

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Paul E. McKenney
On Mon, Feb 24, 2014 at 02:55:07PM +0100, Michael Matz wrote: > Hi, > > On Fri, 21 Feb 2014, Paul E. McKenney wrote: > > > > And with conservative I mean "everything is a source of a dependency, and > > > hence can't be removed, reordered or otherwise fiddled with", and that > > > includes code

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Linus Torvalds
On Mon, Feb 24, 2014 at 8:55 AM, Michael Matz wrote: > > So, let me try to poke holes into your definition or increase my > understanding :) . You said "chain of pointers"(dereferences I assume), > e.g. if p is result of consume load, then access to > p->here->there->next->prev->stuff is supposed

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Paul E. McKenney
On Mon, Feb 24, 2014 at 05:55:50PM +0100, Michael Matz wrote: > Hi, > > On Mon, 24 Feb 2014, Linus Torvalds wrote: > > > > To me that reads like > > > > > > int i; > > > int *q = &i; > > > int **p = &q; > > > > > > atomic_XXX (p, CONSUME); > > > > > > orders against accesses '*p', '**p',

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Paul E. McKenney
On Mon, Feb 24, 2014 at 07:57:24AM -0800, Linus Torvalds wrote: > On Sun, Feb 23, 2014 at 11:31 AM, Linus Torvalds > wrote: > > > > Let me think about it some more, but my gut feel is that just tweaking > > the definition of what "ordered" means is sufficient. > > > > So to go back to the suggeste

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Michael Matz
Hi, On Mon, 24 Feb 2014, Linus Torvalds wrote: > > To me that reads like > > > > int i; > > int *q = &i; > > int **p = &q; > > > > atomic_XXX (p, CONSUME); > > > > orders against accesses '*p', '**p', '*q' and 'i'. Thus it seems they > > want to say that it orders against aliased storage

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Linus Torvalds
On Mon, Feb 24, 2014 at 8:37 AM, Linus Torvalds wrote: > > So yes, the atomic_read() would be ordered wrt '*ptr' (getting 'q') > _and_ '**ptr' (getting 'i'), but nothing else - including just the > aliasing access of dereferencing 'i' directly. Btw, what CPU architects and memory ordering guys te

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Linus Torvalds
On Mon, Feb 24, 2014 at 8:27 AM, Richard Biener wrote: > > To me that reads like > > int i; > int *q = &i; > int **p = &q; > > atomic_XXX (p, CONSUME); > > orders against accesses '*p', '**p', '*q' and 'i'. Thus it seems they > want to say that it orders against aliased storage - but then

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Richard Biener
On Mon, Feb 24, 2014 at 4:57 PM, Linus Torvalds wrote: > On Sun, Feb 23, 2014 at 11:31 AM, Linus Torvalds > wrote: >> >> Let me think about it some more, but my gut feel is that just tweaking >> the definition of what "ordered" means is sufficient. >> >> So to go back to the suggested ordering ru

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Linus Torvalds
On Sun, Feb 23, 2014 at 11:31 AM, Linus Torvalds wrote: > > Let me think about it some more, but my gut feel is that just tweaking > the definition of what "ordered" means is sufficient. > > So to go back to the suggested ordering rules (ignoring the "restrict" > part, which is just to clarify tha

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-24 Thread Michael Matz
Hi, On Fri, 21 Feb 2014, Paul E. McKenney wrote: > > And with conservative I mean "everything is a source of a dependency, and > > hence can't be removed, reordered or otherwise fiddled with", and that > > includes code sequences where no atomic objects are anywhere in sight [1]. > > In the lig

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-23 Thread Linus Torvalds
On Sun, Feb 23, 2014 at 8:59 PM, Paul E. McKenney wrote: > On Sun, Feb 23, 2014 at 05:35:28PM -0800, Linus Torvalds wrote: >> >> But "q = p->next" is ordered by how something can alias "p->next", not by >> 'q'! >> >> There is no need to restrict anything but 'p' for all of this to work. > > I can

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-23 Thread Paul E. McKenney
On Sun, Feb 23, 2014 at 05:35:28PM -0800, Linus Torvalds wrote: > On Sun, Feb 23, 2014 at 5:16 PM, Paul E. McKenney > wrote: > >> > >> (a) we've said 'q' is restricted, so there is no aliasing between q > >> and the pointers b/c. So the compiler is free to move those accesses > >> around the "q =

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-23 Thread Linus Torvalds
On Sun, Feb 23, 2014 at 5:16 PM, Paul E. McKenney wrote: >> >> (a) we've said 'q' is restricted, so there is no aliasing between q >> and the pointers b/c. So the compiler is free to move those accesses >> around the "q = p->next" access. > > Ah, if I understand you, very good! > > My example int

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-23 Thread Paul E. McKenney
On Sun, Feb 23, 2014 at 11:31:25AM -0800, Linus Torvalds wrote: > On Sat, Feb 22, 2014 at 10:34 PM, Paul E. McKenney > wrote: > > > > Adding and subtracting integers to/from a RCU-protected pointer makes > > sense to me. > > Ack. And that's normal "access to an object" behavior anyway. And cover

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-23 Thread Linus Torvalds
On Sat, Feb 22, 2014 at 10:34 PM, Paul E. McKenney wrote: > > Adding and subtracting integers to/from a RCU-protected pointer makes > sense to me. Ack. And that's normal "access to an object" behavior anyway. > Adding and subtracting integers to/from an RCU-protected integer makes > sense in man

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-22 Thread Paul E. McKenney
On Sat, Feb 22, 2014 at 07:50:35PM -0800, Linus Torvalds wrote: > On Sat, Feb 22, 2014 at 4:39 PM, Paul E. McKenney > wrote: > > > > Agreed, by far the most frequent use is "->" to dereference and assignment > > to store into a local variable. The other operations where the kernel > > expects ord

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-22 Thread Linus Torvalds
On Sat, Feb 22, 2014 at 4:39 PM, Paul E. McKenney wrote: > > Agreed, by far the most frequent use is "->" to dereference and assignment > to store into a local variable. The other operations where the kernel > expects ordering to be maintained are: > > o Bitwise "&" to strip off low-order b

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-22 Thread Paul E. McKenney
On Sat, Feb 22, 2014 at 01:53:30PM -0800, Linus Torvalds wrote: > On Sat, Feb 22, 2014 at 10:53 AM, Torvald Riegel wrote: > > > > Stating that (1) "the standard is wrong" and (2) that you think that > > mo_consume semantics are not good is two different things. > > I do agree. They are two indepe

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-22 Thread Linus Torvalds
On Sat, Feb 22, 2014 at 10:53 AM, Torvald Riegel wrote: > > Stating that (1) "the standard is wrong" and (2) that you think that > mo_consume semantics are not good is two different things. I do agree. They are two independent things. I think the standard is wrong, because it's overly complex, h

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-22 Thread Paul E. McKenney
On Sat, Feb 22, 2014 at 07:30:37PM +0100, Torvald Riegel wrote: > xagsmtp2.20140222183231.5...@emeavsc.vnet.ibm.com > X-Xagent-Gateway: emeavsc.vnet.ibm.com (XAGSMTP2 at EMEAVSC) > > On Thu, 2014-02-20 at 10:18 -0800, Paul E. McKenney wrote: > > On Thu, Feb 20, 2014 at 06:26:08PM +0100, Torvald Ri

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-22 Thread Torvald Riegel
On Thu, 2014-02-20 at 11:09 -0800, Linus Torvalds wrote: > On Thu, Feb 20, 2014 at 10:53 AM, Torvald Riegel wrote: > > On Thu, 2014-02-20 at 10:32 -0800, Linus Torvalds wrote: > >> On Thu, Feb 20, 2014 at 10:11 AM, Paul E. McKenney > >> wrote: > >> > > >> > You really need that "consume" to be "a

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-22 Thread Torvald Riegel
On Thu, 2014-02-20 at 10:18 -0800, Paul E. McKenney wrote: > On Thu, Feb 20, 2014 at 06:26:08PM +0100, Torvald Riegel wrote: > > xagsmtp2.20140220172700.0...@vmsdvm4.vnet.ibm.com > > X-Xagent-Gateway: vmsdvm4.vnet.ibm.com (XAGSMTP2 at VMSDVM4) > > > > On Wed, 2014-02-19 at 20:01 -0800, Paul E. McK

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-21 Thread Paul E. McKenney
On Fri, Feb 21, 2014 at 10:10:54PM +, Joseph S. Myers wrote: > On Fri, 21 Feb 2014, Paul E. McKenney wrote: > > > This needs to be as follows: > > > > [[carries_dependency]] int getzero(int i [[carries_dependency]]) > > { > > return i - i; > > } > > > > Otherwise dependencies won't get c

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-21 Thread Joseph S. Myers
On Fri, 21 Feb 2014, Paul E. McKenney wrote: > This needs to be as follows: > > [[carries_dependency]] int getzero(int i [[carries_dependency]]) > { > return i - i; > } > > Otherwise dependencies won't get carried through it. C11 doesn't have attributes at all (and no specification regard

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-21 Thread Linus Torvalds
On Fri, Feb 21, 2014 at 11:43 AM, Peter Sewell wrote: > > You have to track dependencies through other assignments, e.g. simple x=y That is all visible in the SSA form. Variable assignment has been converted to some use of the SSA node that generated the value. The use might be a phi node or a ca

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-21 Thread Peter Sewell
On 21 February 2014 19:41, Linus Torvalds wrote: > On Fri, Feb 21, 2014 at 11:16 AM, Linus Torvalds > wrote: >> >> Why would this be any different, especially since it's easy to >> understand both for a human and a compiler? > > Btw, the actual data path may actually be semantically meaningful ev

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-21 Thread Linus Torvalds
On Fri, Feb 21, 2014 at 11:16 AM, Linus Torvalds wrote: > > Why would this be any different, especially since it's easy to > understand both for a human and a compiler? Btw, the actual data path may actually be semantically meaningful even at a processor level. For example, let's look at that gc

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-21 Thread Paul E. McKenney
On Fri, Feb 21, 2014 at 06:28:05PM +, Peter Sewell wrote: > On 20 February 2014 17:01, Linus Torvalds >wrote: [ . . . ] > > > So, if you make one of two changes to your example, then I will agree > > > with you. > > > > No. We're not playing games here. I'm fed up with complex examples > > t

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-21 Thread Linus Torvalds
On Fri, Feb 21, 2014 at 10:25 AM, Peter Sewell wrote: > > If one thinks this is too fragile, then simply using memory_order_acquire > and paying the resulting barrier cost (and perhaps hoping that compilers > will eventually be able to optimise some cases of those barriers to > hardware-level depe

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-21 Thread Paul E. McKenney
On Fri, Feb 21, 2014 at 07:35:37PM +0100, Michael Matz wrote: > Hi, > > On Thu, 20 Feb 2014, Linus Torvalds wrote: > > > But I'm pretty sure that any compiler guy must *hate* that current odd > > dependency-generation part, and if I was a gcc person, seeing that > > bugzilla entry Torvald pointed

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-21 Thread Michael Matz
Hi, On Thu, 20 Feb 2014, Linus Torvalds wrote: > But I'm pretty sure that any compiler guy must *hate* that current odd > dependency-generation part, and if I was a gcc person, seeing that > bugzilla entry Torvald pointed at, I would personally want to > dismember somebody with a rusty spoon.. Y

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-20 Thread Linus Torvalds
On Thu, Feb 20, 2014 at 2:10 PM, Paul E. McKenney wrote: > > Linus, given that you are calling me out for pushing "legalistic and bad" > things, "syntactic bullshit", and playing "little games", I am forced > to conclude that you have never attended any sort of standards-committee > meeting. ;-)

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-20 Thread Paul E. McKenney
On Thu, Feb 20, 2014 at 11:45:29AM -0800, Linus Torvalds wrote: > On Thu, Feb 20, 2014 at 10:56 AM, Paul E. McKenney > wrote: > > > > The example gcc breakage was something like this: > > > > i = atomic_load(idx, memory_order_consume); > > x = array[0 + i - i]; > > > > Then gcc opt

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-20 Thread Linus Torvalds
On Thu, Feb 20, 2014 at 10:56 AM, Paul E. McKenney wrote: > > The example gcc breakage was something like this: > > i = atomic_load(idx, memory_order_consume); > x = array[0 + i - i]; > > Then gcc optimized this to: > > i = atomic_load(idx, memory_order_consume); >

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-20 Thread Linus Torvalds
On Thu, Feb 20, 2014 at 10:53 AM, Torvald Riegel wrote: > On Thu, 2014-02-20 at 10:32 -0800, Linus Torvalds wrote: >> On Thu, Feb 20, 2014 at 10:11 AM, Paul E. McKenney >> wrote: >> > >> > You really need that "consume" to be "acquire". >> >> So I think we now all agree that that is what the stan

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-20 Thread Linus Torvalds
On Thu, Feb 20, 2014 at 11:02 AM, Linus Torvalds wrote: > > Again, the way I'd expect a compiler writer to actually *do* this is > to just default to "ac Oops, pressed send by mistake too early. I was almost done: I'd expect a compiler to just default to "acquire" semantics, but then have a few

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-20 Thread Linus Torvalds
On Thu, Feb 20, 2014 at 10:25 AM, Linus Torvalds wrote: > > While in my *sane* model, where you can consume things even if they > then result in control dependencies, there will still eventually be a > "sync" instruction on powerpc (because you really need one between the > load of 'initialized' a

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-20 Thread Paul E. McKenney
On Thu, Feb 20, 2014 at 07:44:32PM +0100, Torvald Riegel wrote: > xagsmtp3.20140220184514.1...@bldgate.vnet.ibm.com > X-Xagent-Gateway: bldgate.vnet.ibm.com (XAGSMTP3 at BLDGATE) > > On Thu, 2014-02-20 at 10:11 -0800, Paul E. McKenney wrote: > > But yes, the compiler guys would be extremely happy

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-20 Thread Paul E. McKenney
On Thu, Feb 20, 2014 at 10:32:51AM -0800, Linus Torvalds wrote: > On Thu, Feb 20, 2014 at 10:11 AM, Paul E. McKenney > wrote: > > > > You really need that "consume" to be "acquire". > > So I think we now all agree that that is what the standard is saying. > > And I'm saying that that is wrong, t

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-20 Thread Torvald Riegel
On Thu, 2014-02-20 at 10:32 -0800, Linus Torvalds wrote: > On Thu, Feb 20, 2014 at 10:11 AM, Paul E. McKenney > wrote: > > > > You really need that "consume" to be "acquire". > > So I think we now all agree that that is what the standard is saying. Huh? The standard says that there are two sep

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-20 Thread Torvald Riegel
On Thu, 2014-02-20 at 10:11 -0800, Paul E. McKenney wrote: > But yes, the compiler guys would be extremely happy to simply drop > memory_order_consume from the standard, as it is the memory order > that they most love to hate. > > Getting them to agree to any sort of peep-hole optimization semanti

Re: [RFC][PATCH 0/5] arch: atomic rework

2014-02-20 Thread Linus Torvalds
On Thu, Feb 20, 2014 at 10:11 AM, Paul E. McKenney wrote: > > You really need that "consume" to be "acquire". So I think we now all agree that that is what the standard is saying. And I'm saying that that is wrong, that the standard is badly written, and should be fixed. Because before the stan

  1   2   3   >