aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2016-02-26 04:32:06 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-03-03 09:10:34 -0500
commitd8871ea71281ed689dc3303d1b50eb00c5d06141 (patch)
tree29e326be8573cd16601613eacd56f7f831f8cf00
parentf8dd2d5ff953bc498d682ae8022439c940a7d5c4 (diff)
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 <wangnan0@huawei.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: He Kuang <hekuang@huawei.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Li Zefan <lizefan@huawei.com> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Zefan Li <lizefan@huawei.com> 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 <acme@redhat.com>
-rw-r--r--tools/perf/builtin-record.c15
1 files changed, 7 insertions, 8 deletions
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 @@
33#include "util/parse-regs-options.h" 33#include "util/parse-regs-options.h"
34#include "util/llvm-utils.h" 34#include "util/llvm-utils.h"
35#include "util/bpf-loader.h" 35#include "util/bpf-loader.h"
36#include "asm/bug.h"
36 37
37#include <unistd.h> 38#include <unistd.h>
38#include <sched.h> 39#include <sched.h>
@@ -615,17 +616,15 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
615 616
616 err = perf_event__synthesize_kernel_mmap(tool, process_synthesized_event, 617 err = perf_event__synthesize_kernel_mmap(tool, process_synthesized_event,
617 machine); 618 machine);
618 if (err < 0) 619 WARN_ONCE(err < 0, "Couldn't record kernel reference relocation symbol\n"
619 pr_err("Couldn't record kernel reference relocation symbol\n" 620 "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
620 "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n" 621 "Check /proc/kallsyms permission or run as root.\n");
621 "Check /proc/kallsyms permission or run as root.\n");
622 622
623 err = perf_event__synthesize_modules(tool, process_synthesized_event, 623 err = perf_event__synthesize_modules(tool, process_synthesized_event,
624 machine); 624 machine);
625 if (err < 0) 625 WARN_ONCE(err < 0, "Couldn't record kernel module information.\n"
626 pr_err("Couldn't record kernel module information.\n" 626 "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
627 "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n" 627 "Check /proc/modules permission or run as root.\n");
628 "Check /proc/modules permission or run as root.\n");
629 628
630 if (perf_guest) { 629 if (perf_guest) {
631 machines__process_guests(&session->machines, 630 machines__process_guests(&session->machines,