Patch "perf report: Ensure the perf DSO mapping matches what libdw sees" has been added to the 4.9-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
perf report: Ensure the perf DSO mapping matches what libdw sees
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
perf-report-ensure-the-perf-dso-mapping-matches-what-libdw-sees.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Mon Apr 9 17:09:24 CEST 2018
From: Milian Wolff <[email protected]>
Date: Fri, 2 Jun 2017 16:37:52 +0200
Subject: perf report: Ensure the perf DSO mapping matches what libdw sees
From: Milian Wolff <[email protected]>
[ Upstream commit 2538b9e2450ae255337c04356e9e0f8cb9ec48d9 ]
In some situations the libdw unwinder stopped working properly. I.e. with libunwind we see:
~~~~~heaptrack_gui 2228 135073.400112: 641314 cycles:
e8ed _dl_fixup (/usr/lib/ld-2.25.so) 15f06 _dl_runtime_resolve_sse_vex (/usr/lib/ld-2.25.so) ed94c KDynamicJobTracker::KDynamicJobTracker (/home/milian/projects/compiled/kf5/lib64/libKF5KIOWidgets.so.5.35.0) 608f3 _GLOBAL__sub_I_kdynamicjobtracker.cpp (/home/milian/projects/compiled/kf5/lib64/libKF5KIOWidgets.so.5.35.0) f199 call_init.part.0 (/usr/lib/ld-2.25.so) f2a5 _dl_init (/usr/lib/ld-2.25.so) db9 _dl_start_user (/usr/lib/ld-2.25.so)
~~~~~
But with libdw and without this patch this sample is not properly unwound:
~~~~~heaptrack_gui 2228 135073.400112: 641314 cycles:
e8ed _dl_fixup (/usr/lib/ld-2.25.so) 15f06 _dl_runtime_resolve_sse_vex (/usr/lib/ld-2.25.so) ed94c KDynamicJobTracker::KDynamicJobTracker (/home/milian/projects/compiled/kf5/lib64/libKF5KIOWidgets.so.5.35.0)
~~~~~
Debug output showed me that libdw found a module for the last frame address, but it thinks it belongs to /usr/lib/ld-2.25.so. This patch double-checks what libdw sees and what perf knows. If the mappings mismatch, we now report the elf known to perf. This fixes the situation above, and the libdw unwinder produces the same stack as libunwind.
--- tools/perf/util/unwind-libdw.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/perf/util/unwind-libdw.c +8 -0
@@ -38,6 +38,14 @@ static int __report_module(struct addr_lreturn 0 ; mod =dwfl_addrmodule (ui->dwfl, ip); +if (mod) { +Dwarf_Addr s; + +dwfl_module_info (mod,NULL , &s,NULL ,NULL ,NULL ,NULL ,NULL ); +if (s != al->map->start) + mod =0 ; + } +if (!mod) mod = dwfl_report_elf(ui->dwfl, dso->short_name, dso->long_name, -1, al->map->start,
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/perf-report-fix-off-by-one-for-non-activation-frames.patch queue-4.9/perf-report-ensure-the-perf-dso-mapping-matches-what-libdw-sees.patch