linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Jiri Olsa <jolsa@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	kernel-team@lge.com, David Ahern <dsahern@gmail.com>,
	Andi Kleen <andi@firstfloor.org>
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	[thread overview]
Message-ID: <20170531120105.21731-3-namhyung@kernel.org> (raw)
In-Reply-To: <20170531120105.21731-1-namhyung@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 <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

  parent reply	other threads:[~2017-05-31 12:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 12:01 [PATCH 1/3] perf tools: Set proper module name when build-id event found Namhyung Kim
2017-05-31 12:01 ` [PATCH 2/3] perf tools: Set module info " Namhyung Kim
2017-06-07 15:58   ` [tip:perf/urgent] perf symbols: " tip-bot for Namhyung Kim
2017-05-31 12:01 ` Namhyung Kim [this message]
2017-06-07 15:59   ` [tip:perf/urgent] perf symbols: Use correct filename for compressed modules in build-id cache tip-bot for Namhyung Kim
2017-05-31 22:24 ` [PATCH 1/3] perf tools: Set proper module name when build-id event found Jiri Olsa
2017-06-02 14:28   ` Arnaldo Carvalho de Melo
2017-06-05 17:12 ` Arnaldo Carvalho de Melo
2017-06-07 15:58 ` [tip:perf/urgent] perf header: " tip-bot for Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170531120105.21731-3-namhyung@kernel.org \
    --to=namhyung@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=andi@firstfloor.org \
    --cc=dsahern@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).