[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220204225823.339548-3-jolsa@kernel.org>
Date: Fri, 4 Feb 2022 23:58:23 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Toke Høiland-Jørgensen <toke@...hat.com>,
Jakub Kicinski <kuba@...nel.org>,
Jiri Pirko <jiri@...lanox.com>
Subject: [PATCH bpf-next 3/3] bpftool: Fix pretty print dump for maps without BTF loaded
The commit e5043894b21f ("bpftool: Use libbpf_get_error() to check
error") forced map dump with pretty print enabled to has BTF loaded,
which is not necessarily needed.
Keeping the libbpf_get_error call, but setting errno to 0 because
get_map_kv_btf does nothing for this case.
This fixes test_offload.py for me, which failed because of the
pretty print fails with:
Test map dump...
Traceback (most recent call last):
File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 1251, in <module>
_, entries = bpftool("map dump id %d" % (m["id"]))
File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 169, in bpftool
return tool("bpftool", args, {"json":"-p"}, JSON=JSON, ns=ns,
File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 155, in tool
ret, stdout = cmd(ns + name + " " + params + args,
File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 109, in cmd
return cmd_result(proc, include_stderr=include_stderr, fail=fail)
File "/root/bpf-next/tools/testing/selftests/bpf/./test_offload.py", line 131, in cmd_result
raise Exception("Command failed: %s\n%s" % (proc.args, stderr))
Exception: Command failed: bpftool -p map dump id 4325
Fixes: e5043894b21f ("bpftool: Use libbpf_get_error() to check error")
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
tools/bpf/bpftool/map.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index c66a3c979b7a..2ccf85042e75 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -862,6 +862,7 @@ map_dump(int fd, struct bpf_map_info *info, json_writer_t *wtr,
prev_key = NULL;
if (wtr) {
+ errno = 0;
btf = get_map_kv_btf(info);
err = libbpf_get_error(btf);
if (err) {
--
2.34.1
Powered by blists - more mailing lists