BPF List
 help / color / mirror / Atom feed
From: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>
To: "Andrii Nakryiko" <andrii.nakryiko@gmail.com>
Cc: <bpf@vger.kernel.org>, "Andrii Nakryiko" <andrii@kernel.org>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Eduard Zingerman" <eddyz87@gmail.com>,
	"Emil Tsalapatis" <emil@etsalapatis.com>, <kkd@meta.com>,
	<kernel-team@meta.com>
Subject: Re: [PATCH bpf-next v4 1/3] bpf: Show more useful info in stack depth stats
Date: Tue, 04 Aug 2026 09:21:57 +0200	[thread overview]
Message-ID: <DKFZ8FJ5G3Q9.32N54NYUAG8OW@gmail.com> (raw)
In-Reply-To: <CAEf4BzZwSogfspAQG6M4X5V4P+=-W1_hV65+6vpTDy5aaVYmPg@mail.gmail.com>

On Mon Aug 3, 2026 at 9:48 PM CEST, Andrii Nakryiko wrote:
> On Mon, Aug 3, 2026 at 12:27 AM Kumar Kartikeya Dwivedi
> <memxor@gmail.com> wrote:
>>
>> Currently, stack depth statistics are too crude, listing captured depths in
>> subprogram-number order. Since libbpf determines those numbers, it is hard to
>> associate each depth with its subprogram name.
>>
>> Print the maximum stack depth and each subprogram on separate lines:
>>
>> stack depth max <depth>
>> stack depth subprog <number> <name> <depth>
>>
>> When no subprogram name is available, print <unknown>.
>>
>> Suggested-by: Andrii Nakryiko <andrii@kernel.org>
>> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
>> ---
>>  kernel/bpf/verifier.c                         | 13 +++++++----
>>  .../bpf/progs/verifier_basic_stack.c          |  4 ++--
>>  .../bpf/progs/verifier_bpf_fastcall.c         | 23 ++++++++++++-------
>>  .../bpf/progs/verifier_private_stack.c        | 15 +++++++++---
>>  .../selftests/bpf/progs/verifier_var_off.c    |  4 ++--
>>  5 files changed, 40 insertions(+), 19 deletions(-)
>>
>
> given we are going for quite verbose one line per prog/subprog format
> anyways, let's make it actually even more useful and emit
> insns_processed as well? I'd probably keep total line (processed N
> insns (limit 1000000) ...) for backwards compat, but also have
> per-subprog + main prog line with insns stat and stack depth,
> something like
>
> subprog 1 (sub1) insns 123 stack 16
> subprog 2 (sub2) insns 345 stack 32
> prog (main_one) insns 643 stack 64
> processed 9999 insns (limit 1000000) max_states_per_insn 0
> total_states 1 peak_states 1 mark_read 0
>
> wdyt?
>
> this will give better and more targeted information on where you
> should look for w.r.t. verification optimization opportunities
>
> and we can later add some other useful stats per-subprog/main prog as
> necessary without any major breakage (tool just need to assume there
> might be more stuff after "stack N" eventually
>

The format makes sense, let me rework the output and parsing and repost a v5.

> [...]


  reply	other threads:[~2026-08-04  7:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03  7:27 [PATCH bpf-next v4 0/3] Improve stack depth verification stats output Kumar Kartikeya Dwivedi
2026-08-03  7:27 ` [PATCH bpf-next v4 1/3] bpf: Show more useful info in stack depth stats Kumar Kartikeya Dwivedi
2026-08-03  7:34   ` sashiko-bot
2026-08-03 19:48   ` Andrii Nakryiko
2026-08-04  7:21     ` Kumar Kartikeya Dwivedi [this message]
2026-08-03  7:27 ` [PATCH bpf-next v4 2/3] selftests/bpf: Adjust veristat stack depth parsing Kumar Kartikeya Dwivedi
2026-08-03  8:49   ` bot+bpf-ci
2026-08-03  7:27 ` [PATCH bpf-next v4 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=DKFZ8FJ5G3Q9.32N54NYUAG8OW@gmail.com \
    --to=memxor@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=kernel-team@meta.com \
    --cc=kkd@meta.com \
    /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