From: Tianyi Chen <hi@tychen.cc>
To: bpf@vger.kernel.org
Cc: qmo@kernel.org, andrii@kernel.org, eddyz87@gmail.com,
ihor.solodrai@linux.dev, linux-kselftest@vger.kernel.org,
skokovmaksimevg@gmail.com
Subject: [PATCH bpf-next v9 0/2] bpftool: Add recursive map dumping
Date: Sat, 26 Sep 2026 10:42:06 +0900 [thread overview]
Message-ID: <20260926014208.24773-1-hi@tychen.cc> (raw)
Add an opt-in recursive keyword to dump selected maps followed by their
referenced inner maps.
This version is based on current bpf-next plus Maxim Skokov's v2 patch 1/2,
"bpftool: Fail map dump for maps that can't be iterated":
https://lore.kernel.org/r/20260925162031.27259-2-skokovmaksimevg@gmail.com
That patch is a prerequisite, not part of this series. Keep its early
iteration check before recursive plain/BTF output, and retain its error
reporting. I will handle rebasing this series if the prerequisite changes.
Changes in v9:
- Clear map info and reset its length before each query in all three
do_dump() loops, preventing BTF metadata from leaking between maps.
- Add mixed BTF/non-BTF root and inner-map tests, with different key/value
sizes, checking complete JSON and plain output.
- Drop the unnecessary OPTIONS rewrap, as Quentin requested.
- Rebase and resolve the overlap with Maxim's patch as described above.
Validation in an x86-64 VM:
- Both new regression cases fail with v8 and pass with v9.
- All 15 bpftool_map_dump subtests pass on the combined tree.
- Non-iterable ringbuf dumps fail with valid error JSON both with and
without recursion. The bpftool type-sync and shell syntax checks pass.
v8: https://lore.kernel.org/r/20260925174402.2028649-1-hi@tychen.cc
Review: https://lore.kernel.org/r/43549d30-0f47-46a2-a60f-fb6f252e6738@kernel.org
BTF finding: https://lore.kernel.org/r/06229dde91361ba3f8d3c8d5ab0350f4a66643eb72b0c3554b1c146fe8523eac@mail.kernel.org
Tianyi Chen (2):
bpftool: Add recursive map dumping
selftests/bpf: Cover recursive bpftool map dumps
.../bpf/bpftool/Documentation/bpftool-map.rst | 12 +-
tools/bpf/bpftool/bash-completion/bpftool | 3 +
tools/bpf/bpftool/map.c | 148 ++++-
.../bpf/prog_tests/bpftool_map_dump.c | 602 ++++++++++++++++++
4 files changed, 752 insertions(+), 13 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/bpftool_map_dump.c
base-commit: b9f30c763c7ecec41fd3f71b8a5a44971c3fddbf
prerequisite-patch-id: 638622a02f200337c410f2078d38d5cfb9f08404
--
2.55.0
next reply other threads:[~2026-09-26 1:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-26 1:42 Tianyi Chen [this message]
2026-09-26 1:42 ` [PATCH bpf-next v9 1/2] bpftool: Add recursive map dumping Tianyi Chen
2026-09-28 15:25 ` Quentin Monnet
2026-09-28 17:19 ` Tianyi Chen
2026-09-26 1:42 ` [PATCH bpf-next v9 2/2] selftests/bpf: Cover recursive bpftool map dumps Tianyi Chen
[not found] ` <effbbc956dbdf4c78d27608f6ef8639908323d0aaabf80e1cd592cccac938c99@mail.kernel.org>
2026-09-26 6:08 ` [PATCH bpf-next v9 0/2] bpftool: Add recursive map dumping Tianyi Chen
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=20260926014208.24773-1-hi@tychen.cc \
--to=hi@tychen.cc \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=eddyz87@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=linux-kselftest@vger.kernel.org \
--cc=qmo@kernel.org \
--cc=skokovmaksimevg@gmail.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