Re: [PATCH bpf] libbpf: soften BTF map error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/16/23 7:30 PM, Martin Kelly wrote:
For map-in-map types, the first time the map is loaded, we get a scary
error looking like this:

libbpf: bpf_create_map_xattr(map_name):ERROR: strerror_r(-524)=22(-524). Retrying without BTF.

On the second try without BTF, everything works fine. However, as this
is logged at error level, it looks needlessly scary to users. Soften
this to be at debug level; if the second attempt still fails, we'll
still get an error as expected.

Signed-off-by: Martin Kelly <martin.kelly@xxxxxxxxxxxxxxx>

nit: $subj should be for bpf-next instead of bpf

---
  tools/lib/bpf/libbpf.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index b14a4376a86e..0ca0c8d01707 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -5123,7 +5123,7 @@ static int bpf_object__create_map(struct bpf_object *obj, struct bpf_map *map, b
err = -errno;
  		cp = libbpf_strerror_r(err, errmsg, sizeof(errmsg));
-		pr_warn("Error in bpf_create_map_xattr(%s):%s(%d). Retrying without BTF.\n",
+		pr_debug("bpf_create_map_xattr(%s):%s(%d). Retrying without BTF.\n",
  			map->name, cp, err);

There are also several other places with pr_warns about BTF when loading an obj. Did
you audit them as well under !BTF kernel? nit: Why changing the fmt string itself,
looked ok as-is, no?

There is also libbpf_needs_btf(obj), perhaps this could be left as pr_warn similar
as in bpf_object__init_btf() - or would this still trigger in your case?

  		create_attr.btf_fd = 0;
  		create_attr.btf_key_type_id = 0;


Thanks,
Daniel




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux