aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Miller <davem@davemloft.net>2012-03-27 03:14:18 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-04-05 17:53:47 -0400
commit63fa471dd49e9c9ce029d910d1024330d9b1b145 (patch)
treeb595c59b494f145e619b22c28f9d1629fb724092 /tools
parent8b84a568117fde9b77575f2060274eddab424c32 (diff)
perf hists: Catch and handle out-of-date hist entry maps.
When a process exec()'s, all the maps are retired, but we keep the hist entries around which hold references to those outdated maps. If the same library gets mapped in for which we have hist entries, a new map will be created. But when we take a perf entry hit within that map, we'll find the existing hist entry with the older map. This causes symbol translations to be done incorrectly. For example, the perf entry processing will lookup the correct uptodate map entry and use that to calculate the symbol and DSO relative address. But later when we update the histogram we'll translate the address using the outdated map file instead leading to conditions such as out-of-range offsets in symbol__inc_addr_samples(). Therefore, update the map of the hist_entry dynamically at lookup/ creation time. Signed-off-by: David S. Miller <davem@davemloft.net> Cc: stable@kernel.org Link: http://lkml.kernel.org/r/20120327.031418.1220315351537060808.davem@davemloft.net Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/hist.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 2ec4b60aff6c..9f6d630d5316 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -256,6 +256,18 @@ static struct hist_entry *add_hist_entry(struct hists *hists,
256 if (!cmp) { 256 if (!cmp) {
257 he->period += period; 257 he->period += period;
258 ++he->nr_events; 258 ++he->nr_events;
259
260 /* If the map of an existing hist_entry has
261 * become out-of-date due to an exec() or
262 * similar, update it. Otherwise we will
263 * mis-adjust symbol addresses when computing
264 * the history counter to increment.
265 */
266 if (he->ms.map != entry->ms.map) {
267 he->ms.map = entry->ms.map;
268 if (he->ms.map)
269 he->ms.map->referenced = true;
270 }
259 goto out; 271 goto out;
260 } 272 }
261 273