locking/Documentation: Clarify limited control-dependency scope
authorPaul E. McKenney <[email protected]>
Wed, 15 Jun 2016 23:08:17 +0000 (16:08 -0700)
committerIngo Molnar <[email protected]>
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 <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
Acked-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
Documentation/memory-barriers.txt