linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf: Ignore stripped vmlinux and fallback to kallsyms
@ 2014-09-08 22:59 Anton Blanchard
  2014-09-12  6:33 ` Namhyung Kim
  2014-09-19  5:22 ` [tip:perf/core] perf symbols: " tip-bot for Anton Blanchard
  0 siblings, 2 replies; 3+ messages in thread
From: Anton Blanchard @ 2014-09-08 22:59 UTC (permalink / raw)
  To: acme, a.p.zijlstra, paulus, mingo; +Cc: linux-kernel

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;
 	}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf: Ignore stripped vmlinux and fallback to kallsyms
  2014-09-08 22:59 [PATCH] perf: Ignore stripped vmlinux and fallback to kallsyms Anton Blanchard
@ 2014-09-12  6:33 ` Namhyung Kim
  2014-09-19  5:22 ` [tip:perf/core] perf symbols: " tip-bot for Anton Blanchard
  1 sibling, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2014-09-12  6:33 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: acme, a.p.zijlstra, paulus, mingo, linux-kernel

Hi Anton,

On Tue, 9 Sep 2014 08:59:29 +1000, Anton Blanchard wrote:
> 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>

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung


> ---
>
> 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;
>  	}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:perf/core] perf symbols: Ignore stripped vmlinux and fallback to kallsyms
  2014-09-08 22:59 [PATCH] perf: Ignore stripped vmlinux and fallback to kallsyms Anton Blanchard
  2014-09-12  6:33 ` Namhyung Kim
@ 2014-09-19  5:22 ` tip-bot for Anton Blanchard
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Anton Blanchard @ 2014-09-19  5:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, mingo, anton, hpa, mingo,
	a.p.zijlstra, namhyung, tglx

Commit-ID:  d0b0d0406fe6743e734e1ba780155f8db5f713e6
Gitweb:     http://git.kernel.org/tip/d0b0d0406fe6743e734e1ba780155f8db5f713e6
Author:     Anton Blanchard <anton@samba.org>
AuthorDate: Tue, 9 Sep 2014 08:59:29 +1000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 17 Sep 2014 17:08:10 -0300

perf symbols: Ignore stripped vmlinux and fallback to kallsyms

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>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20140909085929.4a5a81f0@kryten
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol-elf.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 9c9b27f..2a92e10 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -717,6 +717,14 @@ int dso__load_sym(struct dso *dso, struct map *map,
 		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;
 	}

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-19  5:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-08 22:59 [PATCH] perf: Ignore stripped vmlinux and fallback to kallsyms Anton Blanchard
2014-09-12  6:33 ` Namhyung Kim
2014-09-19  5:22 ` [tip:perf/core] perf symbols: " tip-bot for Anton Blanchard

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