From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760673AbcCEIQo (ORCPT ); Sat, 5 Mar 2016 03:16:44 -0500 Received: from torg.zytor.com ([198.137.202.12]:58686 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752465AbcCEIQh (ORCPT ); Sat, 5 Mar 2016 03:16:37 -0500 Date: Sat, 5 Mar 2016 00:15:54 -0800 From: tip-bot for Wang Nan Message-ID: Cc: linux-kernel@vger.kernel.org, lizefan@huawei.com, ast@kernel.org, mingo@kernel.org, jolsa@kernel.org, acme@redhat.com, hekuang@huawei.com, namhyung@kernel.org, tglx@linutronix.de, masami.hiramatsu.pt@hitachi.com, wangnan0@huawei.com, hpa@zytor.com, peterz@infradead.org Reply-To: wangnan0@huawei.com, hpa@zytor.com, peterz@infradead.org, tglx@linutronix.de, masami.hiramatsu.pt@hitachi.com, jolsa@kernel.org, acme@redhat.com, namhyung@kernel.org, hekuang@huawei.com, ast@kernel.org, lizefan@huawei.com, linux-kernel@vger.kernel.org, mingo@kernel.org In-Reply-To: <1456479154-136027-19-git-send-email-wangnan0@huawei.com> References: <1456479154-136027-19-git-send-email-wangnan0@huawei.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf record: Use WARN_ONCE to replace 'if' condition Git-Commit-ID: d8871ea71281ed689dc3303d1b50eb00c5d06141 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 Commit-ID: d8871ea71281ed689dc3303d1b50eb00c5d06141 Gitweb: http://git.kernel.org/tip/d8871ea71281ed689dc3303d1b50eb00c5d06141 Author: Wang Nan AuthorDate: Fri, 26 Feb 2016 09:32:06 +0000 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 3 Mar 2016 11:10:34 -0300 perf record: Use WARN_ONCE to replace 'if' condition Commits in a BPF patchkit will extract kernel and module synthesizing code into a separated function and call it multiple times. This patch replace 'if (err < 0)' using WARN_ONCE, makes sure the error message show one time. Signed-off-by: Wang Nan Cc: Alexei Starovoitov Cc: He Kuang Cc: Jiri Olsa Cc: Li Zefan Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1456479154-136027-19-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-record.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 7d11162..9dec7e5 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -33,6 +33,7 @@ #include "util/parse-regs-options.h" #include "util/llvm-utils.h" #include "util/bpf-loader.h" +#include "asm/bug.h" #include #include @@ -615,17 +616,15 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) err = perf_event__synthesize_kernel_mmap(tool, process_synthesized_event, machine); - if (err < 0) - pr_err("Couldn't record kernel reference relocation symbol\n" - "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n" - "Check /proc/kallsyms permission or run as root.\n"); + WARN_ONCE(err < 0, "Couldn't record kernel reference relocation symbol\n" + "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n" + "Check /proc/kallsyms permission or run as root.\n"); err = perf_event__synthesize_modules(tool, process_synthesized_event, machine); - if (err < 0) - pr_err("Couldn't record kernel module information.\n" - "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n" - "Check /proc/modules permission or run as root.\n"); + WARN_ONCE(err < 0, "Couldn't record kernel module information.\n" + "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n" + "Check /proc/modules permission or run as root.\n"); if (perf_guest) { machines__process_guests(&session->machines,