linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Torvald Riegel <triegel@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>,
	Will Deacon <will.deacon@arm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>,
	David Howells <dhowells@redhat.com>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"mingo@kernel.org" <mingo@kernel.org>,
	"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: [RFC][PATCH 0/5] arch: atomic rework
Date: Thu, 20 Feb 2014 18:49:36 +0100	[thread overview]
Message-ID: <1392918576.18779.10198.camel@triegel.csb> (raw)
In-Reply-To: <CA+55aFwwscSzwTr+xRdirtTx7HzugmMY9HrDe0GBqNhn=AuNVA@mail.gmail.com>

On Wed, 2014-02-19 at 20:43 -0800, Linus Torvalds wrote:

[Paul has already answered many of your questions, and my reply to your
previous email should also answer some.]

> If the consumer of an atomic load isn't a pointer chasing operation,
> then the consume should be defined to be the same as acquire. None of
> this "conditionals break consumers". No, conditionals on the
> dependency path should turn consumers into acquire, because otherwise
> the "consume" load is dangerous as hell.

Yes, mo_consume is more tricky than mo_acquire.

However, that has an advantage because you can avoid getting stronger
barriers if you don't need them (ie, you can avoid the "auto-update to
acquire" you seem to have in mind).

The auto-upgrade would be a possible semantics, I agree.

Another option may be to let an implementation optimize the HW barriers
that it uses for mo_acquire.  That is, if the compiler sees that (1) the
result of an mo_acquire load is used on certain code paths *only* for
consumers that carry the dependency *and* (2) there are no other
operations on that code path that can possibly rely on the mo_acquire
ordering guarantees, then the compiler can use a weaker HW barrier on
archs such as PowerPC or ARM.

That is similar to the rules for mo_consume you seem to have in mind,
but makes it a compiler optimization on mo_acquire.  However, the
compiler has to be conservative here, so having a mo_consume that is
trickier to use but doesn't ever silently introduce stronger HW barriers
seems to be useful (modulo the difficulties regarding to how it's
currently specified in the standard).

> And if the definition of acquire doesn't include the control
> dependency either, then the C atomic memory model is just completely
> and utterly broken, since the above *trivial* and clearly useful
> example is broken.

In terms of the model, if you establish a synchronizes-with using a
reads-from that has (or crosses) a release/acquire memory-order pair,
then this synchronizes-with will also order other operations that it's
sequenced-before (see the composition of synchronizes-with and
sequenced-before in the inter-thread-happens-before definition in n3132
6.15).

So yes, mo_acquire does that the logical "control dependencies" /
sequenced-before into account.


  parent reply	other threads:[~2014-02-20 17:50 UTC|newest]

Thread overview: 299+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06 13:48 [RFC][PATCH 0/5] arch: atomic rework Peter Zijlstra
2014-02-06 13:48 ` [RFC][PATCH 1/5] ia64: Fix up smp_mb__{before,after}_clear_bit Peter Zijlstra
2014-02-06 13:48 ` [RFC][PATCH 2/5] arc,hexagon: Delete asm/barrier.h Peter Zijlstra
2014-02-06 13:48 ` [RFC][PATCH 3/5] arch: s/smp_mb__(before|after)_(atomic|clear)_(dec,inc,bit)/smp_mb__\1/g Peter Zijlstra
2014-02-06 19:12   ` Paul E. McKenney
2014-02-07  9:52     ` Will Deacon
2014-02-06 13:48 ` [RFC][PATCH 4/5] arch: Generic atomic.h cleanup Peter Zijlstra
2014-02-06 17:49   ` Will Deacon
2014-02-06 13:48 ` [RFC][PATCH 5/5] arch: Sanitize atomic_t bitwise ops Peter Zijlstra
2014-02-06 14:43   ` Geert Uytterhoeven
2014-02-06 16:14     ` Peter Zijlstra
2014-02-06 16:53   ` Linus Torvalds
2014-02-06 17:52     ` Peter Zijlstra
2014-02-06 17:56       ` Linus Torvalds
2014-02-06 18:09         ` Peter Zijlstra
2014-02-06 18:25 ` [RFC][PATCH 0/5] arch: atomic rework David Howells
2014-02-06 18:30   ` Peter Zijlstra
2014-02-06 18:42   ` Paul E. McKenney
2014-02-06 18:55   ` Ramana Radhakrishnan
2014-02-06 18:59     ` Will Deacon
2014-02-06 19:27       ` Paul E. McKenney
2014-02-06 21:17         ` Torvald Riegel
2014-02-06 22:11           ` Paul E. McKenney
2014-02-06 23:44             ` Torvald Riegel
2014-02-07  4:20               ` Paul E. McKenney
2014-02-07  7:44                 ` Peter Zijlstra
2014-02-07 16:50                   ` Paul E. McKenney
2014-02-07 16:55                     ` Will Deacon
2014-02-07 17:06                       ` Peter Zijlstra
2014-02-07 17:13                         ` Will Deacon
2014-02-07 17:20                           ` Peter Zijlstra
2014-02-07 18:03                           ` Paul E. McKenney
2014-02-07 17:46                         ` Joseph S. Myers
2014-02-07 18:43                         ` Torvald Riegel
2014-02-07 18:02                       ` Paul E. McKenney
2014-02-10  0:27                         ` Torvald Riegel
2014-02-10  0:56                           ` Linus Torvalds
2014-02-10  1:16                             ` Torvald Riegel
2014-02-10  1:24                               ` Linus Torvalds
2014-02-10  1:46                                 ` Torvald Riegel
2014-02-10  2:04                                   ` Linus Torvalds
2014-02-10  3:21                           ` Paul E. McKenney
2014-02-10  3:45                           ` Paul E. McKenney
2014-02-10 11:46                           ` Peter Zijlstra
2014-02-10 19:09                           ` Linus Torvalds
2014-02-11 15:59                             ` Paul E. McKenney
2014-02-12  6:06                               ` Torvald Riegel
2014-02-12  9:19                                 ` Peter Zijlstra
2014-02-12 17:42                                   ` Paul E. McKenney
2014-02-12 18:12                                     ` Peter Zijlstra
2014-02-17 18:18                                       ` Paul E. McKenney
2014-02-17 20:39                                         ` Richard Biener
2014-02-17 22:14                                           ` Paul E. McKenney
2014-02-17 22:27                                             ` Torvald Riegel
2014-02-14  5:07                                   ` Torvald Riegel
2014-02-14  9:50                                     ` Peter Zijlstra
2014-02-14 19:19                                       ` Torvald Riegel
2014-02-12 17:39                                 ` Paul E. McKenney
2014-02-12  5:39                             ` Torvald Riegel
2014-02-12 18:07                               ` Paul E. McKenney
2014-02-12 20:22                                 ` Linus Torvalds
2014-02-13  0:23                                   ` Paul E. McKenney
2014-02-13 20:03                                     ` Torvald Riegel
2014-02-14  2:01                                       ` Paul E. McKenney
2014-02-14  4:43                                         ` Torvald Riegel
2014-02-14 17:29                                           ` Paul E. McKenney
2014-02-14 19:21                                             ` Torvald Riegel
2014-02-14 19:50                                             ` Linus Torvalds
2014-02-14 20:02                                               ` Linus Torvalds
2014-02-15  2:08                                                 ` Paul E. McKenney
2014-02-15  2:44                                                   ` Linus Torvalds
2014-02-15  2:48                                                     ` Linus Torvalds
2014-02-15  6:35                                                       ` Paul E. McKenney
2014-02-15  6:58                                                         ` Paul E. McKenney
2014-02-15 18:07                                                     ` Torvald Riegel
2014-02-17 18:59                                                       ` Joseph S. Myers
2014-02-17 19:19                                                         ` Will Deacon
2014-02-17 19:41                                                         ` Torvald Riegel
2014-02-17 23:12                                                           ` Joseph S. Myers
2014-02-15 17:45                                                 ` Torvald Riegel
2014-02-15 18:49                                                   ` Linus Torvalds
2014-02-17 19:55                                                     ` Torvald Riegel
2014-02-17 20:18                                                       ` Linus Torvalds
2014-02-17 21:21                                                         ` Torvald Riegel
2014-02-17 22:02                                                           ` Linus Torvalds
2014-02-17 22:25                                                             ` Torvald Riegel
2014-02-17 22:47                                                               ` Linus Torvalds
2014-02-17 23:41                                                                 ` Torvald Riegel
2014-02-18  0:18                                                                   ` Linus Torvalds
2014-02-18  1:26                                                                     ` Paul E. McKenney
2014-02-18 15:38                                                                     ` Torvald Riegel
2014-02-18 16:55                                                                       ` Paul E. McKenney
2014-02-18 19:57                                                                         ` Torvald Riegel
2014-02-17 23:10                                                         ` Alec Teal
2014-02-18  0:05                                                           ` Linus Torvalds
2014-02-18 15:31                                                             ` Torvald Riegel
2014-02-18 16:49                                                               ` Linus Torvalds
2014-02-18 17:16                                                                 ` Paul E. McKenney
2014-02-18 18:23                                                                   ` Peter Sewell
2014-02-18 19:00                                                                     ` Linus Torvalds
2014-02-18 19:42                                                                     ` Paul E. McKenney
2014-02-18 21:40                                                                   ` Torvald Riegel
2014-02-18 21:52                                                                     ` Peter Zijlstra
2014-02-19  9:52                                                                       ` Torvald Riegel
2014-02-18 22:58                                                                     ` Paul E. McKenney
2014-02-19 10:59                                                                       ` Torvald Riegel
2014-02-19 15:14                                                                         ` Paul E. McKenney
2014-02-19 17:55                                                                           ` Torvald Riegel
2014-02-19 22:12                                                                             ` Paul E. McKenney
2014-02-18 21:21                                                                 ` Torvald Riegel
2014-02-18 21:40                                                                   ` Peter Zijlstra
2014-02-18 21:47                                                                     ` Torvald Riegel
2014-02-19 15:23                                                                       ` David Lang
2014-02-19 18:11                                                                         ` Torvald Riegel
2014-02-18 21:47                                                                   ` Peter Zijlstra
2014-02-19 11:07                                                                     ` Torvald Riegel
2014-02-19 11:42                                                                       ` Peter Zijlstra
2014-02-18 22:14                                                                   ` Linus Torvalds
2014-02-19 14:40                                                                     ` Torvald Riegel
2014-02-19 19:49                                                                       ` Linus Torvalds
2014-02-18  3:00                                                         ` Paul E. McKenney
2014-02-18  3:24                                                           ` Linus Torvalds
2014-02-18  3:42                                                             ` Linus Torvalds
2014-02-18  5:22                                                               ` Paul E. McKenney
2014-02-18 16:17                                                               ` Torvald Riegel
2014-02-18 17:44                                                                 ` Linus Torvalds
2014-02-18 19:40                                                                   ` Paul E. McKenney
2014-02-18 19:47                                                                   ` Torvald Riegel
2014-02-20  0:53                                                                     ` Linus Torvalds
2014-02-20  4:01                                                                       ` Paul E. McKenney
2014-02-20  4:43                                                                         ` Linus Torvalds
2014-02-20  8:30                                                                           ` Paul E. McKenney
2014-02-20  9:20                                                                             ` Paul E. McKenney
2014-02-20 17:01                                                                             ` Linus Torvalds
2014-02-20 18:11                                                                               ` Paul E. McKenney
2014-02-20 18:32                                                                                 ` Linus Torvalds
2014-02-20 18:53                                                                                   ` Torvald Riegel
2014-02-20 19:09                                                                                     ` Linus Torvalds
2014-02-22 18:53                                                                                       ` Torvald Riegel
2014-02-22 21:53                                                                                         ` Linus Torvalds
2014-02-23  0:39                                                                                           ` Paul E. McKenney
2014-02-23  3:50                                                                                             ` Linus Torvalds
2014-02-23  6:34                                                                                               ` Paul E. McKenney
2014-02-23 19:31                                                                                                 ` Linus Torvalds
2014-02-24  1:16                                                                                                   ` Paul E. McKenney
2014-02-24  1:35                                                                                                     ` Linus Torvalds
2014-02-24  4:59                                                                                                       ` Paul E. McKenney
2014-02-24  5:25                                                                                                         ` Linus Torvalds
2014-02-24 15:57                                                                                                   ` Linus Torvalds
2014-02-24 16:27                                                                                                     ` Richard Biener
2014-02-24 16:37                                                                                                       ` Linus Torvalds
2014-02-24 16:40                                                                                                         ` Linus Torvalds
2014-02-24 16:55                                                                                                         ` Michael Matz
2014-02-24 17:28                                                                                                           ` Paul E. McKenney
2014-02-24 17:57                                                                                                             ` Paul E. McKenney
2014-02-26 17:39                                                                                                             ` Torvald Riegel
2014-02-24 17:38                                                                                                           ` Linus Torvalds
2014-02-24 18:12                                                                                                             ` Paul E. McKenney
2014-02-26 17:34                                                                                                             ` Torvald Riegel
2014-02-24 17:21                                                                                                     ` Paul E. McKenney
2014-02-24 18:14                                                                                                       ` Linus Torvalds
2014-02-24 18:53                                                                                                         ` Paul E. McKenney
2014-02-24 19:54                                                                                                           ` Linus Torvalds
2014-02-24 22:37                                                                                                             ` Paul E. McKenney
2014-02-24 23:35                                                                                                               ` Linus Torvalds
2014-02-25  6:00                                                                                                                 ` Paul E. McKenney
2014-02-26  1:47                                                                                                                   ` Linus Torvalds
2014-02-26  5:12                                                                                                                     ` Paul E. McKenney
2014-02-25  6:05                                                                                                                 ` Linus Torvalds
2014-02-26  0:15                                                                                                                   ` Paul E. McKenney
2014-02-26  3:32                                                                                                                     ` Jeff Law
2014-02-26  5:23                                                                                                                       ` Paul E. McKenney
2014-02-27 15:37                                                                                                             ` Torvald Riegel
2014-02-27 17:01                                                                                                               ` Linus Torvalds
2014-02-27 19:06                                                                                                                 ` Paul E. McKenney
2014-02-27 19:47                                                                                                                   ` Linus Torvalds
2014-02-27 20:53                                                                                                                     ` Paul E. McKenney
2014-03-01  0:50                                                                                                                       ` Paul E. McKenney
2014-03-01 10:06                                                                                                                         ` Peter Sewell
2014-03-01 14:03                                                                                                                           ` Paul E. McKenney
2014-03-02 10:05                                                                                                                             ` Peter Sewell
2014-03-02 23:20                                                                                                                               ` Paul E. McKenney
2014-03-02 23:44                                                                                                                                 ` Peter Sewell
2014-03-03  4:25                                                                                                                                   ` Paul E. McKenney
2014-03-03 20:44                                                                                                                               ` Torvald Riegel
2014-03-04 22:11                                                                                                                                 ` Peter Sewell
2014-03-05 17:15                                                                                                                                   ` Torvald Riegel
2014-03-05 18:37                                                                                                                                     ` Peter Sewell
2014-03-03 18:55                                                                                                                         ` Torvald Riegel
2014-03-03 19:20                                                                                                                           ` Paul E. McKenney
2014-03-03 20:46                                                                                                                             ` Torvald Riegel
2014-03-04 19:00                                                                                                                               ` Paul E. McKenney
2014-03-04 21:35                                                                                                                                 ` Paul E. McKenney
2014-03-05 16:54                                                                                                                                   ` Torvald Riegel
2014-03-05 18:15                                                                                                                                     ` Paul E. McKenney
2014-03-07 18:33                                                                                                                                       ` Torvald Riegel
2014-03-07 19:11                                                                                                                                         ` Paul E. McKenney
2014-03-05 16:26                                                                                                                                 ` Torvald Riegel
2014-03-05 18:01                                                                                                                                   ` Paul E. McKenney
2014-03-07 17:45                                                                                                                                     ` Torvald Riegel
2014-03-07 19:02                                                                                                                                       ` Paul E. McKenney
2014-03-03 18:59                                                                                                                     ` Torvald Riegel
2014-03-03 15:36                                                                                                                 ` Torvald Riegel
2014-02-27 17:50                                                                                                               ` Paul E. McKenney
2014-02-27 19:22                                                                                                                 ` Paul E. McKenney
2014-02-28  1:02                                                                                                                 ` Paul E. McKenney
2014-03-03 19:01                                                                                                                 ` Torvald Riegel
2014-02-20 18:56                                                                                   ` Paul E. McKenney
2014-02-20 19:45                                                                                     ` Linus Torvalds
2014-02-20 22:10                                                                                       ` Paul E. McKenney
2014-02-20 22:52                                                                                         ` Linus Torvalds
2014-02-21 18:35                                                                                           ` Michael Matz
2014-02-21 19:13                                                                                             ` Paul E. McKenney
2014-02-21 22:10                                                                                               ` Joseph S. Myers
2014-02-21 22:37                                                                                                 ` Paul E. McKenney
2014-02-26 13:09                                                                                                 ` Torvald Riegel
2014-02-26 18:43                                                                                                   ` Joseph S. Myers
2014-02-27  0:52                                                                                                     ` Torvald Riegel
2014-02-24 13:55                                                                                               ` Michael Matz
2014-02-24 17:40                                                                                                 ` Paul E. McKenney
2014-02-26 13:04                                                                                               ` Torvald Riegel
2014-02-26 18:27                                                                                                 ` Paul E. McKenney
2014-02-20 18:44                                                                                 ` Torvald Riegel
2014-02-20 18:56                                                                                   ` Paul E. McKenney
2014-02-20 18:23                                                                               ` Torvald Riegel
     [not found]                                                                               ` <CAHWkzRQZ8+gOGMFNyTKjFNzpUv6d_J1G9KL0x_iCa=YCgvEojQ@mail.gmail.com>
2014-02-21 19:16                                                                                 ` Linus Torvalds
2014-02-21 19:41                                                                                   ` Linus Torvalds
2014-02-21 19:48                                                                                     ` Peter Sewell
     [not found]                                                                                   ` <CAHWkzRSO82jU-9dtTEjHaW2FeLcEqdZXxp5Q8cmVTTT9uhZQYw@mail.gmail.com>
2014-02-21 20:22                                                                                     ` Linus Torvalds
     [not found]                                                                                 ` <CAHWkzRRxqhH+DnuQHu9bM4ywGBen3oqtT8W4Xqt1CFAHy2WQRg@mail.gmail.com>
2014-02-21 19:24                                                                                   ` Paul E. McKenney
2014-02-20 17:54                                                                             ` Torvald Riegel
2014-02-20 18:11                                                                               ` Paul E. McKenney
2014-02-20 17:49                                                                           ` Torvald Riegel [this message]
2014-02-20 18:25                                                                             ` Linus Torvalds
2014-02-20 19:02                                                                               ` Linus Torvalds
2014-02-20 19:06                                                                                 ` Linus Torvalds
2014-02-20 17:26                                                                         ` Torvald Riegel
2014-02-20 18:18                                                                           ` Paul E. McKenney
2014-02-22 18:30                                                                             ` Torvald Riegel
2014-02-22 20:17                                                                               ` Paul E. McKenney
2014-02-20 17:14                                                                       ` Torvald Riegel
2014-02-20 17:34                                                                         ` Linus Torvalds
2014-02-20 18:12                                                                           ` Torvald Riegel
2014-02-20 18:26                                                                           ` Paul E. McKenney
2014-02-18  5:01                                                             ` Paul E. McKenney
2014-02-18 15:56                                                           ` Torvald Riegel
2014-02-18 16:51                                                             ` Paul E. McKenney
2014-02-17 20:23                                                       ` Paul E. McKenney
2014-02-17 21:05                                                         ` Torvald Riegel
2014-02-15 17:30                                               ` Torvald Riegel
2014-02-15 19:15                                                 ` Linus Torvalds
2014-02-17 22:09                                                   ` Torvald Riegel
2014-02-17 22:32                                                     ` Linus Torvalds
2014-02-17 23:17                                                       ` Torvald Riegel
2014-02-18  0:09                                                         ` Linus Torvalds
2014-02-18 15:46                                                           ` Torvald Riegel
2014-02-10 11:48                         ` Peter Zijlstra
2014-02-10 11:49                           ` Will Deacon
2014-02-10 12:05                             ` Peter Zijlstra
2014-02-10 15:04                             ` Paul E. McKenney
2014-02-10 16:22                               ` Will Deacon
2014-02-07 18:44                     ` Torvald Riegel
2014-02-10  0:06                 ` Torvald Riegel
2014-02-10  3:51                   ` Paul E. McKenney
2014-02-12  5:13                     ` Torvald Riegel
2014-02-12 18:26                       ` Paul E. McKenney
2014-02-06 21:09       ` Torvald Riegel
2014-02-06 21:55         ` Paul E. McKenney
2014-02-06 22:58           ` Torvald Riegel
2014-02-07  4:06             ` Paul E. McKenney
2014-02-07  9:13               ` Torvald Riegel
2014-02-07 16:44                 ` Paul E. McKenney
2014-02-06 22:13         ` Joseph S. Myers
2014-02-06 23:25           ` Torvald Riegel
2014-02-06 23:33             ` Joseph S. Myers
2014-02-07 12:01         ` Will Deacon
2014-02-07 16:47           ` Paul E. McKenney
2014-02-06 19:21   ` Linus Torvalds
     [not found] ` <52F93B7C.2090304@tilera.com>
     [not found]   ` <20140210205719.GY5002@laptop.programming.kicks-ass.net>
2014-02-10 21:08     ` Chris Metcalf
2014-02-10 21:14       ` Peter Zijlstra
2014-02-18 12:12 Peter Sewell
2014-02-18 12:53 ` Peter Zijlstra
2014-02-18 16:08   ` Peter Sewell
2014-02-18 14:56 ` Paul E. McKenney
2014-02-18 15:16   ` Mark Batty
2014-02-18 17:17     ` Paul E. McKenney
2014-02-18 15:33   ` Peter Sewell
2014-02-18 16:47     ` Paul E. McKenney
2014-02-18 17:38 ` Linus Torvalds
2014-02-18 18:21   ` Peter Sewell
2014-02-18 18:49     ` Linus Torvalds
2014-02-18 19:47       ` Paul E. McKenney
2014-02-18 20:46     ` Torvald Riegel
2014-02-18 20:43 ` Torvald Riegel
2014-02-18 21:29   ` Paul E. McKenney
2014-02-18 23:48   ` Peter Sewell
2014-02-19  9:46     ` Torvald Riegel
2014-02-26  3:06 George Spelvin
2014-02-26  5:22 ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392918576.18779.10198.camel@triegel.csb \
    --to=triegel@redhat.com \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).