linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf symbol: ignore $a/$d symbols for ARM modules
@ 2021-10-27  9:52 Lexi Shao
  2021-10-27 10:23 ` James Clark
  2021-10-28  8:44 ` [PATCH] perf symbol: ignore $a/$d symbols for ARM modules James Clark
  0 siblings, 2 replies; 12+ messages in thread
From: Lexi Shao @ 2021-10-27  9:52 UTC (permalink / raw)
  To: linux-perf-users, linux-kernel
  Cc: acme, mark.rutland, peterz, mingo, alexander.shishkin, jolsa,
	namhyung, shaolexi, qiuxi1, nixiaoming, wangbing6

On ARM machine, kernel symbols from modules can be resolved to $a
instead of printing the actual symbol name. Ignore symbols starting with
"$" when building kallsyms rbtree.

A sample stacktrace is shown as follows:

c0f2e39c schedule_hrtimeout+0x14 ([kernel.kallsyms])
bf4a66d8 $a+0x78 ([test_module])
c0a4f5f4 kthread+0x15c ([kernel.kallsyms])
c0a001f8 ret_from_fork+0x14 ([kernel.kallsyms])

On ARM machine, $a/$d symbols are used by the compiler to mark the
beginning of code/data part in code section. These symbols are filtered
out when linking vmlinux(see scripts/kallsyms.c ignored_prefixes), but
are left on modules. So there are $a symbols in /proc/kallsyms which
share the same addresses with the actual module symbols and confuses perf
when resolving symbols.

After this patch, the module symbol name is printed:

c0f2e39c schedule_hrtimeout+0x14 ([kernel.kallsyms])
bf4a66d8 test_func+0x78 ([test_module])
c0a4f5f4 kthread+0x15c ([kernel.kallsyms])
c0a001f8 ret_from_fork+0x14 ([kernel.kallsyms])

Signed-off-by: Lexi Shao <shaolexi@huawei.com>
---
 tools/perf/util/symbol.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 0fc9a5410739..35116aed74eb 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -702,6 +702,10 @@ static int map__process_kallsym_symbol(void *arg, const char *name,
 	if (!symbol_type__filter(type))
 		return 0;
 
+	/* Ignore local symbols for ARM modules */
+	if (name[0] == '$')
+		return 0;
+
 	/*
 	 * module symbols are not sorted so we add all
 	 * symbols, setting length to 0, and rely on
-- 
2.12.3


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

end of thread, other threads:[~2021-11-06 19:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-27  9:52 [PATCH] perf symbol: ignore $a/$d symbols for ARM modules Lexi Shao
2021-10-27 10:23 ` James Clark
2021-10-27 12:31   ` Lexi Shao
2021-10-27 15:10     ` James Clark
2021-10-28  2:05       ` Lexi Shao
2021-10-28  8:42         ` James Clark
2021-10-29  6:50           ` [PATCH v2 0/2] kallsyms: Ignore $a/$d symbols in kallsyms for ARM Lexi Shao
2021-10-29  6:50             ` [PATCH v2 1/2] perf symbol: ignore $a/$d symbols for ARM modules Lexi Shao
2021-10-29  6:50             ` [PATCH v2 2/2] kallsyms: ignore arm mapping symbols when loading module Lexi Shao
2021-11-02  9:43               ` James Clark
2021-10-28  8:44 ` [PATCH] perf symbol: ignore $a/$d symbols for ARM modules James Clark
2021-11-06 19:48   ` Arnaldo Carvalho de Melo

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