Re: [PATCH bpf-next v2 2/2] selftests/bpf: Test insns processed breakdown
"Alexei Starovoitov" <[email protected]>
| Newsgroups | dev.linux.lists.sashiko,org.kernel.vger.bpf |
|---|---|
| Message-ID | <[email protected]> |
On Tue Apr 28, 2026 at 7:36 PM PDT, sashiko-bot wrote: > Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: > - [Medium] Asserting exact verifier instruction counts in C-based BPF selftests causes test flakiness. > - [Low] Unused test configuration from blindly elevating log levels to 6 without corresponding assertions. > -- > > commit c4e03a953efa7cd8cf2e1a288a0c55c4f73cace2 > Author: Paul Chaignon <[email protected]> > > selftests/bpf: Test insns processed breakdown > > This patch updates global subprog selftests to verify the new verifier > log breakdown of instructions processed by global subprogs. It does this > by increasing log levels and adding new message assertions. > >> diff --git a/tools/testing/selftests/bpf/progs/verifier_global_subprogs.c b/tools/testing/selftests/bpf/progs/verifier_global_subprogs.c >> index 1e08aff7532e..7092a046c018 100644 >> --- a/tools/testing/selftests/bpf/progs/verifier_global_subprogs.c >> +++ b/tools/testing/selftests/bpf/progs/verifier_global_subprogs.c > > [ ... ] > >> @@ -186,21 +187,24 @@ __weak int raw_tp_u64_array(u64 *ctx __arg_ctx) >> } >> >> SEC("?raw_tp") >> -__success __log_level(2) >> +__success __log_level(6) >> +__msg("insns processed 12+5+2+2") >> int arg_tag_ctx_raw_tp(void *ctx) > > Will hardcoding exact instruction counts cause the tests to become flaky across > different LLVM/Clang versions or optimization levels? > > Since test_loader.c natively supports regex matching within __msg using the > {{...}} syntax, would it be more reliable to use a pattern to validate the > log format? > > For example, __msg("insns processed {{[0-9]+(\+[0-9]+)*}}") might prevent > failures when the compiler generates slightly different assembly. I have to agree with sashk here. It's way too many tests with hard coded insn counts. Just one test with above regex is plenty. pw-bot: cr