aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Miller <davem@davemloft.net>2012-03-27 03:14:18 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-22 19:21:24 -0400
commit7c1c9e652c05a76095734799bea10b2da3b35638 (patch)
tree47527307a1f24a9cff505f6f788a13d58201b7b0 /tools
parentcaa6b6d39d177e872297a868d22c2fc3c770534a (diff)
perf hists: Catch and handle out-of-date hist entry maps.
commit 63fa471dd49e9c9ce029d910d1024330d9b1b145 upstream. 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> Link: http://lkml.kernel.org/r/20120327.031418.1220315351537060808.davem@davemloft.net Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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 627a02e03c5..d25fded72a1 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -158,6 +158,18 @@ struct hist_entry *__hists__add_entry(struct hists *self,
158 if (!cmp) { 158 if (!cmp) {
159 he->period += period; 159 he->period += period;
160 ++he->nr_events; 160 ++he->nr_events;
161
162 /* If the map of an existing hist_entry has
163 * become out-of-date due to an exec() or
164 * similar, update it. Otherwise we will
165 * mis-adjust symbol addresses when computing
166 * the history counter to increment.
167 */
168 if (he->ms.map != entry->ms.map) {
169 he->ms.map = entry->ms.map;
170 if (he->ms.map)
171 he->ms.map->referenced = true;
172 }
161 goto out; 173 goto out;
162 } 174 }
163 175