[PATCH 16/20] perf symbols: Ignore stripped vmlinux and fallback to kallsyms
From: Arnaldo Carvalho de Melo
Date: Wed Sep 17 2014 - 17:25:48 EST
From: Anton Blanchard <anton@xxxxxxxxx>
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@xxxxxxxxx>
Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Link: http://lkml.kernel.org/r/20140909085929.4a5a81f0@kryten
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
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 9c9b27fbc78d..2a92e10317c5 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;
}
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/