public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Paul Chaignon <paul@isovalent•com>
To: netdev@vger•kernel.org
Cc: Stephen Hemminger <stephen@networkplumber•org>,
	Hangbin Liu <haliu@redhat•com>, David Ahern <dsahern@gmail•com>
Subject: [PATCH iproute2] lib/bpf: Fix log level in verbose mode with libbpf
Date: Wed, 2 Feb 2022 19:11:46 +0100	[thread overview]
Message-ID: <20220202181146.GA75915@Mem> (raw)

Before commit c04e45d083e8 ("lib/bpf: fix verbose flag when using
libbpf"), the verifier logs were not displayed when the verbose flag was
passed. Commit c04e45d083e8 fixed that bug but enabled the incorrect log
level. This commit fixes it.

The kernel supports two log levels. With level 1, the verifier dumps
instructions along each visited path with the verifier state for some.
With level 2, only instructions for the last visited path are dumped but
each instruction is preceded by its verifier state.

Log level 1 probably makes the most sense for the verbose flag as it has
the most comprehensive information (full traversal of the program by the
verifier). It also matches the log level when not using libbpf.

Fixes: c04e45d083e8 ("lib/bpf: fix verbose flag when using libbpf")
Signed-off-by: Paul Chaignon <paul@isovalent•com>
---
 lib/bpf_libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bpf_libbpf.c b/lib/bpf_libbpf.c
index 50ef16bd..bb6399bf 100644
--- a/lib/bpf_libbpf.c
+++ b/lib/bpf_libbpf.c
@@ -305,7 +305,7 @@ static int load_bpf_object(struct bpf_cfg_in *cfg)
 
 	attr.obj = obj;
 	if (cfg->verbose)
-		attr.log_level = 2;
+		attr.log_level = 1;
 
 	ret = bpf_object__load_xattr(&attr);
 	if (ret)
-- 
2.25.1


             reply	other threads:[~2022-02-02 18:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-02 18:11 Paul Chaignon [this message]
2022-02-02 19:10 ` [PATCH iproute2] lib/bpf: Fix log level in verbose mode with libbpf David Ahern
2022-02-02 21:07   ` Paul Chaignon
2022-02-02 21:53     ` David Ahern

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=20220202181146.GA75915@Mem \
    --to=paul@isovalent$(echo .)com \
    --cc=dsahern@gmail$(echo .)com \
    --cc=haliu@redhat$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=stephen@networkplumber$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox