locking/Documentation: Clarify limited control-dependency scope
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 15 Jun 2016 23:08:17 +0000 (16:08 -0700)
committerIngo Molnar <mingo@kernel.org>
Fri, 17 Jun 2016 07:54:45 +0000 (09:54 +0200)
commitebff09a6ff164aec2b33bf1f9a488c45ac108413
tree4c2e43caeacbd254daa8439564e991b1de82750c
parentb316ff783d17bd6217804e2e4385ce9347d7dad9
locking/Documentation: Clarify limited control-dependency scope

Nothing in the control-dependencies section of memory-barriers.txt
says that control dependencies don't extend beyond the end of the
if-statement containing the control dependency.  Worse yet, in many
situations, they do extend beyond that if-statement.  In particular,
the compiler cannot destroy the control dependency given proper use of
READ_ONCE() and WRITE_ONCE().  However, a weakly ordered system having
a conditional-move instruction provides the control-dependency guarantee
only to code within the scope of the if-statement itself.

This commit therefore adds words and an example demonstrating this
limitation of control dependencies.

Reported-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: corbet@lwn.net
Cc: linux-arch@vger.kernel.org
Cc: linux-doc@vger.kernel.org
Link: http://lkml.kernel.org/r/20160615230817.GA18039@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Documentation/memory-barriers.txt