From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Maxim Skokov" <skokovmaksimevg@gmail.com>, <bpf@vger.kernel.org>
Cc: <qmo@kernel.org>, <daniel@iogearbox.net>, <andrii@kernel.org>,
<eddyz87@gmail.com>, <memxor@gmail.com>, <martin.lau@linux.dev>,
<song@kernel.org>, <yonghong.song@linux.dev>, <jolsa@kernel.org>,
<kuba@kernel.org>, <shuah@kernel.org>,
<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH bpf-next 1/2] bpftool: Don't report an empty map when key iteration fails
Date: Thu, 24 Sep 2026 16:24:50 +0000 [thread overview]
Message-ID: <DLNOPVM33JL0.4IW7LA889QQ2@gmail.com> (raw)
In-Reply-To: <20260924160732.485650-2-skokovmaksimevg@gmail.com>
On Thu, Sep 24, 2026 at 07:07 PM Maxim Skokov <skokovmaksimevg@gmail.com> wrote:
> This is what every local storage map (sk, inode, task and cgrp storage)
> gets, since their map_get_next_key returns -ENOTSUPP. On a
> BPF_MAP_TYPE_SK_STORAGE map holding storage for five TCP sockets:
>
> # bpftool map dump pinned /sys/fs/bpf/tc/globals/cilium_lb4_reverse_sk_v2
> []
> # echo $?
> 244
cilium_lb4_reverse_sk is an LRU hash in cilium. It's not sk_storage
and bpftool dumps it just fine.
So where did this output come from?
[...]
> Fixes: 71bb428fe2c1 ("tools: bpf: add bpftool")
That's not a fix. The exit status was non-zero before and it's the
same after. Drop the Fixes tag.
[...]
> + p_err("can't get next key: %s%s", strerror(saved_errno),
> + saved_errno == 524 /* ENOTSUPP */ ?
> + " -- map type does not support iteration" : "");
Local storage and ringbuf return ENOTSUPP.
Bloom filter and arena return EOPNOTSUPP. Queue and stack return EINVAL.
None of them can be iterated. The hint is printed for the first two only.
[...]
> - } else {
> + } else if (!err) {
> printf("Found %u element%s\n", num_elems,
> num_elems != 1 ? "s" : "");
The subject says "Don't report an empty map", but when the map has BTF
the elements array is opened before the loop and closed after it,
so stdout is still "[]". Only the line on stderr is new.
With -j the error object is printed inside that array:
[{"error":"can't get next key: ..."}]
pw-bot: cr
next prev parent reply other threads:[~2026-09-24 16:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 16:07 [PATCH bpf-next 0/2] bpftool: Don't report an empty map when key iteration fails Maxim Skokov
2026-09-24 16:07 ` [PATCH bpf-next 1/2] " Maxim Skokov
2026-09-24 16:24 ` Alexei Starovoitov [this message]
2026-09-24 16:35 ` Maxim Skokov
2026-09-24 16:56 ` bot+bpf-ci
2026-09-24 19:19 ` Maxim Skokov
2026-09-24 16:07 ` [PATCH bpf-next 2/2] selftests/bpf: Check that bpftool reports a map it can't dump Maxim Skokov
2026-09-24 16:17 ` sashiko-bot
2026-09-24 19:18 ` Maxim Skokov
2026-09-24 16:56 ` bot+bpf-ci
2026-09-24 19:19 ` Maxim Skokov
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=DLNOPVM33JL0.4IW7LA889QQ2@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=jolsa@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=qmo@kernel.org \
--cc=shuah@kernel.org \
--cc=skokovmaksimevg@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.