Re: [PATCH bpf-next] libbpf: demote log message about unrecognised data sections back down to debug

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

 





On 11/4/21 5:29 AM, Toke Høiland-Jørgensen wrote:
When loading a BPF object, libbpf will output a log message when it
encounters an unrecognised data section. Since commit
50e09460d9f8 ("libbpf: Skip well-known ELF sections when iterating ELF")
they are printed at "info" level so they will show up on the console by
default.

The rationale in the commit cited above is to "increase visibility" of such
errors, but there can be legitimate, and completely harmless, uses of extra
data sections. In particular, libxdp uses custom data sections to store
metadata and run priority configuration of XDP programs, which triggers the
log message. Ciara noticed that when porting XSK code to use libxdp instead
of libbpf as part of the deprecation, libbpf would output messages like:

libbpf: elf: skipping unrecognized data section(7) .xdp_run_config
libbpf: elf: skipping unrecognized data section(8) xdp_metadata
libbpf: elf: skipping unrecognized data section(8) xdp_metadata
libbpf: elf: skipping unrecognized data section(8) xdp_metadata

In light of this, let's demote the message severity back down to debug so
that it won't clutter up the default output of applications.

Cc: Magnus Karlsson <magnus.karlsson@xxxxxxxxx>
Reported-by: Ciara Loftus <ciara.loftus@xxxxxxxxx>
Signed-off-by: Toke Høiland-Jørgensen <toke@xxxxxxxxxx>

I think it is okay to demote the visibility from "info" to "debug".
Andrii's recent patches can handle more data sections. And also,
if applications work fine, skipping unrecognized sections probably
will be ignored by user any way. If application has issues, debug
mode will reveal more information.

Acked-by: Yonghong Song <yhs@xxxxxx>

---
  tools/lib/bpf/libbpf.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index a1bea1953df6..ac0eadbe1475 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -3297,8 +3297,8 @@ static int bpf_object__elf_collect(struct bpf_object *obj)
  				obj->efile.st_ops_data = data;
  				obj->efile.st_ops_shndx = idx;
  			} else {
-				pr_info("elf: skipping unrecognized data section(%d) %s\n",
-					idx, name);
+				pr_debug("elf: skipping unrecognized data section(%d) %s\n",
+					 idx, name);
  			}
  		} else if (sh->sh_type == SHT_REL) {
  			int targ_sec_idx = sh->sh_info; /* points to other section */




[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