Use lookup batches for ordinary hash maps whose maximum key/value storage fits within 4 MiB. Patch 1 implements batch traversal; patch 2 checks complete output contents around its batch boundary and for short keys, odd-sized values and BTF formatting.
Changes in v2: - Send fatal batch diagnostics to stderr. JSON elements arrays retain only map-entry objects, including after a partially completed dump. - Use the BPF multiline comment style in the implementation and test. Validation: - All 11 batch dump subtests passed in the integration run below. - Reproduced the v1 generic error object inside the elements array. - Injected initial EFAULT/ENOMEM and post-progress EIO/EINVAL with strace for -j and -p, both with and without -r. All 16 cases returned failure, emitted the diagnostic on stderr, and kept a complete JSON document containing only the expected zero or 256 distinct entries. - Initial EINVAL/EOPNOTSUPP/ENOTSUPP fallback and ENOSPC growth before and after progress still returned all 1,025 entries without duplicates. The injected syscall errors are not a real hash collision stress test. The batching algorithm and eligibility bound are unchanged from v1. v1: https://lore.kernel.org/r/[email protected] Request: https://github.com/libbpf/bpftool/issues/63 Integration validation: the flags, ring-buffer and batch v2 series plus recursive dump v3 built together with LLVM 20. All 69 focused BPF subtests passed in an x86-64 KVM guest running Linux 7.3.0-rc1, with no skips or failures. The bpftool-map man page also built successfully. This is a focused run, not the full BPF selftest suite. Tianyi Chen (2): bpftool: Use batch lookups for bounded hash map dumps selftests/bpf: Check bpftool batch map dump contents tools/bpf/bpftool/map.c | 116 ++++++++++- .../bpf/prog_tests/bpftool_map_batch.c | 187 ++++++++++++++++++ 2 files changed, 295 insertions(+), 8 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/bpftool_map_batch.c -- 2.55.0
