selftests/xsk: replace asm acquire/release implementations
authorMagnus Karlsson <magnus.karlsson@intel.com>
Wed, 11 Jan 2023 09:35:18 +0000 (10:35 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 12 Jan 2023 02:16:52 +0000 (18:16 -0800)
commitefe620e5ba03330a71a85b40e68ee1b497c789ed
tree0eb84622040b28542f184f72bd08e0b5ac4d1b91
parent703bfd37101310ad5a6be09d5ff38c0e949ee8db
selftests/xsk: replace asm acquire/release implementations

Replace our own homegrown assembly store/release and load/acquire
implementations with the HW agnositic atomic APIs C11 offers. This to
make the code more portable, easier to read, and reduce the
maintenance burden.

The original code used load-acquire and store-release barriers
hand-coded in assembly. Since C11, these kind of operations are
offered as built-ins in gcc and llvm. The load-acquire operation
prevents hoisting of non-atomic memory operations to before this
operation and it corresponds to the __ATOMIC_ACQUIRE operation in the
built-in atomics. The store-release operation prevents hoisting of
non-atomic memory operations to after this operation and it
corresponds to the __ATOMIC_RELEASE operation in the built-in atomics.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://lore.kernel.org/r/20230111093526.11682-8-magnus.karlsson@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/xsk.h