BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Paul Chaignon" <paul.chaignon@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 2/2] selftests/bpf: Test insns processed breakdown
Date: Wed, 29 Apr 2026 02:36:22 +0000	[thread overview]
Message-ID: <20260429023623.73482C2BCB7@smtp.kernel.org> (raw)
In-Reply-To: <24f2a5b5f8e3041d03d78305ca0e2277f684d588.1777398528.git.paul.chaignon@gmail.com>

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 <paul.chaignon@gmail.com>

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.

[ ... ]

> @@ -321,14 +331,15 @@ int BPF_PROG(arg_tag_ctx_fexit)
>  }
>  
>  SEC("?fmod_ret/" SYS_PREFIX "sys_nanosleep")
> -__success __log_level(2)
> +__success __log_level(6)
> +__msg("insns processed 7+2+2")
>  int BPF_PROG(arg_tag_ctx_fmod_ret)
>  {
>  	return tracing_subprog_void(ctx) + tracing_subprog_u64(ctx);
>  }
>  
>  SEC("?lsm/bpf")
> -__success __log_level(2)
> +__success __log_level(6)
>  int BPF_PROG(arg_tag_ctx_lsm)
>  {
>  	int ret;

Is the log level increase to 6 intentional for arg_tag_ctx_lsm and other
similar tests in this patch (like anon_user_mem_valid and arg_tag_dynptr)?

These tests don't appear to have corresponding __msg assertions added to
actually verify the resulting stats breakdown, which might just add
unnecessary overhead and log data to the test execution.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/5c3514dbc879f22ba3f9eff8a2c730e13bd0572c.1777398528.git.paul.chaignon@gmail.com?part=2

  reply	other threads:[~2026-04-29  2:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 21:39 [PATCH bpf-next v2 1/2] bpf: Print breakdown of insns processed by subprogs Paul Chaignon
2026-04-28 21:40 ` [PATCH bpf-next v2 2/2] selftests/bpf: Test insns processed breakdown Paul Chaignon
2026-04-29  2:36   ` sashiko-bot [this message]
2026-04-29  9:30     ` Alexei Starovoitov
2026-04-29  2:26 ` [PATCH bpf-next v2 1/2] bpf: Print breakdown of insns processed by subprogs sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260429023623.73482C2BCB7@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=paul.chaignon@gmail.com \
    --cc=sashiko@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox