* [PATCH 1/2] perf symbols: Set dso->kernel when handling the fake vmlinux MMAP event
@ 2010-01-19 12:36 Arnaldo Carvalho de Melo
2010-01-19 12:36 ` [PATCH 2/2] perf symbols: If only --vmlinux if specified Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-01-19 12:36 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Jamie Iles,
Frédéric Weisbecker, Mike Galbraith, Peter Zijlstra,
Paul Mackerras
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Because it may be possible that there was no buildid section, where we
would set this to 1.
Found while analysing a perf.data file collected on an ARM machine where
an explicitely specified vmlinux was being disregarded.
Reported-by: Jamie Iles <jamie.iles@picochip.com>
Cc: Jamie Iles <jamie.iles@picochip.com>
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/util/event.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index dc13cad..bbaee61 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -373,6 +373,7 @@ int event__process_mmap(event_t *self, struct perf_session *session)
if (kernel == NULL)
goto out_problem;
+ kernel->kernel = 1;
if (__map_groups__create_kernel_maps(&session->kmaps,
session->vmlinux_maps,
kernel) < 0)
--
1.6.2.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] perf symbols: If only --vmlinux if specified
2010-01-19 12:36 [PATCH 1/2] perf symbols: Set dso->kernel when handling the fake vmlinux MMAP event Arnaldo Carvalho de Melo
@ 2010-01-19 12:36 ` Arnaldo Carvalho de Melo
2010-01-19 12:40 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-01-19 12:36 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Jamie Iles,
Frédéric Weisbecker, Mike Galbraith, Peter Zijlstra,
Paul Mackerras
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Found while analysing a perf.data file collected on an ARM machine where
an explicitely specified vmlinux was being disregarded.
Reported-by: Jamie Iles <jamie.iles@picochip.com>
Cc: Jamie Iles <jamie.iles@picochip.com>
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/util/symbol.c | 67 ++++++++++++++++++++++++++++------------------
1 files changed, 41 insertions(+), 26 deletions(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index a4e7459..b6ab23d 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1572,7 +1572,7 @@ static int dso__load_vmlinux(struct dso *self, struct map *map,
return -1;
dso__set_loaded(self, map->type);
- err = dso__load_sym(self, map, session, self->long_name, fd, filter, 1, 0);
+ err = dso__load_sym(self, map, session, vmlinux, fd, filter, 1, 0);
close(fd);
return err;
@@ -1584,6 +1584,26 @@ static int dso__load_kernel_sym(struct dso *self, struct map *map,
int err;
const char *kallsyms_filename = NULL;
char *kallsyms_allocated_filename = NULL;
+ /*
+ * Step 1: if the user specified a vmlinux filename, use it and only
+ * it, reporting errors to the user if it cannot be used.
+ *
+ * For instance, try to analyse an ARM perf.data file _without_ a
+ * build-id, or if the user specifies the wrong path to the right
+ * vmlinux file, obviously we can't fallback to another vmlinux (a
+ * x86_86 one, on the machine where analysis is being performed, say),
+ * or worse, /proc/kallsyms.
+ *
+ * If the specified file _has_ a build-id and there is a build-id
+ * section in the perf.data file, we will still do the expected
+ * validation in dso__load_vmlinux and will bail out if they don't
+ * match.
+ */
+ if (symbol_conf.vmlinux_name != NULL) {
+ err = dso__load_vmlinux(self, map, session,
+ symbol_conf.vmlinux_name, filter);
+ goto out_try_fixup;
+ }
if (vmlinux_path != NULL) {
int i;
@@ -1618,46 +1638,41 @@ static int dso__load_kernel_sym(struct dso *self, struct map *map,
goto do_kallsyms;
}
}
-
+ /*
+ * Now look if we have it on the build-id cache in
+ * $HOME/.debug/[kernel.kallsyms].
+ */
build_id__sprintf(self->build_id, sizeof(self->build_id),
sbuild_id);
if (asprintf(&kallsyms_allocated_filename,
"%s/.debug/[kernel.kallsyms]/%s",
- getenv("HOME"), sbuild_id) != -1) {
- if (access(kallsyms_filename, F_OK)) {
- kallsyms_filename = kallsyms_allocated_filename;
- goto do_kallsyms;
- }
+ getenv("HOME"), sbuild_id) == -1)
+ return -1;
+
+ if (access(kallsyms_filename, F_OK)) {
free(kallsyms_allocated_filename);
- kallsyms_allocated_filename = NULL;
+ return -1;
}
- goto do_vmlinux;
- }
-
- if (self->long_name[0] == '[') {
+ kallsyms_filename = kallsyms_allocated_filename;
+ } else {
+ /*
+ * Last resort, if we don't have a build-id and couldn't find
+ * any vmlinux file, try the running kernel kallsyms table.
+ */
kallsyms_filename = "/proc/kallsyms";
- goto do_kallsyms;
}
-do_vmlinux:
- err = dso__load_vmlinux(self, map, session, self->long_name, filter);
- if (err <= 0) {
- if (self->has_build_id)
- return -1;
-
- pr_info("The file %s cannot be used, "
- "trying to use /proc/kallsyms...", self->long_name);
do_kallsyms:
- err = dso__load_kallsyms(self, kallsyms_filename, map, session, filter);
- if (err > 0 && kallsyms_filename == NULL)
- dso__set_long_name(self, strdup("[kernel.kallsyms]"));
- free(kallsyms_allocated_filename);
- }
+ err = dso__load_kallsyms(self, kallsyms_filename, map, session, filter);
+ free(kallsyms_allocated_filename);
+out_try_fixup:
if (err > 0) {
out_fixup:
+ if (kallsyms_filename == NULL)
+ dso__set_long_name(self, strdup("[kernel.kallsyms]"));
map__fixup_start(map);
map__fixup_end(map);
}
--
1.6.2.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] perf symbols: If only --vmlinux if specified
2010-01-19 12:36 ` [PATCH 2/2] perf symbols: If only --vmlinux if specified Arnaldo Carvalho de Melo
@ 2010-01-19 12:40 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-01-19 12:40 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Jamie Iles, Frédéric Weisbecker,
Mike Galbraith, Peter Zijlstra, Paul Mackerras
Em Tue, Jan 19, 2010 at 10:36:14AM -0200, Arnaldo Carvalho de Melo escreveu:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> Found while analysing a perf.data file collected on an ARM machine where
> an explicitely specified vmlinux was being disregarded.
>
Sorry, the patch title should read:
"perf symbols: Use only --vmlinux if specified"
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-01-19 12:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-19 12:36 [PATCH 1/2] perf symbols: Set dso->kernel when handling the fake vmlinux MMAP event Arnaldo Carvalho de Melo
2010-01-19 12:36 ` [PATCH 2/2] perf symbols: If only --vmlinux if specified Arnaldo Carvalho de Melo
2010-01-19 12:40 ` Arnaldo Carvalho de Melo
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).