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

2014-02-17 Thread Paul E. McKenney
On Mon, Feb 17, 2014 at 04:18:52PM -0800, Linus Torvalds wrote: On Mon, Feb 17, 2014 at 3:41 PM, Torvald Riegel trie...@redhat.com wrote: There's an underlying problem here that's independent from the actual instance that you're worried about here: no sense is a ultimately a matter of

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

2014-02-17 Thread Paul E. McKenney
On Mon, Feb 17, 2014 at 12:18:21PM -0800, Linus Torvalds wrote: On Mon, Feb 17, 2014 at 11:55 AM, Torvald Riegel trie...@redhat.com wrote: Which example do you have in mind here? Haven't we resolved all the debated examples, or did I miss any? Well, Paul seems to still think that the

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

2014-02-17 Thread Paul E. McKenney
On Mon, Feb 17, 2014 at 07:24:56PM -0800, Linus Torvalds wrote: On Mon, Feb 17, 2014 at 7:00 PM, Paul E. McKenney paul...@linux.vnet.ibm.com wrote: One example that I learned about last week uses the branch-prediction hardware to validate value speculation. And no, I am not at all a fan

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

2014-02-17 Thread Paul E. McKenney
On Mon, Feb 17, 2014 at 07:42:42PM -0800, Linus Torvalds wrote: On Mon, Feb 17, 2014 at 7:24 PM, Linus Torvalds torva...@linux-foundation.org wrote: As far as I can tell, the intent is that you can't do value speculation (except perhaps for the relaxed, which quite frankly sounds largely

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

2014-02-14 Thread Paul E. McKenney
On Thu, Feb 13, 2014 at 08:43:01PM -0800, Torvald Riegel wrote: On Thu, 2014-02-13 at 18:01 -0800, Paul E. McKenney wrote: [ . . . ] Another option would be to flag the conditional expression, prohibiting the compiler from optimizing out any conditional branches. Perhaps something like

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

2014-02-14 Thread Paul E. McKenney
On Fri, Feb 14, 2014 at 12:02:23PM -0800, Linus Torvalds wrote: On Fri, Feb 14, 2014 at 11:50 AM, Linus Torvalds torva...@linux-foundation.org wrote: Why are we still discussing this idiocy? It's irrelevant. If the standard really allows random store speculation, the standard doesn't

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

2014-02-14 Thread Paul E. McKenney
On Fri, Feb 14, 2014 at 06:48:02PM -0800, Linus Torvalds wrote: On Fri, Feb 14, 2014 at 6:44 PM, Linus Torvalds torva...@linux-foundation.org wrote: And conversely, the C11 people can walk away from us too. But if they can't make us happy (and by make us happy, I really mean no stupid

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

2014-02-14 Thread Paul E. McKenney
On Fri, Feb 14, 2014 at 10:35:44PM -0800, Paul E. McKenney wrote: On Fri, Feb 14, 2014 at 06:48:02PM -0800, Linus Torvalds wrote: On Fri, Feb 14, 2014 at 6:44 PM, Linus Torvalds torva...@linux-foundation.org wrote: And conversely, the C11 people can walk away from us too

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

2014-02-13 Thread Paul E. McKenney
On Thu, Feb 13, 2014 at 12:03:57PM -0800, Torvald Riegel wrote: On Wed, 2014-02-12 at 16:23 -0800, Paul E. McKenney wrote: On Wed, Feb 12, 2014 at 12:22:53PM -0800, Linus Torvalds wrote: On Wed, Feb 12, 2014 at 10:07 AM, Paul E. McKenney paul...@linux.vnet.ibm.com wrote: Us Linux

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

2014-02-12 Thread Paul E. McKenney
On Tue, Feb 11, 2014 at 10:06:34PM -0800, Torvald Riegel wrote: On Tue, 2014-02-11 at 07:59 -0800, Paul E. McKenney wrote: On Mon, Feb 10, 2014 at 11:09:24AM -0800, Linus Torvalds wrote: On Sun, Feb 9, 2014 at 4:27 PM, Torvald Riegel trie...@redhat.com wrote: Intuitively

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

2014-02-12 Thread Paul E. McKenney
On Wed, Feb 12, 2014 at 10:19:07AM +0100, Peter Zijlstra wrote: I don't know the specifics of your example, but from how I understand it, I don't see a problem if the compiler can prove that the store will always happen. To be more specific, if the compiler can prove that the store will

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

2014-02-12 Thread Paul E. McKenney
On Tue, Feb 11, 2014 at 09:39:24PM -0800, Torvald Riegel wrote: On Mon, 2014-02-10 at 11:09 -0800, Linus Torvalds wrote: On Sun, Feb 9, 2014 at 4:27 PM, Torvald Riegel trie...@redhat.com wrote: Intuitively, this is wrong because this let's the program take a step the abstract machine

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

2014-02-12 Thread Paul E. McKenney
On Tue, Feb 11, 2014 at 09:13:34PM -0800, Torvald Riegel wrote: On Sun, 2014-02-09 at 19:51 -0800, Paul E. McKenney wrote: On Mon, Feb 10, 2014 at 01:06:48AM +0100, Torvald Riegel wrote: On Thu, 2014-02-06 at 20:20 -0800, Paul E. McKenney wrote: On Fri, Feb 07, 2014 at 12:44:48AM +0100

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

2014-02-12 Thread Paul E. McKenney
On Wed, Feb 12, 2014 at 12:22:53PM -0800, Linus Torvalds wrote: On Wed, Feb 12, 2014 at 10:07 AM, Paul E. McKenney paul...@linux.vnet.ibm.com wrote: Us Linux-kernel hackers will often need to use volatile semantics in combination with C11 atomics in most cases. The C11 atomics do cover

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

2014-02-11 Thread Paul E. McKenney
On Mon, Feb 10, 2014 at 11:09:24AM -0800, Linus Torvalds wrote: On Sun, Feb 9, 2014 at 4:27 PM, Torvald Riegel trie...@redhat.com wrote: Intuitively, this is wrong because this let's the program take a step the abstract machine wouldn't do. This is different to the sequential code that

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

2014-02-10 Thread Paul E. McKenney
On Mon, Feb 10, 2014 at 11:49:29AM +, Will Deacon wrote: On Mon, Feb 10, 2014 at 11:48:13AM +, Peter Zijlstra wrote: On Fri, Feb 07, 2014 at 10:02:16AM -0800, Paul E. McKenney wrote: As near as I can tell, compiler writers hate the idea of prohibiting speculative-store

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

2014-02-09 Thread Paul E. McKenney
On Mon, Feb 10, 2014 at 01:27:51AM +0100, Torvald Riegel wrote: On Fri, 2014-02-07 at 10:02 -0800, Paul E. McKenney wrote: On Fri, Feb 07, 2014 at 04:55:48PM +, Will Deacon wrote: Hi Paul, On Fri, Feb 07, 2014 at 04:50:28PM +, Paul E. McKenney wrote: On Fri, Feb 07, 2014

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

2014-02-09 Thread Paul E. McKenney
On Mon, Feb 10, 2014 at 01:27:51AM +0100, Torvald Riegel wrote: On Fri, 2014-02-07 at 10:02 -0800, Paul E. McKenney wrote: On Fri, Feb 07, 2014 at 04:55:48PM +, Will Deacon wrote: [ . . . ] And then it is a short and uncontroversial step to the following: Initial state: x == y == 0

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

2014-02-09 Thread Paul E. McKenney
On Mon, Feb 10, 2014 at 01:06:48AM +0100, Torvald Riegel wrote: On Thu, 2014-02-06 at 20:20 -0800, Paul E. McKenney wrote: On Fri, Feb 07, 2014 at 12:44:48AM +0100, Torvald Riegel wrote: On Thu, 2014-02-06 at 14:11 -0800, Paul E. McKenney wrote: On Thu, Feb 06, 2014 at 10:17:03PM +0100

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

2014-02-07 Thread Paul E. McKenney
On Fri, Feb 07, 2014 at 10:13:40AM +0100, Torvald Riegel wrote: On Thu, 2014-02-06 at 20:06 -0800, Paul E. McKenney wrote: On Thu, Feb 06, 2014 at 11:58:22PM +0100, Torvald Riegel wrote: On Thu, 2014-02-06 at 13:55 -0800, Paul E. McKenney wrote: On Thu, Feb 06, 2014 at 10:09:25PM +0100

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

2014-02-07 Thread Paul E. McKenney
On Fri, Feb 07, 2014 at 12:01:25PM +, Will Deacon wrote: Hello Torvald, It looks like Paul clarified most of the points I was trying to make (thanks Paul!), so I won't go back over them here. On Thu, Feb 06, 2014 at 09:09:25PM +, Torvald Riegel wrote: Are you familiar with the

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

2014-02-07 Thread Paul E. McKenney
On Fri, Feb 07, 2014 at 08:44:05AM +0100, Peter Zijlstra wrote: On Thu, Feb 06, 2014 at 08:20:51PM -0800, Paul E. McKenney wrote: Hopefully some discussion of out-of-thin-air values as well. Yes, absolutely shoot store speculation in the head already. Then drive a wooden stake through its

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

2014-02-07 Thread Paul E. McKenney
On Fri, Feb 07, 2014 at 04:55:48PM +, Will Deacon wrote: Hi Paul, On Fri, Feb 07, 2014 at 04:50:28PM +, Paul E. McKenney wrote: On Fri, Feb 07, 2014 at 08:44:05AM +0100, Peter Zijlstra wrote: On Thu, Feb 06, 2014 at 08:20:51PM -0800, Paul E. McKenney wrote: Hopefully some

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

2014-02-07 Thread Paul E. McKenney
On Fri, Feb 07, 2014 at 05:13:36PM +, Will Deacon wrote: On Fri, Feb 07, 2014 at 05:06:54PM +, Peter Zijlstra wrote: On Fri, Feb 07, 2014 at 04:55:48PM +, Will Deacon wrote: Hi Paul, On Fri, Feb 07, 2014 at 04:50:28PM +, Paul E. McKenney wrote: On Fri, Feb 07, 2014

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

2014-02-06 Thread Paul E. McKenney
On Thu, Feb 06, 2014 at 06:59:10PM +, Will Deacon wrote: On Thu, Feb 06, 2014 at 06:55:01PM +, Ramana Radhakrishnan wrote: On 02/06/14 18:25, David Howells wrote: Is it worth considering a move towards using C11 atomics and barriers and compiler intrinsics inside the kernel?

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

2014-02-06 Thread Paul E. McKenney
On Thu, Feb 06, 2014 at 10:09:25PM +0100, Torvald Riegel wrote: On Thu, 2014-02-06 at 18:59 +, Will Deacon wrote: On Thu, Feb 06, 2014 at 06:55:01PM +, Ramana Radhakrishnan wrote: On 02/06/14 18:25, David Howells wrote: Is it worth considering a move towards using C11 atomics

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

2014-02-06 Thread Paul E. McKenney
On Thu, Feb 06, 2014 at 10:17:03PM +0100, Torvald Riegel wrote: On Thu, 2014-02-06 at 11:27 -0800, Paul E. McKenney wrote: On Thu, Feb 06, 2014 at 06:59:10PM +, Will Deacon wrote: On Thu, Feb 06, 2014 at 06:55:01PM +, Ramana Radhakrishnan wrote: On 02/06/14 18:25, David Howells

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

2014-02-06 Thread Paul E. McKenney
On Thu, Feb 06, 2014 at 11:58:22PM +0100, Torvald Riegel wrote: On Thu, 2014-02-06 at 13:55 -0800, Paul E. McKenney wrote: On Thu, Feb 06, 2014 at 10:09:25PM +0100, Torvald Riegel wrote: On Thu, 2014-02-06 at 18:59 +, Will Deacon wrote: On Thu, Feb 06, 2014 at 06:55:01PM +

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

2014-02-06 Thread Paul E. McKenney
On Fri, Feb 07, 2014 at 12:44:48AM +0100, Torvald Riegel wrote: On Thu, 2014-02-06 at 14:11 -0800, Paul E. McKenney wrote: On Thu, Feb 06, 2014 at 10:17:03PM +0100, Torvald Riegel wrote: On Thu, 2014-02-06 at 11:27 -0800, Paul E. McKenney wrote: On Thu, Feb 06, 2014 at 06:59:10PM +

Re: Memory corruption due to word sharing

2012-02-03 Thread Paul E. McKenney
On Fri, Feb 03, 2012 at 12:00:03PM -0800, Linus Torvalds wrote: On Fri, Feb 3, 2012 at 11:16 AM, Andrew MacLeod amacl...@redhat.com wrote: [ . . . ] Having access to __ATOMIC_ACQUIRE would actually be an improvement - it's just that the architectures that really care about things like that

Re: Memory corruption due to word sharing

2012-02-02 Thread Paul E. McKenney
On Wed, Feb 01, 2012 at 03:11:00PM -0800, Linus Torvalds wrote: On Wed, Feb 1, 2012 at 2:45 PM, Paul E. McKenney paul...@linux.vnet.ibm.com wrote: My (perhaps forlorn and naive) hope is that C++11 memory_order_relaxed will eventually allow ACCESS_ONCE() to be upgraded so that (for example

Re: Memory corruption due to word sharing

2012-02-02 Thread Paul E. McKenney
On Thu, Feb 02, 2012 at 11:08:25AM -0800, Linus Torvalds wrote: On Thu, Feb 2, 2012 at 10:42 AM, Paul E. McKenney paul...@linux.vnet.ibm.com wrote: SMP-atomic or percpu atomic? Or both? Only SMP-atomic. And I assume that since the compiler does them, that would now make it impossible

Re: Memory corruption due to word sharing

2012-02-01 Thread Paul E. McKenney
On Wed, Feb 01, 2012 at 12:59:24PM -0800, Linus Torvalds wrote: On Wed, Feb 1, 2012 at 12:41 PM, Torvald Riegel trie...@redhat.com wrote: You do rely on the compiler to do common transformations I suppose: hoist loads out of loops, CSE, etc.  How do you expect the compiler to know whether

<    1   2