BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Eduard Zingerman" <eddyz87@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH RFC bpf-next 3/6] selftests/bpf: test cases for loop hierarchy computation
Date: Tue, 26 May 2026 10:25:14 +0000	[thread overview]
Message-ID: <20260526102514.AFE3C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260526-better-1m-reporting-v1-3-51e4f2c59780@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The expected verifier log output in `fwd_edges_no_loop` incorrectly expects an unconditional jump `(05)` for a conditional jump instruction, which will cause the selftest to fail.
--

commit f35c2f4d237eac02dd241fbf85f69d40722f62de
Author: Eduard Zingerman <eddyz87@gmail.com>

selftests/bpf: test cases for loop hierarchy computation

This commit adds test cases covering various branches in bpf_compute_loops
for loop hierarchy computation. It includes tests for single bounded loops,
independent loops, nested loops, diamond control flow graphs, and irreducible
loops.

> diff --git a/tools/testing/selftests/bpf/progs/verifier_loop_hierarchy.c b/tools/testing/selftests/bpf/progs/verifier_loop_hierarchy.c
> new file mode 100644
> index 0000000000000..db26157e3e14a
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/verifier_loop_hierarchy.c

[ ... ]

> +/* Case C: forward edges, no loops. */
> +SEC("socket")
> +__success
> +__log_level(2)
> +__msg("          0: {{.*}} (b7) r0 = 1")
> +__msg("          1: {{.*}} (05) goto pc+2")

[Severity: Medium]
Will this test case fail because of a mismatch in the expected verifier log?

The inline assembly below uses "if r0 > 0 goto 1f;", which is a conditional
jump. This translates to opcode 0x25 (if r0 > 0x0 goto pc+2), but the __msg
assertion explicitly expects opcode 0x05 (goto pc+2), which is an
unconditional jump.

> +__msg("          2: {{.*}} (b7) r0 = 2")
> +__msg("          3: {{.*}} (05) goto pc+1")
> +__msg("          4: {{.*}} (b7) r0 = 3")
> +__msg("          5: {{.*}} (95) exit")
> +__naked void fwd_edges_no_loop(void)
> +{
> +	asm volatile ("					\
> +	r0 = 1;						\
> +	if r0 > 0 goto 1f;				\
> +	r0 = 2;						\
> +	goto 2f;					\
> +1:	r0 = 3;						\
> +2:	exit;						\
> +"	::: __clobber_all);
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260526-better-1m-reporting-v1-0-51e4f2c59780@gmail.com?part=3

  reply	other threads:[~2026-05-26 10:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26  9:30 [PATCH RFC bpf-next 0/6] bpf: better error reporting when verifier hits 1M instructions limit Eduard Zingerman
2026-05-26  9:30 ` [PATCH RFC bpf-next 1/6] bpf: move live registers and scc printout to a standalone function Eduard Zingerman
2026-05-26  9:30 ` [PATCH RFC bpf-next 2/6] bpf: compute loops hierarchy Eduard Zingerman
2026-05-26 10:05   ` bot+bpf-ci
2026-05-26 11:18     ` Eduard Zingerman
2026-05-26 10:07   ` sashiko-bot
2026-05-26  9:30 ` [PATCH RFC bpf-next 3/6] selftests/bpf: test cases for loop hierarchy computation Eduard Zingerman
2026-05-26 10:25   ` sashiko-bot [this message]
2026-05-26 11:22     ` Eduard Zingerman
2026-05-26  9:30 ` [PATCH RFC bpf-next 4/6] bpf: report hot simulated callchains when 1M instructions limit is met Eduard Zingerman
2026-05-26 10:05   ` bot+bpf-ci
2026-05-26 11:24     ` Eduard Zingerman
2026-05-26 10:45   ` sashiko-bot
2026-05-26 11:31     ` Eduard Zingerman
2026-05-26  9:30 ` [PATCH RFC bpf-next 5/6] bpf: report register diff summary for hot callchains Eduard Zingerman
2026-05-26 10:05   ` bot+bpf-ci
2026-05-26 11:11   ` sashiko-bot
2026-05-26 11:36     ` Eduard Zingerman
2026-05-26  9:30 ` [PATCH RFC bpf-next 6/6] selftests/bpf: test budget exhaustion profiling report Eduard Zingerman

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=20260526102514.AFE3C1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=sashiko-reviews@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