diff options
author | David Ahern <dsahern@gmail.com> | 2012-07-20 19:25:49 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-07-25 10:30:13 -0400 |
commit | adb5d2a487c55e5ca2ecc0b73c8f592e95d292c7 (patch) | |
tree | 7d479665da86eb90560e6838a8e6536e99b8fdba /tools | |
parent | 7c0f4a4113ba5de7898c246eeaeee4c23d94b887 (diff) |
perf kvm: Fix bug resolving guest kernel syms
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
...
v2:
- changed rbtree walk to use rb_first per Namhyung's suggestion
Tested-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1342826756-64663-5-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/map.c | 13 | ||||
-rw-r--r-- | tools/perf/util/map.h | 1 | ||||
-rw-r--r-- | tools/perf/util/session.c | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index 8668569d4b2a..16d783d322b6 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
@@ -729,3 +729,16 @@ char *machine__mmap_name(struct machine *self, char *bf, size_t size) | |||
729 | 729 | ||
730 | return bf; | 730 | return bf; |
731 | } | 731 | } |
732 | |||
733 | void machines__set_id_hdr_size(struct rb_root *machines, u16 id_hdr_size) | ||
734 | { | ||
735 | struct rb_node *node; | ||
736 | struct machine *machine; | ||
737 | |||
738 | for (node = rb_first(machines); node; node = rb_next(node)) { | ||
739 | machine = rb_entry(node, struct machine, rb_node); | ||
740 | machine->id_hdr_size = id_hdr_size; | ||
741 | } | ||
742 | |||
743 | return; | ||
744 | } | ||
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h index c14c665d9a25..03a1e9b08b21 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, | |||
151 | struct machine *machines__find_host(struct rb_root *self); | 151 | struct machine *machines__find_host(struct rb_root *self); |
152 | struct machine *machines__find(struct rb_root *self, pid_t pid); | 152 | struct machine *machines__find(struct rb_root *self, pid_t pid); |
153 | struct machine *machines__findnew(struct rb_root *self, pid_t pid); | 153 | struct machine *machines__findnew(struct rb_root *self, pid_t pid); |
154 | void machines__set_id_hdr_size(struct rb_root *self, u16 id_hdr_size); | ||
154 | char *machine__mmap_name(struct machine *self, char *bf, size_t size); | 155 | char *machine__mmap_name(struct machine *self, char *bf, size_t size); |
155 | int machine__init(struct machine *self, const char *root_dir, pid_t pid); | 156 | int machine__init(struct machine *self, const char *root_dir, pid_t pid); |
156 | void machine__exit(struct machine *self); | 157 | void machine__exit(struct machine *self); |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 90ee39dd8ab2..8e4f0755d2aa 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -87,6 +87,7 @@ void perf_session__update_sample_type(struct perf_session *self) | |||
87 | self->sample_id_all = perf_evlist__sample_id_all(self->evlist); | 87 | self->sample_id_all = perf_evlist__sample_id_all(self->evlist); |
88 | self->id_hdr_size = perf_evlist__id_hdr_size(self->evlist); | 88 | self->id_hdr_size = perf_evlist__id_hdr_size(self->evlist); |
89 | self->host_machine.id_hdr_size = self->id_hdr_size; | 89 | self->host_machine.id_hdr_size = self->id_hdr_size; |
90 | machines__set_id_hdr_size(&self->machines, self->id_hdr_size); | ||
90 | } | 91 | } |
91 | 92 | ||
92 | int perf_session__create_kernel_maps(struct perf_session *self) | 93 | int perf_session__create_kernel_maps(struct perf_session *self) |