LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Namhyung Kim <namhyung@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Andi Kleen <andi@firstfloor.org>, David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Stephane Eranian <eranian@google.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 08/10] perf symbols: Support to read compressed module from build-id cache
Date: Thu, 29 Jan 2015 17:23:43 -0300	[thread overview]
Message-ID: <1422563025-28402-9-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1422563025-28402-1-git-send-email-acme@kernel.org>

From: Namhyung Kim <namhyung@kernel.org>

The commit c00c48fc6e6e ("perf symbols: Preparation for compressed
kernel module support") added support for compressed kernel modules but
it only supports system path DSOs.  When a dso is read from build-id
cache, its filename doesn't end with ".gz" but has build-id.  In this
case, we should fallback to the original dso->name.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1422518843-25818-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol-elf.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 06fcd1bf98b6..b24f9d8727a8 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -574,13 +574,16 @@ static int decompress_kmodule(struct dso *dso, const char *name,
 	const char *ext = strrchr(name, '.');
 	char tmpbuf[] = "/tmp/perf-kmod-XXXXXX";
 
-	if ((type != DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP &&
-	     type != DSO_BINARY_TYPE__GUEST_KMODULE_COMP) ||
-	    type != dso->symtab_type)
+	if (type != DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP &&
+	    type != DSO_BINARY_TYPE__GUEST_KMODULE_COMP &&
+	    type != DSO_BINARY_TYPE__BUILD_ID_CACHE)
 		return -1;
 
-	if (!ext || !is_supported_compression(ext + 1))
-		return -1;
+	if (!ext || !is_supported_compression(ext + 1)) {
+		ext = strrchr(dso->name, '.');
+		if (!ext || !is_supported_compression(ext + 1))
+			return -1;
+	}
 
 	fd = mkstemp(tmpbuf);
 	if (fd < 0)
-- 
1.9.3


  parent reply	other threads:[~2015-01-29 20:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29 20:23 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-01-29 20:23 ` [PATCH 01/10] perf evsel: Don't rely on malloc working for sz 0 Arnaldo Carvalho de Melo
2015-01-29 20:23 ` [PATCH 02/10] perf tools: Provide stub for missing pthread_attr_setaffinity_np Arnaldo Carvalho de Melo
2015-01-29 20:23 ` [PATCH 03/10] perf callchain: Cache eh/debug frame offset for dwarf unwind Arnaldo Carvalho de Melo
2015-01-29 20:23 ` [PATCH 04/10] perf tools: Do not use __perf_session__process_events() directly Arnaldo Carvalho de Melo
2015-01-29 20:23 ` [PATCH 05/10] perf record: Show precise number of samples Arnaldo Carvalho de Melo
2015-01-29 20:23 ` [PATCH 06/10] perf header: Set header version correctly Arnaldo Carvalho de Melo
2015-01-29 20:23 ` [PATCH 07/10] perf evsel: Set attr.task bit for a tracking event Arnaldo Carvalho de Melo
2015-01-29 20:23 ` Arnaldo Carvalho de Melo [this message]
2015-01-29 20:23 ` [PATCH 09/10] perf tools: Use perf_data_file__fd() consistently Arnaldo Carvalho de Melo
2015-01-29 20:23 ` [PATCH 10/10] perf symbols: Convert lseek + read to pread Arnaldo Carvalho de Melo
2015-01-30 18:28 ` [GIT PULL 00/10] perf/core improvements and fixes Ingo Molnar

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=1422563025-28402-9-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=andi@firstfloor.org \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --subject='Re: [PATCH 08/10] perf symbols: Support to read compressed module from build-id cache' \
    /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

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).