From: tip-bot for Wang Nan <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: lizefan@huawei.com, linux-kernel@vger.kernel.org,
wangnan0@huawei.com, mingo@kernel.org, acme@redhat.com,
tglx@linutronix.de, hpa@zytor.com
Subject: [tip:perf/urgent] perf bpf: Mute libbpf when '-v' not set
Date: Sat, 7 Nov 2015 23:27:50 -0800 [thread overview]
Message-ID: <tip-7a0119468c9c2deff24ef24e1b4d2c1bd1523fd5@git.kernel.org> (raw)
In-Reply-To: <1446547486-229499-3-git-send-email-wangnan0@huawei.com>
Commit-ID: 7a0119468c9c2deff24ef24e1b4d2c1bd1523fd5
Gitweb: http://git.kernel.org/tip/7a0119468c9c2deff24ef24e1b4d2c1bd1523fd5
Author: Wang Nan <wangnan0@huawei.com>
AuthorDate: Tue, 3 Nov 2015 10:44:43 +0000
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 3 Nov 2015 12:06:04 -0300
perf bpf: Mute libbpf when '-v' not set
According to [1], libbpf should be muted. This patch reset info and
warning message level to ensure libbpf doesn't output anything even
if error happened.
[1] http://lkml.kernel.org/r/20151020151255.GF5119@kernel.org
Committer note:
Before:
Testing it with an incompatible kernel version in the .c file that
generated foo.o:
[root@zoo ~]# perf record -e /tmp/foo.o sleep 1
libbpf: load bpf program failed: Invalid argument
libbpf: -- BEGIN DUMP LOG ---
libbpf:
libbpf: -- END LOG --
libbpf: failed to load program 'fork=_do_fork'
libbpf: failed to load object '/tmp/foo.o'
event syntax error: '/tmp/foo.o'
\___ Invalid argument: Are you root and runing a CONFIG_BPF_SYSCALL kernel?
(add -v to see detail)
Run 'perf list' for a list of valid events
Usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
-e, --event <event> event selector. use 'perf list' to list available events
[root@zoo ~]#
After:
[root@zoo ~]# perf record -e /tmp/foo.o sleep 1
event syntax error: '/tmp/foo.o'
\___ Invalid argument: Are you root and runing a CONFIG_BPF_SYSCALL kernel?
(add -v to see detail)
Run 'perf list' for a list of valid events
Usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
-e, --event <event> event selector. use 'perf list' to list available events
[root@zoo ~]#
This, BTW, need fixing to emit a proper message by validating the
version in the foo.o "version" ELF section against the running kernel,
warning the user instead of asking the kernel to load a binary that it
will refuse due to unmatching kernel version.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1446547486-229499-3-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/bpf-loader.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index ba6f752..0c5d174 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -26,8 +26,8 @@ static int libbpf_##name(const char *fmt, ...) \
return ret; \
}
-DEFINE_PRINT_FN(warning, 0)
-DEFINE_PRINT_FN(info, 0)
+DEFINE_PRINT_FN(warning, 1)
+DEFINE_PRINT_FN(info, 1)
DEFINE_PRINT_FN(debug, 1)
struct bpf_prog_priv {
next prev parent reply other threads:[~2015-11-08 7:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-03 10:44 [PATCH 0/5] perf bpf: Improve error code delivering and output Wang Nan
2015-11-03 10:44 ` [PATCH 1/5] perf test: Keep test result clean if '-v' not set Wang Nan
2015-11-03 11:19 ` Namhyung Kim
2015-11-08 7:27 ` [tip:perf/urgent] " tip-bot for Wang Nan
2015-11-03 10:44 ` [PATCH 2/5] perf tools: Mute libbpf when " Wang Nan
2015-11-03 10:49 ` Wangnan (F)
2015-11-08 7:27 ` tip-bot for Wang Nan [this message]
2015-11-03 10:44 ` [PATCH 3/5] perf tools: Parsing libbpf return value using err.h Wang Nan
2015-11-03 15:17 ` Arnaldo Carvalho de Melo
2015-11-03 15:20 ` Arnaldo Carvalho de Melo
2015-11-03 10:44 ` [PATCH 4/5] bpf tools: Improve libbpf error reporting Wang Nan
2015-11-03 10:44 ` [PATCH 5/5] perf tools: Improve BPF related error messages output Wang Nan
2015-11-03 15:43 ` [PATCH 0/5] perf bpf: Improve error code delivering and output Arnaldo Carvalho de Melo
2015-11-04 1:43 ` Wangnan (F)
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=tip-7a0119468c9c2deff24ef24e1b4d2c1bd1523fd5@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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
Powered by JetHome