From: David Ahern <dsahern@gmail.com>
To: acme@ghostprotocols.net, mingo@kernel.org, linux-kernel@vger.kernel.org
Cc: David Ahern <dsahern@gmail.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@gmail.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: [PATCH 4/4] perf kvm: fix bug resolving guest kernel syms
Date: Tue, 10 Jul 2012 15:48:14 -0600 [thread overview]
Message-ID: <1341956894-69284-5-git-send-email-dsahern@gmail.com> (raw)
In-Reply-To: <1341956894-69284-1-git-send-email-dsahern@gmail.com>
Guest kernel symbols are not resolved despite passing the information
needed to resolve them. e.g.,
perf kvm --guest --guestmount=/tmp/guest-mount record -a -- sleep 1
perf kvm --guest --guestmount=/tmp/guest-mount report --stdio
36.55% [guest/11399] [unknown] [g] 0xffffffff81600bc8
33.19% [guest/10474] [unknown] [g] 0x00000000c0116e00
30.26% [guest/11094] [unknown] [g] 0xffffffff8100a288
43.69% [guest/10474] [unknown] [g] 0x00000000c0103d90
37.38% [guest/11399] [unknown] [g] 0xffffffff81600bc8
12.24% [guest/11094] [unknown] [g] 0xffffffff810aa91d
6.69% [guest/11094] [unknown] [u] 0x00007fa784d721c3
which is just pathetic.
After a maddening 2 days sifting through perf minutia I found it --
id_hdr_size is not initialized for guest machines. This shows up on the
report side as random garbage for the cpu and timestamp, e.g.,
29816 7310572949125804849 0x1ac0 [0x50]: PERF_RECORD_MMAP ...
that messes up the sample sorting such that synthesized guest maps are
processed last.
With this patch you get a much more helpful report:
12.11% [guest/11399] [guest.kernel.kallsyms.11399] [g] irqtime_account_process_tick
10.58% [guest/11399] [guest.kernel.kallsyms.11399] [g] run_timer_softirq
6.95% [guest/11094] [guest.kernel.kallsyms.11094] [g] printk_needs_cpu
6.50% [guest/11094] [guest.kernel.kallsyms.11094] [g] do_timer
6.45% [guest/11399] [guest.kernel.kallsyms.11399] [g] idle_balance
4.90% [guest/11094] [guest.kernel.kallsyms.11094] [g] native_read_tsc
...
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
---
tools/perf/util/map.c | 24 ++++++++++++++++++++++++
tools/perf/util/map.h | 1 +
tools/perf/util/session.c | 1 +
3 files changed, 26 insertions(+)
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 641377e..da3411b 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -730,3 +730,27 @@ char *machine__mmap_name(struct machine *self, char *bf, size_t size)
return bf;
}
+
+void machines__set_id_hdr_size(struct rb_root *self, u16 id_hdr_size)
+{
+ struct rb_node *p;
+ struct machine *machine;
+
+ p = self->rb_node;
+ while (p != NULL) {
+ machine = rb_entry(p, struct machine, rb_node);
+ machine->id_hdr_size = id_hdr_size;
+ p = rb_next(p);
+ }
+
+ p = self->rb_node;
+ if (p)
+ p = rb_prev(p);
+ while (p != NULL) {
+ machine = rb_entry(p, struct machine, rb_node);
+ machine->id_hdr_size = id_hdr_size;
+ p = rb_prev(p);
+ }
+
+ return;
+}
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index 81371ba..7159b3c 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -151,6 +151,7 @@ struct machine *machines__add(struct rb_root *self, pid_t pid,
struct machine *machines__find_host(struct rb_root *self);
struct machine *machines__find(struct rb_root *self, pid_t pid);
struct machine *machines__findnew(struct rb_root *self, pid_t pid);
+void machines__set_id_hdr_size(struct rb_root *self, u16 id_hdr_size);
char *machine__mmap_name(struct machine *self, char *bf, size_t size);
int machine__init(struct machine *self, const char *root_dir, pid_t pid);
void machine__exit(struct machine *self);
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 7c31623..fcf9498 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -86,6 +86,7 @@ void perf_session__update_sample_type(struct perf_session *self)
self->sample_id_all = perf_evlist__sample_id_all(self->evlist);
self->id_hdr_size = perf_evlist__id_hdr_size(self->evlist);
self->host_machine.id_hdr_size = self->id_hdr_size;
+ machines__set_id_hdr_size(&self->machines, self->id_hdr_size);
}
int perf_session__create_kernel_maps(struct perf_session *self)
--
1.7.10.1
next prev parent reply other threads:[~2012-07-10 21:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-10 21:48 [PATCH 0/4] perf kvm: more bug fixes and cleanups David Ahern
2012-07-10 21:48 ` [PATCH 1/4] perf kvm: set name for VM process in guest machine David Ahern
2012-07-10 21:48 ` [PATCH 2/4] perf kvm: guest userspace samples should not be lumped with host uspace David Ahern
2012-07-10 21:48 ` [PATCH 3/4] perf kvm: limit repetitive guestmount message to once David Ahern
2012-07-10 21:48 ` David Ahern [this message]
2012-07-11 0:54 ` [PATCH 4/4] perf kvm: fix bug resolving guest kernel syms Namhyung Kim
2012-07-11 2:16 ` David Ahern
2012-07-11 2:30 ` Namhyung Kim
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=1341956894-69284-5-git-send-email-dsahern@gmail.com \
--to=dsahern@gmail.com \
--cc=acme@ghostprotocols.net \
--cc=acme@redhat.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@gmail.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 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.