diff options
| author | Puranjay Mohan <[email protected]> | 2025-07-10 17:54:33 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2025-07-17 01:38:52 +0000 |
| commit | 0769857a07b4451a1dc1c3ad1f1c86a6f4ce136a (patch) | |
| tree | 0c502e343a2ea1a8309ac4212c5ac7d7c36bb049 /lib/crypto/mpi/mpi-sub-ui.c | |
| parent | bpf/selftests: Add selftests for token info (diff) | |
| download | kernel-0769857a07b4451a1dc1c3ad1f1c86a6f4ce136a.tar.gz kernel-0769857a07b4451a1dc1c3ad1f1c86a6f4ce136a.zip | |
selftests/bpf: fix implementation of smp_mb()
As BPF doesn't include any barrier instructions, smp_mb() is implemented
by doing a dummy value returning atomic operation. Such an operation
acts a full barrier as enforced by LKMM and also by the work in progress
BPF memory model.
If the returned value is not used, clang[1] can optimize the value
returning atomic instruction in to a normal atomic instruction which
provides no ordering guarantees.
Mark the variable as volatile so the above optimization is never
performed and smp_mb() works as expected.
[1] https://godbolt.org/z/qzze7bG6z
Fixes: 88d706ba7cc5 ("selftests/bpf: Introduce arena spin lock")
Signed-off-by: Puranjay Mohan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'lib/crypto/mpi/mpi-sub-ui.c')
0 files changed, 0 insertions, 0 deletions
