mbox series

[bpf-next,0/2] arm64, bpf: support more atomic ops

Message ID 20220121135632.136976-1-houtao1@huawei.com (mailing list archive)
Headers show
Series arm64, bpf: support more atomic ops | expand

Message

Hou Tao Jan. 21, 2022, 1:56 p.m. UTC
Hi,

Atomics support in bpf has already been done by "Atomics for eBPF"
patch series [1], but it only adds support for x86, and this patchset
adds support for arm64.

Patch #1 changes the type of test program from fentry/ to raw_tp/ for
atomics test, because bpf trampoline is not available for arm64 now.
After the change, atomics test will be available for arm64 and other
arches.

Patch #2 implements atomic[64]_fetch_add, atomic[64]_[fetch_]{and,or,xor}
and atomic[64]_{xchg|cmpxchg} for arm64. For no-LSE-ATOMICS case and
cpus_have_cap(ARM64_HAS_LSE_ATOMICS) case, both ./test_verifier and
"./test_progs -t atomic" are exercised and passed correspondingly.

Comments are always welcome.

Regards,
Tao

Hou Tao (2):
  selftests/bpf: use raw_tp program for atomic test
  arm64, bpf: support more atomic operations

 arch/arm64/include/asm/insn.h                 |  45 +++-
 arch/arm64/lib/insn.c                         | 155 +++++++++++--
 arch/arm64/net/bpf_jit.h                      |  43 +++-
 arch/arm64/net/bpf_jit_comp.c                 | 216 ++++++++++++++----
 .../selftests/bpf/prog_tests/atomics.c        | 114 +++------
 tools/testing/selftests/bpf/progs/atomics.c   |  29 +--
 6 files changed, 438 insertions(+), 164 deletions(-)