Skip to content

Commit bd5c0ba

Browse files
AlanSternIngo Molnar
authored andcommitted
tools/memory-model: Finish the removal of rb-dep, smp_read_barrier_depends(), 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]>
1 parent ff1fe5e commit bd5c0ba

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

tools/memory-model/Documentation/cheatsheet.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Prior Operation Subsequent Operation
22
--------------- ---------------------------
33
C Self R W RWM Self R W DR DW RMW SV
4-
__ ---- - - --- ---- - - -- -- --- --
4+
-- ---- - - --- ---- - - -- -- --- --
55

66
Store, e.g., WRITE_ONCE() Y Y
7-
Load, e.g., READ_ONCE() Y Y Y
8-
Unsuccessful RMW operation Y Y Y
7+
Load, e.g., READ_ONCE() Y Y Y Y
8+
Unsuccessful RMW operation Y Y Y Y
99
rcu_dereference() Y Y Y Y
1010
Successful *_acquire() R Y Y Y Y Y Y
1111
Successful *_release() C Y Y Y W Y

tools/memory-model/Documentation/explanation.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ A-cumulative; they only affect the propagation of stores that are
826826
executed on C before the fence (i.e., those which precede the fence in
827827
program order).
828828

829-
read_lock(), rcu_read_unlock(), and synchronize_rcu() fences have
829+
rcu_read_lock(), rcu_read_unlock(), and synchronize_rcu() fences have
830830
other properties which we discuss later.
831831

832832

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

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

11441144
In practice, this difficulty is solved by inserting a special fence

tools/memory-model/linux-kernel.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ WRITE_ONCE(X,V) { __store{once}(X,V); }
1313
smp_store_release(X,V) { __store{release}(*X,V); }
1414
smp_load_acquire(X) __load{acquire}(*X)
1515
rcu_assign_pointer(X,V) { __store{release}(X,V); }
16-
rcu_dereference(X) __load{deref}(X)
16+
rcu_dereference(X) __load{once}(X)
1717

1818
// Fences
1919
smp_mb() { __fence{mb} ; }

0 commit comments

Comments
 (0)