BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Mahe Tardy <mahe.tardy@gmail.com>, bpf <bpf@vger.kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	John Fastabend	 <john.fastabend@gmail.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Paul Chaignon	 <paul.chaignon@gmail.com>,
	shung-hsi.yu@suse.com
Subject: Re: [PATCH bpf-next] verifier: add prune points to live registers print
Date: Mon, 29 Dec 2025 17:13:40 -0800	[thread overview]
Message-ID: <62ba00524aa7afd5e1f76a5a2f4c06899bf2dd64.camel@gmail.com> (raw)
In-Reply-To: <CAADnVQLsJeSjwFVE=gcnVzh7HftDqZJM+xByr2cD6TRmTRGLsA@mail.gmail.com>

On Mon, 2025-12-29 at 16:42 -0800, Alexei Starovoitov wrote:

[...]

> > Imo, it would be indeed more interesting to print where checkpoint
> > match had been attempted and why it failed, e.g. as I do in [1].
> > Here is a sample:
> > 
> >   cache miss at (140, 5389): frame=1, reg=0, spi=-1, loop=0 (cur: 1) vs (old: P0)
> >   from 5387 to 5389: frame1: R0=1 R1=0xffffffff ...
> > 
> > However, in the current form it slows down log level 2 output
> > significantly (~5 times). Okay for my debugging purposes but is not
> > good for upstream submission.
> > 
> > Thanks,
> > Eduard.
> > 
> > [1] https://github.com/kernel-patches/bpf/commit/65fcd66d03ad9d6979df79628e569b90563d5368
> 
> bpf_print_stack_state() refactor can land.
> While the rest potentially bpfvv can do.
> With log_level==2 all the previous paths through particular instruction
> will be in the log earlier, so I can imagine clicking on an insn
> and it will show current and all previous seen states.
> The verifier heuristic will drop some of them, so it will show more
> than actually known during the verification, but that's probably ok
> for debugging to see why states don't converge.
> bpfvv can make it easier to see the difference too instead of
> "frame=1, reg=0, spi=-1, loop=0 (cur: 1) vs (old: P0)"
> which is not easy to understand.
> Only after reading the diff I realized that reg R0 is the one
> that caused a mismatch.

In theory this can be handled in post-processing completely,
however I'd expect mirroring states-equal logic in bpfvv
(or any other tool) to be error prone. Which is very undesirable when
you are debugging. To make post-processing simpler I'd print:
- state id upon state creation
- state ids upon cache miss + register or spi number.

This way post-processing tool would only need to collect register
values for state ids in question.

Idk, not sure if any of this should be upstreamed, I'm fine with it
living in my debug branch. On the other hand, this might be useful for
people debugging 1M instruction issues, as I discussed with
Paul Chaignon and Shung-Hsi Yu at LPC.

  reply	other threads:[~2025-12-30  1:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-22 18:58 [PATCH bpf-next] verifier: add prune points to live registers print Mahe Tardy
2025-12-22 20:50 ` Yonghong Song
2025-12-23  6:32 ` Alexei Starovoitov
2025-12-23 10:12   ` Mahe Tardy
2025-12-29 18:48     ` Eduard Zingerman
2025-12-30  0:42       ` Alexei Starovoitov
2025-12-30  1:13         ` Eduard Zingerman [this message]
2025-12-30 18:06           ` Alexei Starovoitov
2025-12-30 18:44             ` Eduard Zingerman
2025-12-31  1:11               ` Alexei Starovoitov
2025-12-31  5:47                 ` 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=62ba00524aa7afd5e1f76a5a2f4c06899bf2dd64.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=mahe.tardy@gmail.com \
    --cc=paul.chaignon@gmail.com \
    --cc=shung-hsi.yu@suse.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