From: chenyuan_fl@163.com
To: bpf@vger.kernel.org
Cc: Yuan Chen <chenyuan@kylinos.cn>, Quentin Monnet <qmo@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>,
Emil Tsalapatis <emil@etsalapatis.com>,
Ihor Solodrai <ihor.solodrai@linux.dev>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Stanislav Fomichev <sdf@fomichev.me>,
Mykyta Yatsenko <yatsenko@meta.com>,
Menglong Dong <menglong8.dong@gmail.com>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH bpf-next] bpftool: Print verified instruction count in prog show
Date: Fri, 16 Oct 2026 15:16:57 +0800 [thread overview]
Message-ID: <20261016071700.280539-1-chenyuan_fl@163.com> (raw)
From: Yuan Chen <chenyuan@kylinos.cn>
The number of instructions processed by the verifier is available
through bpf_prog_info::verified_insns and the program's fdinfo since
commit aba64c7da983 ("bpf: Add verified_insns to bpf_prog_info and
fdinfo"), but bpftool does not display it, leaving no convenient way
to check a program's verifier cost.
Print the count in the plain and JSON output of bpftool prog show,
following the convention of the other conditional stats
(run_time_ns, run_cnt, recursion_misses): kernels that do not fill
the field leave it zeroed and nothing is printed.
Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
---
tools/bpf/bpftool/Documentation/bpftool-prog.rst | 3 ++-
tools/bpf/bpftool/prog.c | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/bpf/bpftool/Documentation/bpftool-prog.rst b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
index 8dbd34ef3d8b..d4a94e0737a9 100644
--- a/tools/bpf/bpftool/Documentation/bpftool-prog.rst
+++ b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
@@ -285,7 +285,7 @@ EXAMPLES
::
- 10: xdp name some_prog tag 005a3d2123620c8b gpl run_time_ns 81632 run_cnt 10
+ 10: xdp name some_prog tag 005a3d2123620c8b gpl run_time_ns 81632 run_cnt 10 verified_insns 528
loaded_at 2017-09-29T20:11:00+0000 uid 0
xlated 528B jited 370B memlock 4096B map_ids 10
pids systemd(1)
@@ -301,6 +301,7 @@ EXAMPLES
"gpl_compatible": true,
"run_time_ns": 81632,
"run_cnt": 10,
+ "verified_insns": 528,
"loaded_at": 1506715860,
"uid": 0,
"bytes_xlated": 528,
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index eb077236d2ea..c77e871b8859 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -441,6 +441,8 @@ static void print_prog_header_json(struct bpf_prog_info *info, int fd)
}
if (info->recursion_misses)
jsonw_uint_field(json_wtr, "recursion_misses", info->recursion_misses);
+ if (info->verified_insns)
+ jsonw_uint_field(json_wtr, "verified_insns", info->verified_insns);
}
static void print_prog_json(struct bpf_prog_info *info, int fd, bool orphaned)
@@ -526,6 +528,8 @@ static void print_prog_header_plain(struct bpf_prog_info *info, int fd)
info->run_time_ns, info->run_cnt);
if (info->recursion_misses)
printf(" recursion_misses %llu", info->recursion_misses);
+ if (info->verified_insns)
+ printf(" verified_insns %u", info->verified_insns);
printf("\n");
}
--
2.54.0
next reply other threads:[~2026-10-16 7:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 7:16 chenyuan_fl [this message]
2026-10-16 14:13 ` [PATCH bpf-next] bpftool: Print verified instruction count in prog show Justin Suess
2026-10-16 14:24 ` Quentin Monnet
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=20261016071700.280539-1-chenyuan_fl@163.com \
--to=chenyuan_fl@163.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chenyuan@kylinos.cn \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=hawk@kernel.org \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=menglong8.dong@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=qmo@kernel.org \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=yatsenko@meta.com \
--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