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 2/2] selftests/bpf: Test insns processed breakdown
Date: Tue, 28 Apr 2026 23:14:31 +0000	[thread overview]
Message-ID: <20260428231432.777B7C2BCAF@smtp.kernel.org> (raw)
In-Reply-To: <30df9a4d569143e1d23a7c7aefd7dca85a21e2c8.1777388107.git.paul.chaignon@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Asserting exact compiler-generated instruction counts in BPF C selftests makes them extremely brittle across LLVM/Clang updates.
--

commit a64551619d1c16e765011f494b0528e642a29308
Author: Paul Chaignon <paul.chaignon@gmail.com>

selftests/bpf: Test insns processed breakdown

This patch updates the BPF global subprog selftests to check the new verifier
log breakdown of processed instructions by adding __msg() assertions with exact
instruction counts.

> diff --git a/tools/testing/selftests/bpf/progs/verifier_global_subprogs.c b/tools/testing/selftests/bpf/progs/verifier_global_subprogs.c
> index 1e08aff7532e..58faf5485667 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_global_subprogs.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_global_subprogs.c
> @@ -46,12 +46,13 @@ __noinline long global_dead(void)
>  }
>  
>  SEC("?raw_tp")
> -__success __log_level(2)
> +__success __log_level(6)
>  /* main prog is validated completely first */
>  __msg("('global_calls_good_only') is global and assumed valid.")
>  /* eventually global_good() is transitively validated as well */
>  __msg("Validating global_good() func")
>  __msg("('global_good') is safe for any args that match its prototype")
> +__msg("insns processed 7+2+5")

Will these exact instruction counts make the tests brittle across different
LLVM/Clang versions?

Because C code compilation is highly sensitive to compiler versions, changes in
optimizations or register allocation will alter the number of emitted BPF
instructions. This could cause the selftests to fail unpredictably across
different local environments or when the CI compiler is updated.

Could the __regex macro be used here instead to verify the expected verifier
log format? For example, using __regex("insns processed [0-9]+(\\+[0-9]+)+")
would validate the breakdown output without relying on exact counts.

[ ... ]

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

  parent reply	other threads:[~2026-04-28 23:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 14:55 [PATCH bpf-next 1/2] bpf: Print breakdown of insns processed by subprogs Paul Chaignon
2026-04-28 14:55 ` [PATCH bpf-next 2/2] selftests/bpf: Test insns processed breakdown Paul Chaignon
2026-04-28 16:18   ` Kumar Kartikeya Dwivedi
2026-04-28 23:14   ` sashiko-bot [this message]
2026-04-28 23:08 ` [PATCH bpf-next 1/2] bpf: Print breakdown of insns processed by subprogs sashiko-bot
2026-04-28 23:55   ` Kumar Kartikeya Dwivedi
2026-04-29  0:07     ` Kumar Kartikeya Dwivedi
2026-04-29 14:01       ` Paul Chaignon
2026-04-29 15:53         ` Paul Chaignon
2026-04-29 22:17           ` Kumar Kartikeya Dwivedi

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=20260428231432.777B7C2BCAF@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