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>,
linux-kernel@vger.kernel.org
Subject: [PATCH bpf-next] bpftool: Print map_extra in map show
Date: Fri, 16 Oct 2026 15:16:58 +0800 [thread overview]
Message-ID: <20261016071700.280539-2-chenyuan_fl@163.com> (raw)
In-Reply-To: <20261016071700.280539-1-chenyuan_fl@163.com>
From: Yuan Chen <chenyuan@kylinos.cn>
bpf_map_info::map_extra carries per-map-type creation attributes
(hash function count for bloom filter, VMA start for arena). The
kernel prints it in fdinfo, but bpftool does not. Print the raw
value in plain and JSON output when non-zero, without interpreting
it per map type, like map_flags. The attribute is already overloaded
per map type, and bpftool must not grow per-type knowledge of it.
Example (bloom filter with 7 hash functions):
117665: bloom_filter name featu_bloom flags 0x0
key 0B value 8B max_entries 128 map_extra 0x7 memlock 520B
pids fixture(3543054)
Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
---
tools/bpf/bpftool/map.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index 20d59eab09a1..62e36c7934ff 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -483,6 +483,8 @@ static int show_map_close_json(int fd, struct bpf_map_info *info)
jsonw_uint_field(json_wtr, "bytes_key", info->key_size);
jsonw_uint_field(json_wtr, "bytes_value", info->value_size);
jsonw_uint_field(json_wtr, "max_entries", info->max_entries);
+ if (info->map_extra)
+ jsonw_lluint_field(json_wtr, "map_extra", info->map_extra);
if (memlock)
jsonw_int_field(json_wtr, "bytes_memlock", atoll(memlock));
@@ -570,6 +572,8 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)
show_map_header_plain(info);
printf("\tkey %uB value %uB max_entries %u",
info->key_size, info->value_size, info->max_entries);
+ if (info->map_extra)
+ printf(" map_extra %#llx", (unsigned long long)info->map_extra);
if (memlock)
printf(" memlock %sB", memlock);
--
2.54.0
next prev parent reply other threads:[~2026-10-16 7:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 7:16 [PATCH bpf-next] bpftool: Print verified instruction count in prog show chenyuan_fl
2026-10-16 7:16 ` chenyuan_fl [this message]
2026-10-16 14:25 ` [PATCH bpf-next] bpftool: Print map_extra in map show Quentin Monnet
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-2-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=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=qmo@kernel.org \
--cc=song@kernel.org \
--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
all inboxes | Powered by JetHome®