[K/Unstable][SRU][PATCH 0/3] Fix test_bpf test on K-powerpc

Po-Hsu Lin po-hsu.lin at canonical.com
Wed Jan 4 11:43:28 UTC 2023


[Impact]
The BPF_AND, BPF_OR, BPF_XOR, BPF_FETCH, BPF_XCHG and BPF_CMPXCHG
related tests will fail in the net:test_bpf test from
ubuntu_kernel_selftests as they are not supported.

Partial test output:
  test_bpf: #361 BPF_ATOMIC | BPF_W, BPF_AND: Test: 0x12 & 0xab = 0x02
  eBPF filter atomic op code c3 (@3) unsupported
  FAIL to select_runtime err=-524
  ...
  test_bpf: #365 BPF_ATOMIC | BPF_W, BPF_AND | BPF_FETCH: Test: 0x12 & 0xab = 0x02
  eBPF filter atomic op code c3 (@3) unsupported
  FAIL to select_runtime err=-524
  ...
  test_bpf: #377 BPF_ATOMIC | BPF_W, BPF_OR: Test: 0x12 | 0xab = 0xbb FAIL to select_runtime err=-524
  ...
  test_bpf: #393 BPF_ATOMIC | BPF_W, BPF_XOR: Test: 0x12 ^ 0xab = 0xb9 FAIL to select_runtime err=-524
  ...
  test_bpf: #409 BPF_ATOMIC | BPF_W, BPF_XCHG: Test: 0x12 xchg 0xab = 0xab
  eBPF filter atomic op code c3 (@3) unsupported
  FAIL to select_runtime err=-524
  ...
  test_bpf: #417 BPF_ATOMIC | BPF_W, BPF_CMPXCHG: Test successful return
  eBPF filter atomic op code c3 (@3) unsupported
  FAIL to select_runtime err=-524
  ...
  test_bpf: Summary: 894 PASSED, 132 FAILED, [882/882 JIT'ed]

Please find attachment for the complete test log.

[Fix]
* 6511270911 powerpc/bpf/64: add support for BPF_ATOMIC bitwise operations
* dbe6e2456f powerpc/bpf/64: add support for atomic fetch operations
* 1e82dfaa78 powerpc/bpf/64: Add instructions for atomic_[cmp]xchg

These patches can be cherry-picked into Kinetic kernel.

[Test]
Test kernel can be found here:
https://people.canonical.com/~phlin/kernel/lp-2001618-ppcbpf/

Steps to reproduce:
1. Reboot with the patched kernel
2. Run:
  sudo dmesg -C
  sudo modprobe test_bpf
  sudo dmesg

Tested with a Power9 node "baltar", with the patched kernel there will
be no failure reported by the test_bpf:
  test_bpf: Summary: 1026 PASSED, 0 FAILED, [1014/1014 JIT'ed]

[Where problems could occur]
This patchset just broaden the BPF atomic operations support on ppc64,
we might see some new failures when using these instructions somewhere
in the future.

Hari Bathini (3):
  powerpc/bpf/64: add support for BPF_ATOMIC bitwise operations
  powerpc/bpf/64: add support for atomic fetch operations
  powerpc/bpf/64: Add instructions for atomic_[cmp]xchg

 arch/powerpc/net/bpf_jit_comp64.c | 96 ++++++++++++++++++++++++++++-----------
 1 file changed, 69 insertions(+), 27 deletions(-)

-- 
2.7.4




More information about the kernel-team mailing list