From patchwork Mon Feb 29 19:22:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 63247 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1426949lbc; Mon, 29 Feb 2016 11:22:43 -0800 (PST) X-Received: by 10.98.11.88 with SMTP id t85mr24315147pfi.98.1456773757950; Mon, 29 Feb 2016 11:22:37 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r15si28020547pfi.140.2016.02.29.11.22.37; Mon, 29 Feb 2016 11:22:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754079AbcB2TW3 (ORCPT + 30 others); Mon, 29 Feb 2016 14:22:29 -0500 Received: from casper.infradead.org ([85.118.1.10]:40900 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753981AbcB2TWY (ORCPT ); Mon, 29 Feb 2016 14:22:24 -0500 Received: from [187.65.76.58] (helo=jouet.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.85 #2 (Red Hat Linux)) id 1aaTOa-0003v1-M5; Mon, 29 Feb 2016 19:22:17 +0000 Received: by jouet.infradead.org (Postfix, from userid 1000) id 8FB9A143530; Mon, 29 Feb 2016 16:22:08 -0300 (BRT) From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Wang Nan , Alexei Starovoitov , He Kuang , Jiri Olsa , Li Zefan , Masami Hiramatsu , Namhyung Kim , Peter Zijlstra , pi3orama@163.com, Arnaldo Carvalho de Melo Subject: [PATCH 08/11] perf record: Use WARN_ONCE to replace 'if' condition Date: Mon, 29 Feb 2016 16:22:04 -0300 Message-Id: <1456773727-3005-9-git-send-email-acme@kernel.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456773727-3005-1-git-send-email-acme@kernel.org> References: <1456773727-3005-1-git-send-email-acme@kernel.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wang Nan 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(-) -- 2.5.0 diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 7d11162b6c41..9dec7e529832 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,