Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1659957

[tip:perf/urgent] perf report: Ensure the perf DSO mapping matches what libdw sees

From tip-bot for Milian Wolff <tipbot@zytor.com>
Newsgroups linux.kernel
Subject [tip:perf/urgent] perf report: Ensure the perf DSO mapping matches what libdw sees
Date 2017-06-07 18:10 +0200
Message-ID <tPLGV-rD-7@gated-at.bofh.it> (permalink)
References <tNVU5-2oY-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Commit-ID:  2538b9e2450ae255337c04356e9e0f8cb9ec48d9
Gitweb:     http://git.kernel.org/tip/2538b9e2450ae255337c04356e9e0f8cb9ec48d9
Author:     Milian Wolff <milian.wolff@kdab.com>
AuthorDate: Fri, 2 Jun 2017 16:37:52 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Jun 2017 14:18:05 -0300

perf report: Ensure the perf DSO mapping matches what libdw sees

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.

Signed-off-by: Milian Wolff <milian.wolff@kdab.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20170602143753.16907-1-milian.wolff@kdab.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/unwind-libdw.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c
index b4c2012..da45c4b 100644
--- a/tools/perf/util/unwind-libdw.c
+++ b/tools/perf/util/unwind-libdw.c
@@ -39,6 +39,14 @@ static int __report_module(struct addr_location *al, u64 ip,
 		return 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,

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] perf report: ensure the perf DSO mapping matches what libdw sees Milian Wolff <milian.wolff@kdab.com> - 2017-06-02 16:40 +0200
  [PATCH 2/2] perf report: report module before querying isactivation in dwfl unwind Milian Wolff <milian.wolff@kdab.com> - 2017-06-02 16:40 +0200
    Re: [PATCH 2/2] perf report: report module before querying  isactivation in dwfl unwind Arnaldo Carvalho de Melo <acme@redhat.com> - 2017-06-02 17:30 +0200
      Re: [PATCH 2/2] perf report: report module before querying  isactivation in dwfl unwind Jiri Olsa <jolsa@redhat.com> - 2017-06-05 12:50 +0200
        Re: [PATCH 2/2] perf report: report module before querying  isactivation in dwfl unwind Jan Kratochvil <jan.kratochvil@redhat.com> - 2017-06-15 21:30 +0200
      Re: [PATCH 2/2] perf report: report module before querying  isactivation in dwfl unwind Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-16 18:10 +0200
        Re: [PATCH 2/2] perf report: report module before querying  isactivation in dwfl unwind Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-16 19:40 +0200
    [tip:perf/urgent] perf unwind: Report module before querying  isactivation in dwfl unwind tip-bot for Milian Wolff <tipbot@zytor.com> - 2017-06-16 21:50 +0200
  Re: [PATCH 1/2] perf report: ensure the perf DSO mapping matches  what libdw sees Arnaldo Carvalho de Melo <acme@redhat.com> - 2017-06-02 17:30 +0200
    Re: [PATCH 1/2] perf report: ensure the perf DSO mapping matches what libdw sees Milian Wolff <milian.wolff@kdab.com> - 2017-06-02 18:30 +0200
      Re: [PATCH 1/2] perf report: ensure the perf DSO mapping matches  what libdw sees Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-02 21:50 +0200
        Re: [PATCH 1/2] perf report: ensure the perf DSO mapping matches what libdw sees Milian Wolff <milian.wolff@kdab.com> - 2017-06-03 13:40 +0200
  Re: [PATCH 1/2] perf report: ensure the perf DSO mapping matches  what libdw sees Jiri Olsa <jolsa@redhat.com> - 2017-06-05 12:50 +0200
    Re: [PATCH 1/2] perf report: ensure the perf DSO mapping matches  what libdw sees Jan Kratochvil <jan.kratochvil@redhat.com> - 2017-06-15 22:40 +0200
  [tip:perf/urgent] perf report: Ensure the perf DSO mapping matches  what libdw sees tip-bot for Milian Wolff <tipbot@zytor.com> - 2017-06-07 18:10 +0200

csiph-web