Skip to content

Commit

Permalink
tools/memory-model: Finish the removal of rb-dep, smp_read_barrier_de…
Browse files Browse the repository at this point in the history
…pends(), and lockless_dereference()

Commit:

  bf28ae5 ("tools/memory-model: Remove rb-dep, smp_read_barrier_depends, and lockless_dereference")

was merged too early, while it was still in RFC form.  This patch adds in
the missing pieces.

Akira pointed out some typos in the original patch, and he noted that
cheatsheet.txt should indicate that READ_ONCE() now implies an address
dependency.  Andrea suggested documenting the relationship betwwen
unsuccessful RMW operations and address dependencies.

Andrea pointed out that the macro for rcu_dereference() in linux.def
should now use the "once" annotation instead of "deref".  He also
suggested that the comments should mention commit:

  5a8897c ("locking/atomics/alpha: Add smp_read_barrier_depends() to _release()/_relaxed() atomics")

... as an important precursor, and he contributed commit:

  cb13b42 ("locking/xchg/alpha: Add unconditional memory barrier to cmpxchg()")

which is another prerequisite.

Suggested-by: Akira Yokosawa <[email protected]>
Suggested-by: Andrea Parri <[email protected]>
Signed-off-by: Alan Stern <[email protected]>
[ Fixed read_read_lock() typo reported by Akira. ]
Signed-off-by: Paul E. McKenney <[email protected]>
Acked-by: Andrea Parri <[email protected]>
Acked-by: Akira Yokosawa <[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]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Fixes: bf28ae5 ("tools/memory-model: Remove rb-dep, smp_read_barrier_depends, and lockless_dereference")
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
AlanStern authored and Ingo Molnar committed Mar 10, 2018
1 parent ff1fe5e commit bd5c0ba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tools/memory-model/Documentation/cheatsheet.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Prior Operation Subsequent Operation
--------------- ---------------------------
C Self R W RWM Self R W DR DW RMW SV
__ ---- - - --- ---- - - -- -- --- --
-- ---- - - --- ---- - - -- -- --- --

Store, e.g., WRITE_ONCE() Y Y
Load, e.g., READ_ONCE() Y Y Y
Unsuccessful RMW operation Y Y Y
Load, e.g., READ_ONCE() Y Y Y Y
Unsuccessful RMW operation Y Y Y Y
rcu_dereference() Y Y Y Y
Successful *_acquire() R Y Y Y Y Y Y
Successful *_release() C Y Y Y W Y
Expand Down
4 changes: 2 additions & 2 deletions tools/memory-model/Documentation/explanation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ A-cumulative; they only affect the propagation of stores that are
executed on C before the fence (i.e., those which precede the fence in
program order).

read_lock(), rcu_read_unlock(), and synchronize_rcu() fences have
rcu_read_lock(), rcu_read_unlock(), and synchronize_rcu() fences have
other properties which we discuss later.


Expand Down Expand Up @@ -1138,7 +1138,7 @@ final effect is that even though the two loads really are executed in
program order, it appears that they aren't.

This could not have happened if the local cache had processed the
incoming stores in FIFO order. In constrast, other architectures
incoming stores in FIFO order. By contrast, other architectures
maintain at least the appearance of FIFO order.

In practice, this difficulty is solved by inserting a special fence
Expand Down
2 changes: 1 addition & 1 deletion tools/memory-model/linux-kernel.def
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ WRITE_ONCE(X,V) { __store{once}(X,V); }
smp_store_release(X,V) { __store{release}(*X,V); }
smp_load_acquire(X) __load{acquire}(*X)
rcu_assign_pointer(X,V) { __store{release}(X,V); }
rcu_dereference(X) __load{deref}(X)
rcu_dereference(X) __load{once}(X)

// Fences
smp_mb() { __fence{mb} ; }
Expand Down

0 comments on commit bd5c0ba

Please sign in to comment.