aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/symbol.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-11-29 09:44:15 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-11-30 11:47:51 -0500
commit8a9533123f43f2cdb3eb601c17ff2ad336882eff (patch)
tree4bf9158766d02bae702c9d741f3d1486a90d41d0 /tools/perf/util/symbol.c
parentee6dcfa40a50fe12a3ae0fb4d2653c66c3ed6556 (diff)
perf symbols: Fix kallsyms kernel/module map splitting
On ARM, module addresss space is ahead of kernel space, so the module symbols are handled before kernel symbol in dso__split_kallsyms, then was causing one map to be created for each kernel symbol. Reported-by: Ming Lei <tom.leiming@gmail.com> Tested-by: Ming Lei <tom.leiming@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Ming Lei <tom.leiming@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <20101124144540.GB15875@ghostprotocols.net> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r--tools/perf/util/symbol.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 0500895a45af..2af4d7d22373 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -532,7 +532,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map,
532 struct machine *machine = kmaps->machine; 532 struct machine *machine = kmaps->machine;
533 struct map *curr_map = map; 533 struct map *curr_map = map;
534 struct symbol *pos; 534 struct symbol *pos;
535 int count = 0; 535 int count = 0, moved = 0;
536 struct rb_root *root = &self->symbols[map->type]; 536 struct rb_root *root = &self->symbols[map->type];
537 struct rb_node *next = rb_first(root); 537 struct rb_node *next = rb_first(root);
538 int kernel_range = 0; 538 int kernel_range = 0;
@@ -590,6 +590,11 @@ static int dso__split_kallsyms(struct dso *self, struct map *map,
590 char dso_name[PATH_MAX]; 590 char dso_name[PATH_MAX];
591 struct dso *dso; 591 struct dso *dso;
592 592
593 if (count == 0) {
594 curr_map = map;
595 goto filter_symbol;
596 }
597
593 if (self->kernel == DSO_TYPE_GUEST_KERNEL) 598 if (self->kernel == DSO_TYPE_GUEST_KERNEL)
594 snprintf(dso_name, sizeof(dso_name), 599 snprintf(dso_name, sizeof(dso_name),
595 "[guest.kernel].%d", 600 "[guest.kernel].%d",
@@ -615,7 +620,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map,
615 map_groups__insert(kmaps, curr_map); 620 map_groups__insert(kmaps, curr_map);
616 ++kernel_range; 621 ++kernel_range;
617 } 622 }
618 623filter_symbol:
619 if (filter && filter(curr_map, pos)) { 624 if (filter && filter(curr_map, pos)) {
620discard_symbol: rb_erase(&pos->rb_node, root); 625discard_symbol: rb_erase(&pos->rb_node, root);
621 symbol__delete(pos); 626 symbol__delete(pos);
@@ -623,8 +628,9 @@ discard_symbol: rb_erase(&pos->rb_node, root);
623 if (curr_map != map) { 628 if (curr_map != map) {
624 rb_erase(&pos->rb_node, root); 629 rb_erase(&pos->rb_node, root);
625 symbols__insert(&curr_map->dso->symbols[curr_map->type], pos); 630 symbols__insert(&curr_map->dso->symbols[curr_map->type], pos);
626 } 631 ++moved;
627 count++; 632 } else
633 ++count;
628 } 634 }
629 } 635 }
630 636
@@ -634,7 +640,7 @@ discard_symbol: rb_erase(&pos->rb_node, root);
634 dso__set_loaded(curr_map->dso, curr_map->type); 640 dso__set_loaded(curr_map->dso, curr_map->type);
635 } 641 }
636 642
637 return count; 643 return count + moved;
638} 644}
639 645
640int dso__load_kallsyms(struct dso *self, const char *filename, 646int dso__load_kallsyms(struct dso *self, const char *filename,