diff options
| author | Peilin Ye <yepeilin@google.com> | 2025-03-04 04:06:33 +0300 | 
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2025-03-15 21:48:29 +0300 | 
| commit | 9bb12368d539d40457af593bc1b6b380430cc9d7 (patch) | |
| tree | c9669b5f884934cee237c1e9b5baea70c7d7d1a2 /tools/perf/scripts/python/sctop.py | |
| parent | 956856dd118bf055e562681700a1f8768bba5258 (diff) | |
| download | linux-9bb12368d539d40457af593bc1b6b380430cc9d7.tar.xz | |
bpf, arm64: Support load-acquire and store-release instructions
Support BPF load-acquire (BPF_LOAD_ACQ) and store-release
(BPF_STORE_REL) instructions in the arm64 JIT compiler.  For example
(assuming little-endian):
  db 10 00 00 00 01 00 00  r0 = load_acquire((u64 *)(r1 + 0x0))
  95 00 00 00 00 00 00 00  exit
  opcode (0xdb): BPF_ATOMIC | BPF_DW | BPF_STX
  imm (0x00000100): BPF_LOAD_ACQ
The JIT compiler would emit an LDAR instruction for the above, e.g.:
  ldar  x7, [x0]
Similarly, consider the following 16-bit store-release:
  cb 21 00 00 10 01 00 00  store_release((u16 *)(r1 + 0x0), w2)
  95 00 00 00 00 00 00 00  exit
  opcode (0xcb): BPF_ATOMIC | BPF_H | BPF_STX
  imm (0x00000110): BPF_STORE_REL
An STLRH instruction would be emitted, e.g.:
  stlrh  w1, [x0]
For a complete mapping:
  load-acquire     8-bit  LDARB
 (BPF_LOAD_ACQ)   16-bit  LDARH
                  32-bit  LDAR (32-bit)
                  64-bit  LDAR (64-bit)
  store-release    8-bit  STLRB
 (BPF_STORE_REL)  16-bit  STLRH
                  32-bit  STLR (32-bit)
                  64-bit  STLR (64-bit)
Arena accesses are supported.
bpf_jit_supports_insn(..., /*in_arena=*/true) always returns true for
BPF_LOAD_ACQ and BPF_STORE_REL instructions, as they don't depend on
ARM64_HAS_LSE_ATOMICS.
Acked-by: Xu Kuohai <xukuohai@huawei.com>
Signed-off-by: Peilin Ye <yepeilin@google.com>
Link: https://lore.kernel.org/r/51664a1300710238ba2d4d95142b57a52c4f0cae.1741049567.git.yepeilin@google.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/sctop.py')
0 files changed, 0 insertions, 0 deletions
