diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2018-07-16 14:05:52 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2018-07-17 03:29:29 -0400 |
commit | b464818978d45cd4d78c8f13207891142c68bea9 (patch) | |
tree | 5749db3d8c9387f9698fdbb6ef67aa6b9546f6ee /tools/memory-model | |
parent | 52b544bd386688177c41d53e748111c29d0ccc98 (diff) |
tools/memory-model: Add litmus test for full multicopy atomicity
This commit adds a litmus test suggested by Alan Stern that is forbidden
on fully multicopy atomic systems, but allowed on other-multicopy and
on non-multicopy atomic systems. For reference, s390 is fully multicopy
atomic, x86 and ARMv8 are other-multicopy atomic, and ARMv7 and powerpc
are non-multicopy atomic.
Suggested-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Andrea Parri <andrea.parri@amarulasolutions.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: akiyks@gmail.com
Cc: boqun.feng@gmail.com
Cc: dhowells@redhat.com
Cc: j.alglave@ucl.ac.uk
Cc: linux-arch@vger.kernel.org
Cc: luc.maranget@inria.fr
Cc: npiggin@gmail.com
Cc: parri.andrea@gmail.com
Cc: will.deacon@arm.com
Link: http://lkml.kernel.org/r/20180716180605.16115-1-paulmck@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/memory-model')
-rw-r--r-- | tools/memory-model/litmus-tests/README | 9 | ||||
-rw-r--r-- | tools/memory-model/litmus-tests/SB+rfionceonce-poonceonces.litmus | 32 |
2 files changed, 41 insertions, 0 deletions
diff --git a/tools/memory-model/litmus-tests/README b/tools/memory-model/litmus-tests/README index 17eb9a8c222d..00140aaf58b7 100644 --- a/tools/memory-model/litmus-tests/README +++ b/tools/memory-model/litmus-tests/README | |||
@@ -111,6 +111,15 @@ SB+mbonceonces.litmus | |||
111 | SB+poonceonces.litmus | 111 | SB+poonceonces.litmus |
112 | As above, but without the smp_mb() invocations. | 112 | As above, but without the smp_mb() invocations. |
113 | 113 | ||
114 | SB+rfionceonce-poonceonces.litmus | ||
115 | This litmus test demonstrates that LKMM is not fully multicopy | ||
116 | atomic. (Neither is it other multicopy atomic.) This litmus test | ||
117 | also demonstrates the "locations" debugging aid, which designates | ||
118 | additional registers and locations to be printed out in the dump | ||
119 | of final states in the herd7 output. Without the "locations" | ||
120 | statement, only those registers and locations mentioned in the | ||
121 | "exists" clause will be printed. | ||
122 | |||
114 | S+poonceonces.litmus | 123 | S+poonceonces.litmus |
115 | As below, but without the smp_wmb() and acquire load. | 124 | As below, but without the smp_wmb() and acquire load. |
116 | 125 | ||
diff --git a/tools/memory-model/litmus-tests/SB+rfionceonce-poonceonces.litmus b/tools/memory-model/litmus-tests/SB+rfionceonce-poonceonces.litmus new file mode 100644 index 000000000000..04a16603660b --- /dev/null +++ b/tools/memory-model/litmus-tests/SB+rfionceonce-poonceonces.litmus | |||
@@ -0,0 +1,32 @@ | |||
1 | C SB+rfionceonce-poonceonces | ||
2 | |||
3 | (* | ||
4 | * Result: Sometimes | ||
5 | * | ||
6 | * This litmus test demonstrates that LKMM is not fully multicopy atomic. | ||
7 | *) | ||
8 | |||
9 | {} | ||
10 | |||
11 | P0(int *x, int *y) | ||
12 | { | ||
13 | int r1; | ||
14 | int r2; | ||
15 | |||
16 | WRITE_ONCE(*x, 1); | ||
17 | r1 = READ_ONCE(*x); | ||
18 | r2 = READ_ONCE(*y); | ||
19 | } | ||
20 | |||
21 | P1(int *x, int *y) | ||
22 | { | ||
23 | int r3; | ||
24 | int r4; | ||
25 | |||
26 | WRITE_ONCE(*y, 1); | ||
27 | r3 = READ_ONCE(*y); | ||
28 | r4 = READ_ONCE(*x); | ||
29 | } | ||
30 | |||
31 | locations [0:r1; 1:r3; x; y] (* Debug aid: Print things not in "exists". *) | ||
32 | exists (0:r2=0 /\ 1:r4=0) | ||