Article View: linux.kernel.netdev
Article #4012Re: [PATCH bpf-next] bpftool: Print verified instruction count in prog show
From: Quentin Monnet
Date: Fri, 16 Oct 2026 14:24
Date: Fri, 16 Oct 2026 14:24
78 lines
9216 bytes
9216 bytes
2026-10-16 15:16 UTC+0800 ~ chenyuan_fl@163.com
> 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.
It's different from the other conditional stats though, unless you run
bpftool on an old kernel verified_insns will show up every time. Can we
move it to another line to avoid growing the first line too much,
please? Maybe after loaded_at and uid?
>
> 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);
Note: Moving it to another line means you should use a double space
(rather than single) at the beginning of the string.
pw-bot: cr
Thanks,
Quentin
Technical Details
Message-ID:
<7d4d6870-7734-460a-8391-a41322d61e79@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-347376-linux-kernel-netdev=dewy.ruReferences:
<20261016071700.280539-1-chenyuan_fl@163.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-347376-linux-kernel-netdev=dewy.ru From: qmo@kernel.org (Quentin Monnet) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH bpf-next] bpftool: Print verified instruction count in prog show Date: Fri, 16 Oct 2026 15:24:56 +0100 Organization: Usenet Network Message-ID: <7d4d6870-7734-460a-8391-a41322d61e79@kernel.org> References: <20261016071700.280539-1-chenyuan_fl@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="2795134"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:EV8dwZ7qL9NDsg1eRFRPb8OISUU= sha256:XK129aSlWRhqvqXMbXWVhXx7jEQVRQdx3NSu/AeyxMU= sha1:brPgdRLpewk6nioUHYKgTOTB0iM= sha256:6qAJQSAeac2ACvc9CKRk/LuqV+OU8TtAN+GmR4NYhQU= Content-Language: en-GB List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 38C0D11054B; Fri, 16 Oct 2026 18:03:14 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.64 X-Spam-Status: No, score=-3.64 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zwwDhQkHXLpf; Fri, 16 Oct 2026 18:03:06 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-347376-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 2C932110549; Fri, 16 Oct 2026 18:02:54 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id 403F734B37; Fri, 16 Oct 2026 14:25:04 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE907346FA0; Fri, 16 Oct 2026 14:25:02 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="a4rxLjkU" X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5C293148B4; Fri, 16 Oct 2026 14:25:01 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792160702; cv=none; b=DGWqrajGSO2rUpEFxgWgk/VHzIL5OVCOgsWNxS7EV2SOAKkfAnkxWhZEuzpDsR4VPA4R393DLoEArya6r8aUAG3GwBxzji9l00x9aQEKVcENkzWq3DNyH4yiXWzKRs/yWStz+uQC3ZjfSIf0BST0FGbMMvHBT7b0znGUMo4HRQ8= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792160702; c=relaxed/simple; bh=BjaG0A3KflZ2fnKglMM+nFKkPwxYCIsn9Y6W0gKdy5c=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=K+dzT7Nv1GPYL+uWb5jtRSDonk3Fn0qPMBoCUHxT33MrmaBkRGIwBf6eHUyTDt8nsuvB0MlhkYpRQplTUfH1wmOCEaWu6Fl4MiBqFzbqkVCcRn5qBDPQJ5sycZaGQxTYzboWEvHn/Lg12E1juaRHEFLp/7BxDg5ayTIpjE8WM+A= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=a4rxLjkU; arc=none smtp.client-ip=100.103.45.18 X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F0F21F000C5; Fri, 16 Oct 2026 14:24:57 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792160701; bh=Bz+GxVr4dlEeQzhf+FUIQ3S+8z4o4wVUtyCodsJ/Q5Q=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=a4rxLjkURZIsI/Fd6D5pBcUhIqHG50MaciNasuiafr8h7qg2+b9L0G/YZktwVQzkD kLBVchM2FcOkvQjO/E1PbHMzLrCl4VlYlIse/uRL1JBmRuuoiTBp1nwa/qH7VMaFxi xhZWNUpPF/cxjsmMLUHpQOizWdtk8aJGG33dK1uyB6FUD/4l7iABQ12aGo9Q13oOJq wu7wqNC24hHrSiq+Bi7CpBu5BydYWxivMuqARUleFJRAaptHqRUEU2x03dV3kXj8JX xZVxOO5Ykm5wSiKdYpCNQUGm1BHV5EFjGv+KN9W157gYenDnTRtLJKD5TqTxxYSriN jOaSS5Kz4Gakw== X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-User-Agent: Mozilla Thunderbird X-Cc: Yuan Chen <chenyuan@kylinos.cn>, 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 X-In-Reply-To: <20261016071700.280539-1-chenyuan_fl@163.com>