Skip to content

Commit d2c470c

Browse files
committed
Documentation/litmus-tests: Add locking tests to README
This commit documents the litmus tests in the "locking" directory. [ paulmck: Apply formatting feedback from Andrea Parri. ] Signed-off-by: Paul E. McKenney <[email protected]> Cc: Alan Stern <[email protected]> Cc: Will Deacon <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Boqun Feng <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: David Howells <[email protected]> Cc: Jade Alglave <[email protected]> Cc: Luc Maranget <[email protected]> Cc: "Paul E. McKenney" <[email protected]> Cc: Akira Yokosawa <[email protected]> Cc: Daniel Lustig <[email protected]> Cc: Joel Fernandes <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: <[email protected]> Cc: <[email protected]> Acked-by: Andrea Parri <[email protected]>
1 parent 39cd87c commit d2c470c

File tree

1 file changed

+29
-0
lines changed
  • Documentation/litmus-tests

1 file changed

+29
-0
lines changed

Documentation/litmus-tests/README

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,35 @@ Atomic-RMW-ops-are-atomic-WRT-atomic_set.litmus
2222
NOTE: Require herd7 7.56 or later which supports "(void)expr".
2323

2424

25+
locking (/locking directory)
26+
----------------------------
27+
28+
DCL-broken.litmus
29+
Demonstrates that double-checked locking needs more than just
30+
the obvious lock acquisitions and releases.
31+
32+
DCL-fixed.litmus
33+
Demonstrates corrected double-checked locking that uses
34+
smp_store_release() and smp_load_acquire() in addition to the
35+
obvious lock acquisitions and releases.
36+
37+
RM-broken.litmus
38+
Demonstrates problems with "roach motel" locking, where code is
39+
freely moved into lock-based critical sections. This example also
40+
shows how to use the "filter" clause to discard executions that
41+
would be excluded by other code not modeled in the litmus test.
42+
Note also that this "roach motel" optimization is emulated by
43+
physically moving P1()'s two reads from x under the lock.
44+
45+
What is a roach motel? This is from an old advertisement for
46+
a cockroach trap, much later featured in one of the "Men in
47+
Black" movies. "The roaches check in. They don't check out."
48+
49+
RM-fixed.litmus
50+
The counterpart to RM-broken.litmus, showing P0()'s two loads from
51+
x safely outside of the critical section.
52+
53+
2554
RCU (/rcu directory)
2655
--------------------
2756

0 commit comments

Comments
 (0)