Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758756AbcLSOxo convert rfc822-to-8bit (ORCPT ); Mon, 19 Dec 2016 09:53:44 -0500 Received: from mga03.intel.com ([134.134.136.65]:3450 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756148AbcLSOxf (ORCPT ); Mon, 19 Dec 2016 09:53:35 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,374,1477983600"; d="scan'208";a="44208917" From: "Liang, Kan" To: "acme@kernel.org" , "linux-kernel@vger.kernel.org" CC: "dima@secretsauce.net" , "jolsa@redhat.com" , "namhyung@kernel.org" , "andi@firstfloor.org" Subject: RE: [PATCH] perf diff: bug fix, donot overwrite valid build id Thread-Topic: [PATCH] perf diff: bug fix, donot overwrite valid build id Thread-Index: AQHSVVXqrSDB5u2rrEiqxChMBX9BRKEPY9xw Date: Mon, 19 Dec 2016 14:53:30 +0000 Message-ID: <37D7C6CF3E00A74B8858931C1DB2F07753682E46@SHSMSX103.ccr.corp.intel.com> References: <1481642984-13593-1-git-send-email-kan.liang@intel.com> In-Reply-To: <1481642984-13593-1-git-send-email-kan.liang@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTQ3YWI1NWItNDQwMi00ZjI5LTkzMDYtNDA3Mzg5ZjU4MGFhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImRtUHMzeTlNMHl0SzVcL3dhS0QwSWR5WW10ajhWY1hkTnN1U3UwYzJGTDZJPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2108 Lines: 65 Hi Arnaldo, Ping Are you OK with the fix? Thanks, Kan > > From: Kan Liang > > Fixes a perf diff regression issue which was introduced by commit > 5baecbcd9c9a ("perf symbols: we can now read separate debug-info files > based on a build ID") > > The binary name could be same when perf diff different binaries. Build id is > used to distinguish between them. > However, the previous patch assumes the same binary name has same > build id. So it overwrites the build id according to the binary name, > regardless of whether the build id is set or not. > > Check the has_build_id in dso__load. If the build id is already set, use it. > > Before the fix applies, > sudo ./perf diff 1.perf.data 2.perf.data # Event 'cycles' > # > # Baseline Delta Shared Object Symbol > # ........ ....... ................ ............................. > # > 99.83% -99.80% tchain_edit [.] f2 > 0.12% +99.81% tchain_edit [.] f3 > 0.02% -0.01% [ixgbe] [k] ixgbe_read_reg > > After the fix applies, > sudo ./perf diff 1.perf.data 2.perf.data # Event 'cycles' > # > # Baseline Delta Shared Object Symbol > # ........ ....... ................ ............................. > # > 99.83% +0.10% tchain_edit [.] f3 > 0.12% -0.08% tchain_edit [.] f2 > > Signed-off-by: Kan Liang > --- > tools/perf/util/symbol.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index > df2482b..dc93940 100644 > --- a/tools/perf/util/symbol.c > +++ b/tools/perf/util/symbol.c > @@ -1459,7 +1459,8 @@ int dso__load(struct dso *dso, struct map *map) > * Read the build id if possible. This is required for > * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work > */ > - if (is_regular_file(dso->long_name) && > + if (!dso->has_build_id && > + is_regular_file(dso->long_name) && > filename__read_build_id(dso->long_name, build_id, > BUILD_ID_SIZE) > 0) > dso__set_build_id(dso, build_id); > > -- > 2.4.3