mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Qiliang Yuan <realwujing@gmail.com>
Cc: andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org,
	daniel@iogearbox.net, 	haoluo@google.com, jolsa@kernel.org,
	kpsingh@kernel.org, 	linux-kernel@vger.kernel.org,
	martin.lau@linux.dev, sdf@fomichev.me, 	song@kernel.org,
	yonghong.song@linux.dev, yuanql9@chinatelecom.cn
Subject: Re: [PATCH v3] bpf/verifier: optimize precision backtracking by skipping precise bits
Date: Mon, 19 Jan 2026 10:43:37 -0800	[thread overview]
Message-ID: <a714ee96d0ad96bbc9d51037616e5c4e2790a8ec.camel@gmail.com> (raw)
In-Reply-To: <20260117100922.38459-1-realwujing@gmail.com>

On Sat, 2026-01-17 at 18:09 +0800, Qiliang Yuan wrote:

Hi Qiliang,

> 2. System-wide saturation profiling (32 cores):
>    # Start perf in background
>    sudo perf stat -a -- sleep 60 &
>    # Start 32 parallel loops of veristat
>    for i in {1..32}; do (while true; do ./veristat backtrack_stress.bpf.o > /dev/null; done &); done

I'm not sure system-wide testing is helpful in this context.
I'd suggest collecting stats for a single process, e.g. as follows:

  perf stat -B --all-kernel -r10 -- ./veristat -q pyperf180.bpf.o

(Note: pyperf180 is a reasonably complex test for many purposes).
And then collecting profiling data:

  perf record -o <somewhere-where-mmap-is-possible> \
              --all-kernel --call-graph=dwarf --vmlinux=<path-to-vmlinux> \
	      -- ./veristat -q pyperf180.bpf.o

And then inspecting the profiling data using `perf report`.
What I see in stats corroborates with Yonghong's findings:

  W/o the patch:
            ...
          22293282      branch-misses                    #      2.8 %  branch_miss_rate         ( +-  1.25% )  (50.10%)
         594485451      branches                         #   1012.5 M/sec  branch_frequency     ( +-  1.68% )  (66.67%)
        1544503960      cpu-cycles                       #      2.6 GHz  cycles_frequency       ( +-  0.18% )  (67.02%)
        3305212994      instructions                     #      2.1 instructions  insn_per_cycle  ( +-  2.04% )  (67.11%)
         587496908      stalled-cycles-frontend          #     0.38 frontend_cycles_idle        ( +-  1.21% )  (66.39%)

           0.60033 +- 0.00173 seconds time elapsed  ( +-  0.29% )

  With the patch
            ...
          22397789      branch-misses                    #      2.8 %  branch_miss_rate         ( +-  1.27% )  (50.37%)
         596289399      branches                         #   1004.8 M/sec  branch_frequency     ( +-  1.59% )  (66.95%)
        1546060617      cpu-cycles                       #      2.6 GHz  cycles_frequency       ( +-  0.16% )  (66.67%)
        3325745352      instructions                     #      2.2 instructions  insn_per_cycle  ( +-  1.76% )  (66.61%)
         588040713      stalled-cycles-frontend          #     0.38 frontend_cycles_idle        ( +-  1.23% )  (66.48%)

           0.60697 +- 0.00201 seconds time elapsed  ( +-  0.33% )

So, I'd suggest shelving this change for now.

If you take a look at the profiling data, you'd notice that low
hanging fruit is actually improving bpf_patch_insn_data(),
It takes ~40% of time, at-least for this program.
This was actually discussed a very long time ago [1].
If you are interested in speeding up verifier,
maybe consider taking a look?

Best regards,
Eduard Zingerman.

[1] https://lore.kernel.org/bpf/CAEf4BzY_E8MSL4mD0UPuuiDcbJhh9e2xQo2=5w+ppRWWiYSGvQ@mail.gmail.com/

      parent reply	other threads:[~2026-01-19 18:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15 15:04 [PATCH] " wujing
2026-01-15 18:52 ` Eduard Zingerman
2026-01-16  4:58   ` [PATCH v2] " Qiliang Yuan
2026-01-17 10:09   ` [PATCH v3] " Qiliang Yuan
2026-01-17 17:12     ` Alexei Starovoitov
2026-01-19  6:20     ` Yonghong Song
2026-01-19 18:43     ` Eduard Zingerman [this message]

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=a714ee96d0ad96bbc9d51037616e5c4e2790a8ec.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=realwujing@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    --cc=yuanql9@chinatelecom.cn \
    /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

Powered by JetHome