diff options
author | Ihor Solodrai <ihor.solodrai@pm.me> | 2024-09-18 19:33:22 +0000 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2024-10-03 17:47:35 -0700 |
commit | 8b334d91834666dbc4c1c0b0abed3f855ed16cf3 (patch) | |
tree | 62828a1b4e926dabd4ede775a9a6818b5195d6a6 /tools/lib | |
parent | a1ec23b947538520b3182c598dc2bb9930d032b1 (diff) |
libbpf: Change log level of BTF loading error message
Reduce log level of BTF loading error to INFO if BTF is not required.
Andrii says:
Nowadays the expectation is that the BPF program will have a valid
.BTF section, so even though .BTF is "optional", I think it's fine
to emit a warning for that case (any reasonably recent Clang will
produce valid BTF).
Ihor's patch is fixing the situation with an outdated host kernel
that doesn't understand BTF. libbpf will try to "upload" the
program's BTF, but if that fails and the BPF object doesn't use
any features that require having BTF uploaded, then it's just an
information message to the user, but otherwise can be ignored.
Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Ihor Solodrai <ihor.solodrai@pm.me>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/bpf/libbpf.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 219facd0e66e..b8d72b5fbc79 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -3581,11 +3581,12 @@ static int bpf_object__sanitize_and_load_btf(struct bpf_object *obj) report: if (err) { btf_mandatory = kernel_needs_btf(obj); - pr_warn("Error loading .BTF into kernel: %d. %s\n", err, - btf_mandatory ? "BTF is mandatory, can't proceed." - : "BTF is optional, ignoring."); - if (!btf_mandatory) + if (btf_mandatory) { + pr_warn("Error loading .BTF into kernel: %d. BTF is mandatory, can't proceed.\n", err); + } else { + pr_info("Error loading .BTF into kernel: %d. BTF is optional, ignoring.\n", err); err = 0; + } } return err; } |