From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org,
"Arnaldo Carvalho de Melo" <acme@redhat.com>,
"Frédéric Weisbecker" <fweisbec@gmail.com>,
"Mike Galbraith" <efault@gmx.de>,
"Peter Zijlstra" <a.p.zijlstra@chello.nl>,
"Paul Mackerras" <paulus@samba.org>
Subject: [PATCH 5/6] perf symbols: Check vmlinux buildid
Date: Fri, 20 Nov 2009 20:51:28 -0200 [thread overview]
Message-ID: <1258757489-5978-5-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1258757489-5978-4-git-send-email-acme@infradead.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
E.g.:
[root@doppio linux-2.6-tip]# perf top -v --vmlinux ../build/tip/vmlinux > /dev/null
build_id in vmlinux is e96699725a47413a50c231864a8e7a8ced40a31b while
expected is 18e7cc53db62a7d35e9d6f6c9ddc23017d38ee9a, ignoring it
I.e. perf top was told to use a vmlinux file that is not the one
currently running on the machine, it ignores it and falls back to using
/proc/kallsyms.
This solves many, at first, mysterious results when people have a stale
vmlinux file while keeping the default of trying to use the vmlinux file
in the current directory in things like 'perf annotate' where the DWARF
info is required and thus we can't use just /proc/kallsyms.
Modules buildids are already being checked as of the previous changeset
in this series, because we are using the default dso__load routine, that
will look at a series of places looking for the best file with a
matching buildid, starting in the -debuginfo directories.
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 | 28 ++++++++++++++++++++++++++--
1 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index cb086cb..9cf6dbc 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1334,13 +1334,37 @@ out_failure:
static int dso__load_vmlinux(struct dso *self, struct map *map,
const char *vmlinux, symbol_filter_t filter)
{
- int err, fd = open(vmlinux, O_RDONLY);
+ int err = -1, fd;
- self->loaded = 1;
+ if (self->has_build_id) {
+ u8 build_id[BUILD_ID_SIZE];
+
+ if (filename__read_build_id(vmlinux, build_id,
+ sizeof(build_id)) < 0) {
+ pr_debug("No build_id in %s, ignoring it\n", vmlinux);
+ return -1;
+ }
+ if (!dso__build_id_equal(self, build_id)) {
+ char expected_build_id[BUILD_ID_SIZE * 2 + 1],
+ vmlinux_build_id[BUILD_ID_SIZE * 2 + 1];
+
+ build_id__sprintf(self->build_id,
+ sizeof(self->build_id),
+ expected_build_id);
+ build_id__sprintf(build_id, sizeof(build_id),
+ vmlinux_build_id);
+ pr_debug("build_id in %s is %s while expected is %s, "
+ "ignoring it\n", vmlinux, vmlinux_build_id,
+ expected_build_id);
+ return -1;
+ }
+ }
+ fd = open(vmlinux, O_RDONLY);
if (fd < 0)
return -1;
+ self->loaded = 1;
err = dso__load_sym(self, map, self->long_name, fd, filter, 1, 0);
close(fd);
--
1.6.2.5
next prev parent reply other threads:[~2009-11-20 22:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-20 22:51 [PATCH 1/6] perf symbols: Remove unrelated actions from dso__load_kernel_sym Arnaldo Carvalho de Melo
2009-11-20 22:51 ` [PATCH 2/6] perf symbols: filename__read_build_id should look at .notes section too Arnaldo Carvalho de Melo
2009-11-20 22:51 ` [PATCH 3/6] perf symbols: Introduce dso__build_id_equal Arnaldo Carvalho de Melo
2009-11-20 22:51 ` [PATCH 4/6] perf symbols: Do lazy symtab loading for the kernel & modules too Arnaldo Carvalho de Melo
2009-11-20 22:51 ` Arnaldo Carvalho de Melo [this message]
2009-11-20 22:51 ` [PATCH 6/6] perf symbols: Change the kernel DSO name if it comes from kallsyms Arnaldo Carvalho de Melo
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=1258757489-5978-5-git-send-email-acme@infradead.org \
--to=acme@infradead.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=efault@gmx.de \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.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
all inboxes | Powered by JetHome®