Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754306AbbKHH2H (ORCPT ); Sun, 8 Nov 2015 02:28:07 -0500 Received: from terminus.zytor.com ([198.137.202.10]:45905 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752837AbbKHH2E (ORCPT ); Sun, 8 Nov 2015 02:28:04 -0500 Date: Sat, 7 Nov 2015 23:27:50 -0800 From: tip-bot for Wang Nan Message-ID: Cc: lizefan@huawei.com, linux-kernel@vger.kernel.org, wangnan0@huawei.com, mingo@kernel.org, acme@redhat.com, tglx@linutronix.de, hpa@zytor.com Reply-To: lizefan@huawei.com, wangnan0@huawei.com, mingo@kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com, tglx@linutronix.de, hpa@zytor.com In-Reply-To: <1446547486-229499-3-git-send-email-wangnan0@huawei.com> References: <1446547486-229499-3-git-send-email-wangnan0@huawei.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf bpf: Mute libbpf when '-v' not set Git-Commit-ID: 7a0119468c9c2deff24ef24e1b4d2c1bd1523fd5 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3156 Lines: 92 Commit-ID: 7a0119468c9c2deff24ef24e1b4d2c1bd1523fd5 Gitweb: http://git.kernel.org/tip/7a0119468c9c2deff24ef24e1b4d2c1bd1523fd5 Author: Wang Nan AuthorDate: Tue, 3 Nov 2015 10:44:43 +0000 Committer: Arnaldo Carvalho de Melo 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 [] [] or: perf record [] -- [] -e, --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 [] [] or: perf record [] -- [] -e, --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 Tested-by: Arnaldo Carvalho de Melo Cc: Zefan Li 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 --- 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 { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/