From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751173AbdEaMBb (ORCPT ); Wed, 31 May 2017 08:01:31 -0400 Received: from LGEAMRELO13.lge.com ([156.147.23.53]:59889 "EHLO lgeamrelo13.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751028AbdEaMBI (ORCPT ); Wed, 31 May 2017 08:01:08 -0400 X-Original-SENDERIP: 156.147.1.121 X-Original-MAILFROM: namhyung@kernel.org X-Original-SENDERIP: 10.177.227.17 X-Original-MAILFROM: namhyung@kernel.org From: Namhyung Kim To: Arnaldo Carvalho de Melo Cc: Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , kernel-team@lge.com, David Ahern , Andi Kleen Subject: [PATCH 3/3] perf tools: Use correct filename for compressed modules in build-id cache Date: Wed, 31 May 2017 21:01:05 +0900 Message-Id: <20170531120105.21731-3-namhyung@kernel.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170531120105.21731-1-namhyung@kernel.org> References: <20170531120105.21731-1-namhyung@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The decompress_kmodule() is to decompress kernel module in order to load symbols from it. In DSO_BINARY_TYPE__BUILD_ID_CACHE case, it needs full file path to extract the file extension to determine decompress method. But overwriting 'name' will fail to decompress since it might point to a non-existing old file. Instead, use dso->long_name for extension and use real filename to decompress. In DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP case, both name should be same. This can show symbols in the old modules. Before: $ perf report -i perf.data.old | grep scsi_mod 0.00% cc1 [scsi_mod] [k] 0x0000000000004aa6 0.00% as [scsi_mod] [k] 0x00000000000099e1 0.00% cc1 [scsi_mod] [k] 0x0000000000009830 0.00% cc1 [scsi_mod] [k] 0x0000000000001b8f After: 0.00% cc1 [scsi_mod] [k] scsi_handle_queue_ramp_up 0.00% as [scsi_mod] [k] scsi_sg_alloc 0.00% cc1 [scsi_mod] [k] scsi_setup_cmnd 0.00% cc1 [scsi_mod] [k] scsi_get_command Signed-off-by: Namhyung Kim --- tools/perf/util/symbol-elf.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index e7ee47f7377a..1fb2efae4f02 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -649,10 +649,7 @@ static int decompress_kmodule(struct dso *dso, const char *name, type != DSO_BINARY_TYPE__BUILD_ID_CACHE) return -1; - if (type == DSO_BINARY_TYPE__BUILD_ID_CACHE) - name = dso->long_name; - - if (kmod_path__parse_ext(&m, name) || !m.comp) + if (kmod_path__parse_ext(&m, dso->long_name) || !m.comp) return -1; fd = mkstemp(tmpbuf); -- 2.13.0