Received: by 10.213.65.68 with SMTP id h4csp1672707imn; Mon, 19 Mar 2018 10:11:28 -0700 (PDT) X-Google-Smtp-Source: AG47ELu/QJntAf0g53Z6FEmYBOYo/0V45MbMOZuorU5ywy3FMC5eAbb5CVxqatz8gFEF1pR+IsRh X-Received: by 2002:a17:902:ac96:: with SMTP id h22-v6mr13000896plr.93.1521479488323; Mon, 19 Mar 2018 10:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521479488; cv=none; d=google.com; s=arc-20160816; b=lOI9R4O1SDaIb3hGaLdeVIp8v2acydhqfzk3u0xWtAuGfcdEvJypAU8gB5JIuHSXMq 3MuPxeoWh4f3G2FHlkBwsEVnr8FiMzWw9tRSOIuhnAdKKdwfcxX9aL/CI+cZB7vCXvem xHH5wcTL+gYE3MlY4Vr/RMBggX29K1pwYDVQx5BMIZ1i9OyN3BGMwFwjF8HVVstvD6yV mbF0hP0TgHMN7vOKCBO4vhrTb2k0NuCMrk0koygyDxMgypUMVl5o0PFRXnPaULV6QFCR MLDZiuK1lTa7QEuK3pJYKOe0G+eVGGuMDlzTyVtxu1Rqt8T253C+XfM/riTKiyK+mh5v Z46A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=SkF8FpwpUszDsjsZ8gLRx4sK0jF2l/bLhq3firkcNjw=; b=rKJe+DMWjBb6sTeBHZM+hK7VIp2ngX9Olu7fsgvPwnTkeaklOIwRR/y7ddngdqLv7q p6F2u7PUkjRTW2xJJctNCQc6b0Si4IhcL3L2LPtDpwy4+cB+r4K/iCZQqZn9dwtvtmdE 3KqtpjMzVKqSIL5YsCckNsuK8nGKliROlTVDbQJaQ79x2uAKS2HQzy9mVkYsS0Lozyip /C2sg5119nF0TBZte3FhIT0vWYxZk2yOY5L1B5VSa9i+qIYV0SEJOxOIXKJg2RjUA+3R 1ZxU0S+2MWf5Z4VWczXFFiL4ljNTiuY3NGpjPryBPi8j7KRidQUYWurL47AXX3mzsvAd QBuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=P+yWBXAq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12-v6si275801plx.631.2018.03.19.10.11.13; Mon, 19 Mar 2018 10:11:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=P+yWBXAq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935169AbeCSRJg (ORCPT + 99 others); Mon, 19 Mar 2018 13:09:36 -0400 Received: from mail-by2nam03on0091.outbound.protection.outlook.com ([104.47.42.91]:31330 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966641AbeCSQKn (ORCPT ); Mon, 19 Mar 2018 12:10:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=SkF8FpwpUszDsjsZ8gLRx4sK0jF2l/bLhq3firkcNjw=; b=P+yWBXAqOpaxWRmXHW/QuK1IjbwgMa2a7H+63T0wsiuGBDjajZ17/B2ZIsRbnqdSuD8AKvNcAS1XJ+YWsGFR9t3vP+dITyxIxjIW6IjwMNmcNJUkkujYkCYYwD+L2bpgepKXq1mESg+sCl4dU+CfO7F/fYx3FfMmtdVQMR27o+w= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1045.namprd21.prod.outlook.com (52.132.128.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 16:10:36 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 16:10:36 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Milian Wolff , Jiri Olsa , Namhyung Kim , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 126/167] perf report: Ensure the perf DSO mapping matches what libdw sees Thread-Topic: [PATCH AUTOSEL for 4.4 126/167] perf report: Ensure the perf DSO mapping matches what libdw sees Thread-Index: AQHTv5x0ToH1GR1VAUu52Wqv6mqLhA== Date: Mon, 19 Mar 2018 16:08:00 +0000 Message-ID: <20180319160513.16384-126-alexander.levin@microsoft.com> References: <20180319160513.16384-1-alexander.levin@microsoft.com> In-Reply-To: <20180319160513.16384-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1045;7:OYPCezflMRopQ1Ti5LLs4N5og6G5+ql/ZyC+auFGxqil7/Z7AP+L6mY5ZUSNZKD78Rwp5v7YR5+rp6qMjr/U0gm29UJ+KEvcml2yGsKNy1U9xArA8b1tXJPxGmTlXycTTFc1wF/iWJCzYl0b9xNEnaTiyaibQtJcNtc+DpijInjzUyKxX8ZbxLI9G9EazL+RSNpbe9qvnirV9fX6C3qL0MglQeEvUvZu74b5jERbYH4bLckPR2ZODnexWp2x1QL7;20:+H2/RA6fNlienSIEKFBwv2jvNizBQO76EYLbWGRsg+SSS5QMkHNHj+WxDXOizqBu9zPNbjc2VzQdYhtCmqKOwfNmQ88YxrmlUZQZKQCfZ929d5u1q89QRksVEWUgIPYoux9O4mAbIk02DBe4uXDtyddG33kv4aTQ7JC4JkfbQ/8= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: d944b815-d26f-48ab-3c77-08d58db3f354 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1045; x-ms-traffictypediagnostic: DM5PR2101MB1045: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(42068640409301)(5213294742642); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB1045;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1045; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(376002)(366004)(39380400002)(39860400002)(396003)(199004)(189003)(86612001)(66066001)(6436002)(76176011)(10290500003)(6666003)(2950100002)(305945005)(8676002)(97736004)(6486002)(86362001)(25786009)(26005)(575784001)(102836004)(8936002)(6512007)(7736002)(3280700002)(6306002)(106356001)(107886003)(110136005)(68736007)(81156014)(22452003)(6506007)(186003)(54906003)(10090500001)(2900100001)(4326008)(2906002)(14454004)(81166006)(316002)(966005)(105586002)(6116002)(3846002)(5660300001)(36756003)(72206003)(1076002)(53936002)(3660700001)(99286004)(2501003)(5250100002)(478600001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1045;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: cYjqWLhot6uip5dAe8XVdEgjDsA639GhQ4ef1tzN35j/daOVkyrXbZqZFLNySBxo1uT/7wEVHmbRcEuMXfZZ657NKizIwIFGdAQnSR6MxUhGK8nP1TcrV2f2ivepBYL4XAeEPjbn7Vmli/Vqf4VG09rjZwCssaPr+ZanG9ay/qlemXBcdtPhAOqzaj2a0yG28Zndo0pcb8SCA1pFvpjS2wnUHZilTXpfIeLZACUQfQvM8E0VoNzLTTcInpFqkqB/4PNZbQQj7shPY+hqq4CimVHbprflBSt0S6JMPQl3W9be2XJoLpGNdiFlsRtXfUkU2GgcFzeCWaP/3ZyckUxOhQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: d944b815-d26f-48ab-3c77-08d58db3f354 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:08:00.7917 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1045 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Milian Wolff [ 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/proj= ects/compiled/kf5/lib64/libKF5KIOWidgets.so.5.35.0) 608f3 _GLOBAL__sub_I_kdynamicjobtracker.cpp (/home/milian/proje= cts/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/proj= ects/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 Cc: Jiri Olsa Cc: Namhyung Kim Link: http://lkml.kernel.org/r/20170602143753.16907-1-milian.wolff@kdab.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- 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 2dcfe9a7c8d0..60edec383281 100644 --- a/tools/perf/util/unwind-libdw.c +++ b/tools/perf/util/unwind-libdw.c @@ -37,6 +37,14 @@ static int __report_module(struct addr_location *al, u64= ip, return 0; =20 mod =3D dwfl_addrmodule(ui->dwfl, ip); + if (mod) { + Dwarf_Addr s; + + dwfl_module_info(mod, NULL, &s, NULL, NULL, NULL, NULL, NULL); + if (s !=3D al->map->start) + mod =3D 0; + } + if (!mod) mod =3D dwfl_report_elf(ui->dwfl, dso->short_name, dso->long_name, -1, al->map->start, --=20 2.14.1