BPF List
 help / color / mirror / Atom feed
From: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>
To: <bot+bpf-ci@kernel.org>, <bpf@vger.kernel.org>
Cc: <andrii@kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>,
	<eddyz87@gmail.com>, <emil@etsalapatis.com>, <kkd@meta.com>,
	<kernel-team@meta.com>, <martin.lau@kernel.org>,
	<yonghong.song@linux.dev>, <clm@meta.com>,
	<ihor.solodrai@linux.dev>
Subject: Re: [PATCH bpf-next v2 1/3] bpf: Show more useful info in stack depth stats
Date: Mon, 03 Aug 2026 02:40:26 +0200	[thread overview]
Message-ID: <DKEW2GPED8SX.1WM65Z05MZN7G@gmail.com> (raw)
In-Reply-To: <02a0523b31767a3994eb6a379dfdc83217749f99f89ebc71a4aaa0d6940f45c5@mail.kernel.org>

On Mon Aug 3, 2026 at 2:21 AM CEST, bot+bpf-ci wrote:
>> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
>> index b274004fccfd9..3b61897ed0d2a 100644
>> --- a/kernel/bpf/verifier.c
>> +++ b/kernel/bpf/verifier.c
>> @@ -18777,10 +18777,15 @@ static void print_verification_stats(struct bpf_verifier_env *env)
>>  	if (env->log.level & BPF_LOG_STATS) {
>>  		verbose(env, "verification time %lld usec\n",
>>  			div_u64(env->verification_time, 1000));
>> -		verbose(env, "stack depth %d", env->subprog_info[0].stack_depth);
>> -		for (i = 1; i < subprog_cnt; i++)
>> -			verbose(env, "+%d", env->subprog_info[i].stack_depth);
>> -		verbose(env, " max %d\n", env->max_stack_depth);
>> +		verbose(env, "stack depth max %d\n", env->max_stack_depth);
>> +		for (i = 0; i < subprog_cnt; i++) {
>> +			const char *name = env->subprog_info[i].name;
>> +
>> +			if (!name || !name[0])
>> +				name = "<unknown>";
>> +			verbose(env, "stack depth subprog %d %s %d\n", i, name,
>> +				env->subprog_info[i].stack_depth);
>> +		}
>
> This isn't a bug, but could the name lookup here reuse subprog_name()?
> It is already in this file and several other verbose() sites use it,
> for example in do_check_common()'s caller:
>
> kernel/bpf/verifier.c
> 	...
> 		} else if (env->log.level & BPF_LOG_LEVEL) {
> 			verbose(env, "Func#%d ('%s') is safe for any args that match its prototype\n",
> 				i, subprog_name(env, i));
> 		}
> 	...
>
> subprog_name() returns "" when there is no func_info, so the
> !name[0] fallback would still catch it:
>

This nit is fine.

> kernel/bpf/verifier.c:subprog_name() {
> 	if (!env->prog->aux->func_info)
> 		return "";
>
> 	info = &env->prog->aux->func_info[subprog];
> 	return btf_type_name(env->prog->aux->btf, info->type_id);
> }
>
> There is also fmt_subprog() in kernel/bpf/liveness.c doing the same
> name-or-fallback formatting, so this is a third variant of the same
> lookup.
>

That's too far fetched, and changes the format, I'll go with using subprog_name().

>>  		verbose(env, "insns processed %d", env->subprog_info[0].insn_processed);
>>  		for (i = 1; i < subprog_cnt; i++)
>>  			if (bpf_subprog_is_global(env, i))
>
> [ ... ]
>
>
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
>
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/30771845943


  reply	other threads:[~2026-08-03  0:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-02 22:52 [PATCH bpf-next v2 0/3] Improve stack depth verification stats output Kumar Kartikeya Dwivedi
2026-08-02 22:52 ` [PATCH bpf-next v2 1/3] bpf: Show more useful info in stack depth stats Kumar Kartikeya Dwivedi
2026-08-02 23:04   ` sashiko-bot
2026-08-02 23:09     ` Kumar Kartikeya Dwivedi
2026-08-03  0:21   ` bot+bpf-ci
2026-08-03  0:40     ` Kumar Kartikeya Dwivedi [this message]
2026-08-02 22:52 ` [PATCH bpf-next v2 2/3] selftests/bpf: Adjust veristat stack depth parsing Kumar Kartikeya Dwivedi
2026-08-02 22:52 ` [PATCH bpf-next v2 3/3] selftests/bpf: Test stack depth stats without BTF subprog names 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=DKEW2GPED8SX.1WM65Z05MZN7G@gmail.com \
    --to=memxor@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clm@meta.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=kernel-team@meta.com \
    --cc=kkd@meta.com \
    --cc=martin.lau@kernel.org \
    --cc=yonghong.song@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