Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751815AbdFEKlf (ORCPT ); Mon, 5 Jun 2017 06:41:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35594 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751338AbdFEKld (ORCPT ); Mon, 5 Jun 2017 06:41:33 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 26E37C0587CE Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jolsa@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 26E37C0587CE Date: Mon, 5 Jun 2017 12:41:30 +0200 From: Jiri Olsa To: Milian Wolff Cc: Linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , Namhyung Kim , Jan Kratochvil Subject: Re: [PATCH 1/2] perf report: ensure the perf DSO mapping matches what libdw sees Message-ID: <20170605104130.GB28871@krava> References: <20170602143753.16907-1-milian.wolff@kdab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170602143753.16907-1-milian.wolff@kdab.com> User-Agent: Mutt/1.8.0 (2017-02-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 05 Jun 2017 10:41:33 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2581 Lines: 70 On Fri, Jun 02, 2017 at 04:37:52PM +0200, Milian Wolff wrote: > 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. hum, sounds like libdw bug right? CC-ing Jan... any idea? anyway, I think we can keep that as sanity check thanks, jirka > > Cc: Arnaldo Carvalho de Melo > Cc: Namhyung Kim > Cc: Jiri Olsa > Signed-off-by: Milian Wolff > --- > 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 b4c20124d2ee..da45c4be5fb3 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, > -- > 2.13.0 >