All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/9] perf top: Exit if specified --vmlinux can't be used
@ 2010-01-27 23:05 Arnaldo Carvalho de Melo
  2010-01-27 23:05 ` [PATCH 2/9] perf symbols: Factor out dso__load_vmlinux_path() Arnaldo Carvalho de Melo
                   ` (7 more replies)
  0 siblings, 8 replies; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-01-27 23:05 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo,
	Frédéric Weisbecker, Mike Galbraith, Peter Zijlstra,
	Paul Mackerras

From: Arnaldo Carvalho de Melo <acme@redhat.com>

As we do lazy loading of symtabs we only will know if the specified
vmlinux file is invalid when we actually have a hit in kernel space and
then try to load it. So if we get kernel hits and there are _no_ symbols
in the DSO backing the kernel map, bail out.

Reported-by: Mike Galbraith <efault@gmx.de>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 2227b84..78f9c45 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -951,9 +951,31 @@ static void event__process_sample(const event_t *self,
 	}
 
 	if (event__preprocess_sample(self, session, &al, symbol_filter) < 0 ||
-	    al.sym == NULL || al.filtered)
+	    al.filtered)
 		return;
 
+	if (al.sym == NULL) {
+		/*
+		 * As we do lazy loading of symtabs we only will know if the
+		 * specified vmlinux file is invalid when we actually have a
+		 * hit in kernel space and then try to load it. So if we get
+		 * here and there are _no_ symbols in the DSO backing the
+		 * kernel map, bail out.
+		 *
+		 * We may never get here, for instance, if we use -K/
+		 * --hide-kernel-symbols, even if the user specifies an
+		 * invalid --vmlinux ;-)
+		 */
+		if (al.map == session->vmlinux_maps[MAP__FUNCTION] &&
+		    RB_EMPTY_ROOT(&al.map->dso->symbols[MAP__FUNCTION])) {
+			pr_err("The %s file can't be used\n",
+			       symbol_conf.vmlinux_name);
+			exit(1);
+		}
+
+		return;
+	}
+
 	syme = symbol__priv(al.sym);
 	if (!syme->skip) {
 		syme->count[counter]++;
-- 
1.6.2.5


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2010-01-29  9:40 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-27 23:05 [PATCH 1/9] perf top: Exit if specified --vmlinux can't be used Arnaldo Carvalho de Melo
2010-01-27 23:05 ` [PATCH 2/9] perf symbols: Factor out dso__load_vmlinux_path() Arnaldo Carvalho de Melo
2010-01-27 23:05 ` [PATCH 3/9] perf symbols: Split helpers used when creating kernel dso object Arnaldo Carvalho de Melo
2010-01-27 23:05 ` [PATCH 4/9] perf session: Create kernel maps in the constructor Arnaldo Carvalho de Melo
2010-01-27 23:17   ` Masami Hiramatsu
2010-01-27 23:29     ` Arnaldo Carvalho de Melo
2010-01-28 16:28       ` Masami Hiramatsu
2010-01-28 18:29         ` Arnaldo Carvalho de Melo
2010-01-28 20:59           ` Masami Hiramatsu
2010-01-29  0:42             ` Arnaldo Carvalho de Melo
2010-01-29  7:01               ` Masami Hiramatsu
2010-01-27 23:05 ` [PATCH 5/9] perf symbols: Remove perf_session usage in symbols layer Arnaldo Carvalho de Melo
2010-01-27 23:05 ` [PATCH 6/9] perf: Ignore perf-archive temp file Arnaldo Carvalho de Melo
2010-01-29  9:33   ` [tip:perf/core] " tip-bot for John Kacur
2010-01-29  9:39   ` tip-bot for John Kacur
2010-01-27 23:05 ` [PATCH 7/9] tools/perf/perf.c: Clean up trivial style issues Arnaldo Carvalho de Melo
2010-01-29  9:32   ` [tip:perf/core] " tip-bot for Thiago Farina
2010-01-29  9:39   ` tip-bot for Thiago Farina
2010-01-27 23:05 ` [PATCH 8/9] perf symbols: Fixup vsyscall maps Arnaldo Carvalho de Melo
2010-01-27 23:05 ` [PATCH 9/9] perf symbols: Ditch vdso global variable Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.