linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba.org>
To: acme@redhat.com, a.p.zijlstra@chello.nl, paulus@samba.org,
	mingo@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] perf: Ignore stripped vmlinux and fallback to kallsyms
Date: Tue, 9 Sep 2014 08:59:29 +1000	[thread overview]
Message-ID: <20140909085929.4a5a81f0@kryten> (raw)

If a vmlinux is stripped, perf will use it and ignore kallsyms. We
end up with useless profiles where everything maps to a few
runtime symbols:

    63.39%       swapper  [kernel.kallsyms]   [k] hcall_real_table
     4.90%      beam.smp  [kernel.kallsyms]   [k] hcall_real_table
     4.44%      beam.smp  [kernel.kallsyms]   [k] __sched_text_start
     3.72%      beam.smp  [kernel.kallsyms]   [k] __run_at_kexec

Detect this case and fallback to using kallsyms. This fixes the issue:

    62.81%       swapper  [kernel.kallsyms]   [k] snooze_loop
     4.44%      beam.smp  [kernel.kallsyms]   [k] __schedule
     0.91%      beam.smp  [kernel.kallsyms]   [k] _switch
     0.73%      beam.smp  [kernel.kallsyms]   [k] put_prev_entity

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: b/tools/perf/util/symbol-elf.c
===================================================================
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -712,6 +712,14 @@ int dso__load_sym(struct dso *dso, struc
 		symbols__delete(&dso->symbols[map->type]);
 
 	if (!syms_ss->symtab) {
+		/*
+		 * If the vmlinux is stripped, fail so we will fall back
+		 * to using kallsyms. The vmlinux runtime symbols aren't
+		 * of much use.
+		 */
+		if (dso->kernel)
+			goto out_elf_end;
+
 		syms_ss->symtab  = syms_ss->dynsym;
 		syms_ss->symshdr = syms_ss->dynshdr;
 	}

             reply	other threads:[~2014-09-08 22:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-08 22:59 Anton Blanchard [this message]
2014-09-12  6:33 ` [PATCH] perf: Ignore stripped vmlinux and fallback to kallsyms Namhyung Kim
2014-09-19  5:22 ` [tip:perf/core] perf symbols: " tip-bot for Anton Blanchard

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=20140909085929.4a5a81f0@kryten \
    --to=anton@samba.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.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).