Skip to content

Commit

Permalink
perf_counter tools: Handle overlapping MMAP events
Browse files Browse the repository at this point in the history
Martin Schwidefsky reported "perf report" symbol resolution
problems on S390.

Since we only report MMAP, not MUNMAP, we have to deal with
overlapping maps.

We used to simply throw out the old map on the assumption whole
maps got unmapped. This obviously doesn't deal with partial
unmaps. However it appears some dynamic linkers do fancy
partial unmaps (s390), so do something more elaborate and
truncate the old maps, only removing them when they've been
fully covered.

This resolves (part of) the S390 symbol resolution problems.

Reported-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Tested-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Jun 23, 2009
1 parent dee4120 commit 3d906ef
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,27 @@ static void thread__insert_map(struct thread *self, struct map *map)

list_for_each_entry_safe(pos, tmp, &self->maps, node) {
if (map__overlap(pos, map)) {
list_del_init(&pos->node);
/* XXX leaks dsos */
free(pos);
if (verbose >= 2) {
printf("overlapping maps:\n");
map__fprintf(map, stdout);
map__fprintf(pos, stdout);
}

if (map->start <= pos->start && map->end > pos->start)
pos->start = map->end;

if (map->end >= pos->end && map->start < pos->end)
pos->end = map->start;

if (verbose >= 2) {
printf("after collision:\n");
map__fprintf(pos, stdout);
}

if (pos->start >= pos->end) {
list_del_init(&pos->node);
free(pos);
}
}
}

Expand Down

0 comments on commit 3d906ef

Please sign in to comment.