Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <jonas.oberhauser@huaweicloud.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Tested-by: Boqun Feng <boqun.feng@gmail.com>

authored by

Jonas Oberhauser and committed by
Paul E. McKenney
de6f9972 e176ebff

+5 -4
+5 -4
tools/memory-model/linux-kernel.bell
··· 16 16 enum Accesses = 'once (*READ_ONCE,WRITE_ONCE*) || 17 17 'release (*smp_store_release*) || 18 18 '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] 23 24 24 25 enum Barriers = 'wmb (*smp_wmb*) || 25 26 'rmb (*smp_rmb*) ||