Skip to content

Commit

Permalink
perf machine: Fallback to MAP__FUNCTION if daddr maps are NULL
Browse files Browse the repository at this point in the history
As we run "perf c2c" on more applications, we noticed we're missing
significant samples from a common customer's application.  Looking at
the /proc/<pid>/maps file for the app, we see "rwxs" and "rwxp"
permissions on many of the shared memory & heap regions, and on all the
thread stacks.

Because those regions have the "x" bit set, perf marks them with a
MAP_FUNCTION type.  Hence ip_resolve_data() never finds load or store
events coming from them.

We fixed this by re-calling thread__find_addr_location with
MAP__FUNCTION in the case where map is NULL as a last ditch effort to
map the sample before giving up and dropping it.

Reported-by: Joe Mario <jmario@redhat.com>
Tested-by: Joe Mario <jmario@redhat.com>
Signed-off-by: Don Zickus <dzickus@redhat.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1408591511-57884-1-git-send-email-dzickus@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Don Zickus authored and Arnaldo Carvalho de Melo committed Aug 22, 2014
1 parent c09a7e7 commit 06b2afc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tools/perf/util/machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,16 @@ static void ip__resolve_data(struct machine *machine, struct thread *thread,

thread__find_addr_location(thread, machine, m, MAP__VARIABLE, addr,
&al);
if (al.map == NULL) {
/*
* some shared data regions have execute bit set which puts
* their mapping in the MAP__FUNCTION type array.
* Check there as a fallback option before dropping the sample.
*/
thread__find_addr_location(thread, machine, m, MAP__FUNCTION, addr,
&al);
}

ams->addr = addr;
ams->al_addr = al.addr;
ams->sym = al.sym;
Expand Down

0 comments on commit 06b2afc

Please sign in to comment.