Skip to content

Commit de6f997

Browse files
Jonas Oberhauserpaulmckrcu
authored andcommitted
tools/memory-model: Legitimize current use of tags in LKMM macros
The current macros in linux-kernel.def reference instructions such as __xchg{mb} or __cmpxchg{acquire}, which are invalid combinations of tags and instructions according to the declarations in linux-kernel.bell. This works with current herd7 because herd7 removes these tags anyways and does not actually enforce validity of combinations at all. If a future herd7 version no longer applies these hardcoded transformations, then all currently invalid combinations will actually appear on some instruction. We therefore adjust the declarations to make the resulting combinations valid, by adding the 'mb tag to the set of Accesses and allowing all Accesses to appear on all read, write, and RMW instructions. Signed-off-by: Jonas Oberhauser <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Tested-by: Boqun Feng <[email protected]>
1 parent e176ebf commit de6f997

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tools/memory-model/linux-kernel.bell

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
enum Accesses = 'once (*READ_ONCE,WRITE_ONCE*) ||
1717
'release (*smp_store_release*) ||
1818
'acquire (*smp_load_acquire*) ||
19-
'noreturn (* R of non-return RMW *)
20-
instructions R[{'once,'acquire,'noreturn}]
21-
instructions W[{'once,'release}]
22-
instructions RMW[{'once,'acquire,'release}]
19+
'noreturn (* R of non-return RMW *) ||
20+
'mb (*xchg(),cmpxchg(),...*)
21+
instructions R[Accesses]
22+
instructions W[Accesses]
23+
instructions RMW[Accesses]
2324

2425
enum Barriers = 'wmb (*smp_wmb*) ||
2526
'rmb (*smp_rmb*) ||

0 commit comments

Comments
 (0)