* [PATCH] perf probe arm64: Fix symbol fixup issues due to ELF type
@ 2017-12-14 23:52 Kim Phillips
2017-12-15 13:57 ` Arnaldo Carvalho de Melo
2017-12-28 15:35 ` [tip:perf/core] " tip-bot for Kim Phillips
0 siblings, 2 replies; 3+ messages in thread
From: Kim Phillips @ 2017-12-14 23:52 UTC (permalink / raw)
To: linux-arm-kernel
On an arm64 machine running a CONFIG_RANDOMIZE_BASE=y kernel, perf
kernel symbol resolution fails. Debugging saw symsrc_init calling the
default elf__needs_adjust_symbols() where checks for an ET_DYN (3)
ehdr.e_type failed when they should have succeeded.
Fix by adopting powerpc version of the weak elf__needs_adjust_symbols()
function, as done in commit d2332098331f ("perf probe ppc: Fix symbol
fixup issues due to ELF type").
Prior to this patch, perf test 1 would fail:
$ sudo oldperf test -v 1 |& head
1: vmlinux symtab matches kallsyms :
test child forked, pid 33374
Looking at the vmlinux_path (8 entries long)
Using /usr/lib/debug/boot/vmlinux for symbols
ERR : 0xfffe0000100f1000: do_undefinstr not on kallsyms
ERR : 0xfffe0000100f1320: do_sysinstr not on kallsyms
ERR : 0xfffe0000100f13b0: do_debug_exception not on kallsyms
ERR : 0xfffe0000100f1498: do_mem_abort not on kallsyms
ERR : 0xfffe0000100f1580: do_sp_pc_abort not on kallsyms
...
After applying this patch, perf test 1 now succeeds:
$ sudo ./newperf test -v 1 |& head
1: vmlinux symtab matches kallsyms :
test child forked, pid 33378
Looking at the vmlinux_path (8 entries long)
Using /usr/lib/debug/boot/vmlinux for symbols
WARN: 0xffff000008081000: diff name v: do_undefinstr k:
__exception_text_start
WARN: 0xffff0000080819e8: diff name v: __irqentry_text_end k:
__softirqentry_text_start
WARN: 0xffff000008081d08: diff name v: __entry_text_start k:
__softirqentry_text_end
WARN: 0xffff00000809db5c: diff name v: flush_icache_range k:
__flush_cache_user_range
WARN: 0xffff000008101908: diff name v: sys_ni_syscall k: sys_vm86old
...
Signed-off-by: Kim Phillips <kim.phillips@arm.com>
---
tools/perf/arch/arm64/util/Build | 1 +
tools/perf/arch/arm64/util/sym-handling.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+)
create mode 100644 tools/perf/arch/arm64/util/sym-handling.c
diff --git a/tools/perf/arch/arm64/util/Build b/tools/perf/arch/arm64/util/Build
index b1ab72d2a42e..e04f6cdd6f32 100644
--- a/tools/perf/arch/arm64/util/Build
+++ b/tools/perf/arch/arm64/util/Build
@@ -1,4 +1,5 @@
libperf-y += header.o
+libperf-y += sym-handling.o
libperf-$(CONFIG_DWARF) += dwarf-regs.o
libperf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
diff --git a/tools/perf/arch/arm64/util/sym-handling.c b/tools/perf/arch/arm64/util/sym-handling.c
new file mode 100644
index 000000000000..0051b1ee8450
--- /dev/null
+++ b/tools/perf/arch/arm64/util/sym-handling.c
@@ -0,0 +1,22 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * Copyright (C) 2015 Naveen N. Rao, IBM Corporation
+ */
+
+#include "debug.h"
+#include "symbol.h"
+#include "map.h"
+#include "probe-event.h"
+#include "probe-file.h"
+
+#ifdef HAVE_LIBELF_SUPPORT
+bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
+{
+ return ehdr.e_type == ET_EXEC ||
+ ehdr.e_type == ET_REL ||
+ ehdr.e_type == ET_DYN;
+}
+#endif
--
2.15.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] perf probe arm64: Fix symbol fixup issues due to ELF type
2017-12-14 23:52 [PATCH] perf probe arm64: Fix symbol fixup issues due to ELF type Kim Phillips
@ 2017-12-15 13:57 ` Arnaldo Carvalho de Melo
2017-12-28 15:35 ` [tip:perf/core] " tip-bot for Kim Phillips
1 sibling, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-15 13:57 UTC (permalink / raw)
To: linux-arm-kernel
Em Thu, Dec 14, 2017 at 05:52:42PM -0600, Kim Phillips escreveu:
> On an arm64 machine running a CONFIG_RANDOMIZE_BASE=y kernel, perf
> kernel symbol resolution fails. Debugging saw symsrc_init calling the
> default elf__needs_adjust_symbols() where checks for an ET_DYN (3)
> ehdr.e_type failed when they should have succeeded.
>
> Fix by adopting powerpc version of the weak elf__needs_adjust_symbols()
> function, as done in commit d2332098331f ("perf probe ppc: Fix symbol
> fixup issues due to ELF type").
>
> Prior to this patch, perf test 1 would fail:
Thanks, applied.
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/core] perf probe arm64: Fix symbol fixup issues due to ELF type
2017-12-14 23:52 [PATCH] perf probe arm64: Fix symbol fixup issues due to ELF type Kim Phillips
2017-12-15 13:57 ` Arnaldo Carvalho de Melo
@ 2017-12-28 15:35 ` tip-bot for Kim Phillips
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Kim Phillips @ 2017-12-28 15:35 UTC (permalink / raw)
To: linux-tip-commits
Cc: kim.phillips, namhyung, jolsa, hpa, will.deacon, acme,
linux-kernel, tglx, ganapatrao.kulkarni, naveen.n.rao,
alexander.shishkin, mingo, peterz
Commit-ID: f1031c8d33a8c40d4cac26e58c37d9fba0e31a8a
Gitweb: https://git.kernel.org/tip/f1031c8d33a8c40d4cac26e58c37d9fba0e31a8a
Author: Kim Phillips <kim.phillips@arm.com>
AuthorDate: Thu, 14 Dec 2017 17:52:42 -0600
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 27 Dec 2017 12:15:58 -0300
perf probe arm64: Fix symbol fixup issues due to ELF type
On an arm64 machine running a CONFIG_RANDOMIZE_BASE=y kernel, perf
kernel symbol resolution fails. Debugging saw symsrc_init calling the
default elf__needs_adjust_symbols() where checks for an ET_DYN (3)
ehdr.e_type failed when they should have succeeded.
Fix by adopting powerpc version of the weak elf__needs_adjust_symbols()
function, as done in commit d2332098331f ("perf probe ppc: Fix symbol
fixup issues due to ELF type").
Prior to this patch, perf test 1 would fail:
$ sudo oldperf test -v 1 |& head
1: vmlinux symtab matches kallsyms :
test child forked, pid 33374
Looking at the vmlinux_path (8 entries long)
Using /usr/lib/debug/boot/vmlinux for symbols
ERR : 0xfffe0000100f1000: do_undefinstr not on kallsyms
ERR : 0xfffe0000100f1320: do_sysinstr not on kallsyms
ERR : 0xfffe0000100f13b0: do_debug_exception not on kallsyms
ERR : 0xfffe0000100f1498: do_mem_abort not on kallsyms
ERR : 0xfffe0000100f1580: do_sp_pc_abort not on kallsyms
...
After applying this patch, perf test 1 now succeeds:
$ sudo ./newperf test -v 1 |& head
1: vmlinux symtab matches kallsyms :
test child forked, pid 33378
Looking at the vmlinux_path (8 entries long)
Using /usr/lib/debug/boot/vmlinux for symbols
WARN: 0xffff000008081000: diff name v: do_undefinstr k: __exception_text_start
WARN: 0xffff0000080819e8: diff name v: __irqentry_text_end k: __softirqentry_text_start
WARN: 0xffff000008081d08: diff name v: __entry_text_start k: __softirqentry_text_end
WARN: 0xffff00000809db5c: diff name v: flush_icache_range k: __flush_cache_user_range
WARN: 0xffff000008101908: diff name v: sys_ni_syscall k: sys_vm86old
...
Signed-off-by: Kim Phillips <kim.phillips@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/20171214175242.e30450f17f93ad675d968fa3@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/arm64/util/Build | 1 +
tools/perf/arch/arm64/util/sym-handling.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/tools/perf/arch/arm64/util/Build b/tools/perf/arch/arm64/util/Build
index b1ab72d..e04f6cd 100644
--- a/tools/perf/arch/arm64/util/Build
+++ b/tools/perf/arch/arm64/util/Build
@@ -1,4 +1,5 @@
libperf-y += header.o
+libperf-y += sym-handling.o
libperf-$(CONFIG_DWARF) += dwarf-regs.o
libperf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
diff --git a/tools/perf/arch/arm64/util/sym-handling.c b/tools/perf/arch/arm64/util/sym-handling.c
new file mode 100644
index 0000000..0051b1e
--- /dev/null
+++ b/tools/perf/arch/arm64/util/sym-handling.c
@@ -0,0 +1,22 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * Copyright (C) 2015 Naveen N. Rao, IBM Corporation
+ */
+
+#include "debug.h"
+#include "symbol.h"
+#include "map.h"
+#include "probe-event.h"
+#include "probe-file.h"
+
+#ifdef HAVE_LIBELF_SUPPORT
+bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
+{
+ return ehdr.e_type == ET_EXEC ||
+ ehdr.e_type == ET_REL ||
+ ehdr.e_type == ET_DYN;
+}
+#endif
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-12-28 15:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-14 23:52 [PATCH] perf probe arm64: Fix symbol fixup issues due to ELF type Kim Phillips
2017-12-15 13:57 ` Arnaldo Carvalho de Melo
2017-12-28 15:35 ` [tip:perf/core] " tip-bot for Kim Phillips
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.