linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Compilers and RCU readers: Once more unto the breach!
@ 2015-05-20  0:55 Paul E. McKenney
  2015-05-20  1:57 ` Linus Torvalds
                   ` (2 more replies)
  0 siblings, 3 replies; 44+ messages in thread
From: Paul E. McKenney @ 2015-05-20  0:55 UTC (permalink / raw)
  To: linux-kernel, c++std-parallel, linux-arch, gcc
  Cc: Peter.Sewell, torvalds, Mark.Batty, peterz, will.deacon,
	Ramana.Radhakrishnan, dhowells, akpm, mingo, michaelw

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.  ;-)

The key simplification is to "just say no" to RCU-protected array indexes:
https://lkml.org/lkml/2015/5/12/827, as was suggested by several people.
This simplification means that rcu_dereference (AKA memory_order_consume)
need only return pointers.  This in ture avoids things like (x-x),
(x*0), and (x%1) because if "x" is a pointer, these expressions either
return non-pointers are compilation errors.  With a very few exceptions,
dependency chains can lead -to- non-pointers, but cannot pass -through-
them.

The result is that dependencies are carried only by operations for
which the compiler cannot easily optimize the away those dependencies,
these operations including simple assignment, integer offset (including
indexing), dereferencing, casts, passing as a function argument, return
values from functions and so on.  A complete list with commentary starts
on page 28 of:

	http://www.rdrop.com/users/paulmck/RCU/consume.2015.05.18a.pdf

Dependency chains are broken if a pointer compares equal to some other
pointer not part of the same dependency chain, if too many bits are ORed
onto or ANDed off of a intptr_t or uintptr_t, or if the dependency is
explicitly killed (which should now strictly speaking never be necessary,
but which might allow better diagnostics).  These are set out in more
detail on page 30 of the above PDF.

This covers all the uses in the Linux kernel that I am aware of without
any source-code changes (other than to the rcu_dereference() primitives
themselves) and should also work for compilers and standards.

Thoughts?

							Thanx, Paul


^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2015-09-23 23:26 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-20  0:55 Compilers and RCU readers: Once more unto the breach! Paul E. McKenney
2015-05-20  1:57 ` Linus Torvalds
2015-05-20  2:10   ` Linus Torvalds
2015-05-20  2:41     ` Paul E. McKenney
2015-05-20 11:47       ` Will Deacon
2015-05-20 12:15         ` Paul E. McKenney
2015-05-20 15:46           ` Will Deacon
2015-05-20 15:54             ` Andrew Haley
2015-05-20 18:16               ` [c++std-parallel-1632] " Paul E. McKenney
2015-05-21 14:22                 ` Michael Matz
2015-05-21 15:10                   ` Paul E. McKenney
2015-05-21 16:17                     ` Michael Matz
2015-05-21 18:37                       ` Paul E. McKenney
2015-05-20 18:16             ` Paul E. McKenney
2015-05-21 19:24               ` Will Deacon
2015-05-21 20:02                 ` Paul E. McKenney
2015-05-21 20:42                   ` Linus Torvalds
2015-05-21 22:02                     ` Paul E. McKenney
2015-05-22  6:43                     ` Ingo Molnar
2015-05-22 10:43                       ` Richard Kenner
2015-05-22 13:11                         ` Paul E. McKenney
2015-05-22 13:12                       ` Paul E. McKenney
2015-05-26 17:37                     ` [c++std-parallel-1641] " Torvald Riegel
2015-05-22 17:30                   ` Will Deacon
2015-05-22 18:55                     ` Paul E. McKenney
2015-05-20 13:18         ` David Howells
2015-05-20 13:30           ` Paul E. McKenney
2015-05-20 13:37           ` David Howells
2015-05-20 13:44             ` Ramana Radhakrishnan
2015-05-20 14:03               ` Paul E. McKenney
2015-05-20 14:15                 ` Ramana Radhakrishnan
2015-05-20 15:12                   ` Paul E. McKenney
2015-05-20 15:46                   ` David Howells
2015-05-20 14:02             ` [c++std-parallel-1624] " Paul E. McKenney
2015-05-20  2:34   ` Paul E. McKenney
2015-05-20  7:34     ` [c++std-parallel-1614] " Jens Maurer
2015-05-20  9:03       ` Richard Biener
2015-05-20 12:02         ` Paul E. McKenney
2015-05-20 12:01       ` [c++std-parallel-1616] " Paul E. McKenney
2015-05-26 17:08 ` [c++std-parallel-1611] " Torvald Riegel
2015-05-27  1:41   ` [c++std-parallel-1651] " Paul E. McKenney
2015-07-14  0:44 ` Paul E. McKenney
2015-09-22 17:00   ` Paul E. McKenney
     [not found]     ` <CAPUmR1aqV_cQWjE8qC9x2sfmW-1ocKKMtCgNbjZH0cJ-AO2WTg@mail.gmail.com>
2015-09-23 23:26       ` [c++std-parallel-2008] " Paul E. McKenney

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).