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


Groups > linux.kernel > #1654159 > unrolled thread

[PATCH 3/3] perf tools: Use correct filename for compressed modules in build-id cache

Started byNamhyung Kim <namhyung@kernel.org>
First post2017-05-31 14:10 +0200
Last post2017-06-07 18:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/3] perf tools: Use correct filename for compressed modules in build-id cache Namhyung Kim <namhyung@kernel.org> - 2017-05-31 14:10 +0200
    [tip:perf/urgent] perf symbols: Use correct filename for compressed  modules in build-id cache tip-bot for Namhyung Kim <tipbot@zytor.com> - 2017-06-07 18:10 +0200

#1654159 — [PATCH 3/3] perf tools: Use correct filename for compressed modules in build-id cache

FromNamhyung Kim <namhyung@kernel.org>
Date2017-05-31 14:10 +0200
Subject[PATCH 3/3] perf tools: Use correct filename for compressed modules in build-id cache
Message-ID<tNaBQ-4zj-1@gated-at.bofh.it>
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 <namhyung@kernel.org>
---
 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

[toc] | [next] | [standalone]


#1659956 — [tip:perf/urgent] perf symbols: Use correct filename for compressed modules in build-id cache

Fromtip-bot for Namhyung Kim <tipbot@zytor.com>
Date2017-06-07 18:10 +0200
Subject[tip:perf/urgent] perf symbols: Use correct filename for compressed modules in build-id cache
Message-ID<tPLGV-rD-5@gated-at.bofh.it>
In reply to#1654159
Commit-ID:  a09935b878dc8efd4b030ed1ffa0553fc9011fb8
Gitweb:     http://git.kernel.org/tip/a09935b878dc8efd4b030ed1ffa0553fc9011fb8
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Wed, 31 May 2017 21:01:05 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Jun 2017 14:17:59 -0300

perf symbols: Use correct filename for compressed modules in build-id cache

The decompress_kmodule() decompresses kernel modules in order to load
symbols from it.  In the DSO_BINARY_TYPE__BUILD_ID_CACHE case, it needs
the full file path to extract the file extension to determine the
decompression method.  But overwriting 'name' will fail the
decompression since it might point to a non-existing old file.

Instead, use dso->long_name for having the correct extension and use the
real filename to decompress.

In the DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP case, both names should
be the same.  This allows resolving 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 <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170531120105.21731-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 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 e7ee47f..1fb2efa 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);

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web