From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, David Ahern <dsahern@gmail.com>,
Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Stephane Eranian <eranian@google.com>,
Namhyung Kim <namhyung.kim@lge.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 1/4] perf report: Fix crash showing warning related to kernel maps
Date: Fri, 20 Apr 2012 13:53:04 -0300 [thread overview]
Message-ID: <1334940787-16174-2-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1334940787-16174-1-git-send-email-acme@infradead.org>
From: David Ahern <dsahern@gmail.com>
While testing https://lkml.org/lkml/2012/4/10/123 I hit this crash:
(gdb) bt
0 0x000000000042000f in __cmd_report (rep=0x7fff80cec580) at builtin-report.c:380
1 cmd_report (argc=0, argv=<optimized out>, prefix=<optimized out>) at builtin-report.c:759
2 0x0000000000414513 in run_builtin (p=0x7724a8, argc=3, argv=0x7fff80ceca70) at perf.c:273
3 0x0000000000413d41 in handle_internal_command (argv=0x7fff80ceca70, argc=3) at perf.c:345
4 run_argv (argv=0x7fff80cec880, argcp=0x7fff80cec88c) at perf.c:389
5 main (argc=3, argv=0x7fff80ceca70) at perf.c:487
kernel_map can be NULL, so need to handle it while dumping a warning
to user.
v2:
- fixed RB_EMPTY_ROOT check -- desc takes the altnerative output when RB_EMPTY_ROOT is false.
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Link: http://lkml.kernel.org/r/1334544855-55021-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-report.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 2e31743..cdae9b2 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -374,16 +374,23 @@ static int __cmd_report(struct perf_report *rep)
(kernel_map->dso->hit &&
(kernel_kmap->ref_reloc_sym == NULL ||
kernel_kmap->ref_reloc_sym->addr == 0))) {
- const struct dso *kdso = kernel_map->dso;
+ const char *desc =
+ "As no suitable kallsyms nor vmlinux was found, kernel samples\n"
+ "can't be resolved.";
+
+ if (kernel_map) {
+ const struct dso *kdso = kernel_map->dso;
+ if (!RB_EMPTY_ROOT(&kdso->symbols[MAP__FUNCTION])) {
+ desc = "If some relocation was applied (e.g. "
+ "kexec) symbols may be misresolved.";
+ }
+ }
ui__warning(
"Kernel address maps (/proc/{kallsyms,modules}) were restricted.\n\n"
"Check /proc/sys/kernel/kptr_restrict before running 'perf record'.\n\n%s\n\n"
"Samples in kernel modules can't be resolved as well.\n\n",
- RB_EMPTY_ROOT(&kdso->symbols[MAP__FUNCTION]) ?
-"As no suitable kallsyms nor vmlinux was found, kernel samples\n"
-"can't be resolved." :
-"If some relocation was applied (e.g. kexec) symbols may be misresolved.");
+ desc);
}
if (dump_trace) {
--
1.7.9.2.358.g22243
next prev parent reply other threads:[~2012-04-20 16:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-20 16:53 [GIT PULL 0/4] perf/urgent fixes Arnaldo Carvalho de Melo
2012-04-20 16:53 ` Arnaldo Carvalho de Melo [this message]
2012-04-20 16:53 ` [PATCH 2/4] perf tools: Drop CROSS_COMPILE from flex and bison calls Arnaldo Carvalho de Melo
2012-04-20 16:53 ` [PATCH 3/4] perf tools: Add 'G' and 'H' modifiers to event parsing Arnaldo Carvalho de Melo
2012-04-20 16:53 ` [PATCH 4/4] perf symbols: Read plt symbols from proper symtab_type binary Arnaldo Carvalho de Melo
2012-04-25 7:08 ` [GIT PULL 0/4] perf/urgent fixes Ingo Molnar
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=1334940787-16174-2-git-send-email-acme@infradead.org \
--to=acme@infradead.org \
--cc=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@kernel.org \
--cc=namhyung.kim@lge.com \
--cc=peterz@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).