]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tools/memory-model: Legitimize current use of tags in LKMM macros
authorJonas Oberhauser <jonas.oberhauser@huaweicloud.com>
Mon, 30 Sep 2024 10:57:06 +0000 (12:57 +0200)
committerPaul E. McKenney <paulmck@kernel.org>
Thu, 20 Feb 2025 15:40:23 +0000 (07:40 -0800)
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>
tools/memory-model/linux-kernel.bell

index ce068700939c559edc8c91b9a931a0feae82e159..dba6b5b6dee01b6679b73e79930006de4a671f6f 100644 (file)
 enum Accesses = 'once (*READ_ONCE,WRITE_ONCE*) ||
                'release (*smp_store_release*) ||
                'acquire (*smp_load_acquire*) ||
-               'noreturn (* R of non-return RMW *)
-instructions R[{'once,'acquire,'noreturn}]
-instructions W[{'once,'release}]
-instructions RMW[{'once,'acquire,'release}]
+               'noreturn (* R of non-return RMW *) ||
+               'mb (*xchg(),cmpxchg(),...*)
+instructions R[Accesses]
+instructions W[Accesses]
+instructions RMW[Accesses]
 
 enum Barriers = 'wmb (*smp_wmb*) ||
                'rmb (*smp_rmb*) ||