Skip to content

selftests/bpf: unblock bpf-gcc test coverage

Vineet Gupta bpf sashiko-reviews 2 versions – Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 1 replyApplied 3/3
  2. v13 patches 5 repliesSuperseded

Changes in v2 from the cover letter

- 1/3: Nothing functional just Eduard's Ack.

- 2/3: convert the two feature-gated placeholders that were missed. Spotted by the BPF CI AI reviewer.

- 3/3: Fix comment to kernel-style, not netdev (Sashiko review).

- Eduard's Acked-by carried over from v1. Note 2/3 grew two more placeholder conversions after he acked it.

Patches in v2 All 3 applied

#Subject and filesSizeRepliesApplied
1/3selftests/bpf: name the remaining placeholder programs dummy_test [NFC]tools/testing/selftests/bpf/progs/arena_kfunc.c tools/testing/selftests/bpf/progs/stack_arg_fail.c+2 -20 repliesApplied
2/3selftests/bpf: report placeholder tests as SKIP, not OKtools/testing/selftests/bpf/progs/arena_kfunc.c tools/testing/selftests/bpf/progs/bpf_misc.h tools/testing/selftests/bpf/progs/stack_arg_fail.c +14 more+30 -00 repliesApplied
3/3selftests/bpf: Enable some of the blocked cpuv4 instruction tests for bpf-gcctools/testing/selftests/bpf/progs/bpf_misc.h tools/testing/selftests/bpf/progs/compute_live_registers.c tools/testing/selftests/bpf/progs/verifier_bswap.c +3 more+24 -121 replyApplied

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchEduard Zingerman
1/3A-b
2/3A-b
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH bpf-next v2 0/3] selftests/bpf: unblock bpf-gcc test coverage

When doing some unrelated testing, stumbled upon this. A lot of tests are skipped under BPF_GCC due to clang only gate. On top, the test harness declares them passing/OK.

Patch 1 renames a few placeholders a consistent dummy_test name [NFC].

A sample test with BPF_GCC used to say:

| #587/1 verifier_bswap/cpuv4 is not supported by compiler or jit, use a dummy test:OK
| #587 verifier_bswap:OK

Patch 2 adds a __skip("reason") annotation so a compile-time gated file reports SKIP rather than OK, making these gaps visible in test_progs output.

Now the output changes to

| #587/1 verifier_bswap/cpuv4 is not supported by compiler or jit, use a dummy test:SKIP
| #587 verifier_bswap:SKIP

Patch 3 augments the clang only gate with a per-feature gate supported by both the compilers. FWIW the clang half has to stay: clang only defines __BPF_FEATURE_MOVSX and friends at -mcpu=v4 but assembles the inline asm at -mcpu=v3 too, so dropping it would remove these tests from the default test_progs flavour where they run today.

And finally the output now is

| #587/1 verifier_bswap/BSWAP, 16:OK
| #587/2 verifier_bswap/BSWAP, 16 @unpriv:SKIP
| #587/3 verifier_bswap/BSWAP, 32:OK
| #587/4 verifier_bswap/BSWAP, 32 @unpriv:SKIP
| #587/5 verifier_bswap/BSWAP, 64:OK
| #587/6 verifier_bswap/BSWAP, 64 @unpriv:SKIP
| #587/7 verifier_bswap/bswap16_range:OK
| #587/8 verifier_bswap/bswap32_range:OK
| #587/9 verifier_bswap/bswap64_range:OK
| #587/10 verifier_bswap/be16_range:OK
| #587/11 verifier_bswap/be32_range:OK
| #587/12 verifier_bswap/be64_range:OK
| #587/13 verifier_bswap/le16_range:OK
| #587/14 verifier_bswap/le32_range:OK
| #587/15 verifier_bswap/le64_range:OK
| #587/16 verifier_bswap/BSWAP, reset reg id:OK
| #587	 verifier_bswap:OK (SKIP: 3/16)

Programs per object recovered under BPF_GCC, 124 in total:

  verifier_sdiv                  1 -> 80
  verifier_movsx                 1 -> 17
  verifier_ldsx                  1 -> 14
  verifier_bswap                 1 -> 13

compute_live_registers 17 -> 19
verifier_gotol 1 -> 2
verifier_iterating_callbacks 34 -> 35

Two things stay clang-only on purpose: the arena tests using addr_space_cast, and verifier_load_acquire/verifier_store_release. gas implements neither.

The increased coverage bore fruits right away as I stumbled into a gas
bug: PR gas/34558. Fix is posted however workaround is needed for the time being.

Built for x86_64 with both clang and bpf-gcc; the per-object counts above were read back from the generated objects.

Changes since v1:

- 1/3: Nothing functional just Eduard's Ack.

- 2/3: convert the two feature-gated placeholders that were missed. Spotted by the BPF CI AI reviewer.

- 3/3: Fix comment to kernel-style, not netdev (Sashiko review).

- Eduard's Acked-by carried over from v1. Note 2/3 grew two more placeholder conversions after he acked it.

v1:
https://lore.kernel.org/bpf/[email protected]/

Vineet Gupta (3):
selftests/bpf: name the remaining placeholder programs dummy_test

    [NFC]

selftests/bpf: report placeholder tests as SKIP, not OK selftests/bpf: Enable some of the blocked cpuv4 instruction tests for
bpf-gcc

 .../testing/selftests/bpf/progs/arena_kfunc.c |  3 ++-
 tools/testing/selftests/bpf/progs/bpf_misc.h  | 10 ++++++++--
 .../bpf/progs/compute_live_registers.c        |  8 ++++++++
 .../selftests/bpf/progs/stack_arg_fail.c      |  3 ++-
 .../selftests/bpf/progs/stack_arg_precision.c |  1 +
 .../bpf/progs/verifier_aggregate_ret.c        |  1 +
 .../selftests/bpf/progs/verifier_bswap.c      |  3 ++-
 .../selftests/bpf/progs/verifier_gotol.c      |  1 +
 .../selftests/bpf/progs/verifier_ldsx.c       | 19 ++++++++++++-------
 .../bpf/progs/verifier_load_acquire.c         |  1 +
 .../selftests/bpf/progs/verifier_movsx.c      |  3 ++-
 .../bpf/progs/verifier_percpu_addr.c          |  1 +
 .../bpf/progs/verifier_private_stack.c        |  1 +
 .../selftests/bpf/progs/verifier_sdiv.c       |  3 ++-
 .../selftests/bpf/progs/verifier_stack_arg.c  |  1 +
 .../bpf/progs/verifier_stack_arg_order.c      |  1 +
 .../bpf/progs/verifier_store_release.c        |  1 +
 tools/testing/selftests/bpf/test_loader.c     |  9 +++++++++
 18 files changed, 56 insertions(+), 14 deletions(-)
Signature · 1 line
2.53.0-Meta