From: "Rui Qi" <qirui.001@bytedance.com>
To: "Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
"Namhyung Kim" <namhyung@kernel.org>
Cc: "Mark Rutland" <mark.rutland@arm.com>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
"Jiri Olsa" <jolsa@kernel.org>,
"Ian Rogers" <irogers@google.com>,
"Adrian Hunter" <adrian.hunter@intel.com>,
"James Clark" <james.clark@linaro.org>,
<linux-perf-users@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
"Rui Qi" <qirui.001@bytedance.com>
Subject: [PATCH v4 2/2] perf: Apply is_ignored_kernel_symbol() filter in ELF loading path for kernel DSOs
Date: Fri, 22 May 2026 16:26:04 +0800 [thread overview]
Message-ID: <20260522082604.89447-3-qirui.001@bytedance.com> (raw)
In-Reply-To: <20260522082604.89447-1-qirui.001@bytedance.com>
dso__load_sym_internal() had no filtering for .L* and L0* mapping
symbols while the kallsyms path already filters them via
is_ignored_kernel_symbol(). Add the same check gated by dso__kernel()
so that kernel ELF objects (vmlinux, .ko) have mapping symbols filtered
across all architectures, but userspace ELF objects are unaffected --
'$' is a valid prefix in languages like Java and Scala.
The existing ARM/AArch64 and RISC-V architecture-specific mapping
symbol checks are preserved; the new is_ignored_kernel_symbol() check
adds x86 local symbol (.L*, L0*) filtering and provides unified
cross-architecture coverage for kernel DSOs.
Signed-off-by: Rui Qi <qirui.001@bytedance.com>
---
tools/perf/util/symbol-elf.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 7afa8a117139..77e6dcba8fda 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -1592,9 +1592,11 @@ dso__load_sym_internal(struct dso *dso, struct map *map, struct symsrc *syms_ss,
if (!is_label && !elf_sym__filter(&sym))
continue;
- /* Reject ARM ELF "mapping symbols": these aren't unique and
+ /*
+ * Reject ARM ELF "mapping symbols": these aren't unique and
* don't identify functions, so will confuse the profile
- * output: */
+ * output:
+ */
if (ehdr.e_machine == EM_ARM || ehdr.e_machine == EM_AARCH64) {
if (elf_name[0] == '$' && strchr("adtx", elf_name[1])
&& (elf_name[2] == '\0' || elf_name[2] == '.'))
@@ -1607,6 +1609,10 @@ dso__load_sym_internal(struct dso *dso, struct map *map, struct symsrc *syms_ss,
continue;
}
+ /* Reject kernel mapping symbols for kernel DSOs only */
+ if (dso__kernel(dso) && is_ignored_kernel_symbol(elf_name))
+ continue;
+
if (runtime_ss->opdsec && sym.st_shndx == runtime_ss->opdidx) {
u32 offset = sym.st_value - syms_ss->opdshdr.sh_addr;
u64 *opd = opddata->d_buf + offset;
--
2.20.1
next prev parent reply other threads:[~2026-05-22 8:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260506073820.2419087-1-qirui.001@bytedance.com>
2026-05-07 7:11 ` [PATCH v3] perf: Add is_mapping_symbol() helper for kernel mapping symbol filtering Rui Qi
2026-05-07 15:23 ` Ian Rogers
2026-05-22 7:34 ` Rui Qi
2026-05-22 8:26 ` [PATCH v4 0/2] perf: Add is_ignored_kernel_symbol() for kernel " Rui Qi
2026-05-22 8:26 ` [PATCH v4 1/2] perf: Extract is_ignored_kernel_symbol() for kernel mapping " Rui Qi
2026-05-22 8:26 ` Rui Qi [this message]
2026-05-26 2:04 ` [PATCH v4 0/2] perf: Add is_ignored_kernel_symbol() for kernel " Namhyung Kim
2026-05-27 11:15 ` Arnaldo Carvalho de Melo
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=20260522082604.89447-3-qirui.001@bytedance.com \
--to=qirui.001@bytedance.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.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
all inboxes | Powered by JetHome®