Re: [PATCH v4 0/2] perf: Add is_ignored_kernel_symbol() for kernel symbol filtering

From: Arnaldo Carvalho de Melo

Date: Wed May 27 2026 - 07:16:22 EST


On Mon, May 25, 2026 at 09:04:11PM -0500, Namhyung Kim wrote:
> Hello,
>
> On Fri, May 22, 2026 at 04:26:02PM +0800, Rui Qi wrote:
> > The perf tool currently has ad-hoc logic to filter out ELF mapping
> > symbols scattered across multiple files. ARM, AArch64 and RISC-V each
> > have their own inline checks in dso__load_sym_internal(), and kallsym
> > processing has yet another check for ARM module symbols.
> >
> > This patch series introduces a single is_ignored_kernel_symbol() inline
> > helper in symbol.h and converts the kernel symbol handling paths to use it.
> > The helper covers the existing "$" prefix used by ARM, AArch64 and RISC-V,
> > and also adds the x86 local symbol prefixes so that perf stays consistent
> > with the kernel's own is_mapping_symbol() logic.
> >
> > Changes in v4:
> > - Rename the helper from is_mapping_symbol() to is_ignored_kernel_symbol()
> > to make its purpose clearer.
> > - Split the single patch into two logical patches:
> > - Patch 1 introduces the helper and applies it to kallsyms and ksymbol events.
> > - Patch 2 applies the helper to the ELF loading path for kernel DSOs.
> >
> > Link (v3): https://lore.kernel.org/all/20260507071103.2772577-1-qirui.001@xxxxxxxxxxxxx/
> >
> > Changes in v3:
> > - Add is_mapping_symbol() check for kernel modules in dso__load_sym_internal()
> > - Add is_mapping_symbol() check in machine__process_ksymbol_unregister()
> >
> > Link (v2): https://lore.kernel.org/all/20260506073820.2419087-1-qirui.001@xxxxxxxxxxxxx/
> >
> > Changes in v2:
> > - Only apply is_mapping_symbol() filtering to kernel symbols (kallsyms
> > and ksymbol events), not to user-space symbols from ELF files,
> > BFD libraries, or perf map files. This avoids incorrectly
> > discarding valid user-space function names that start with '$',
> > which is a legal character in identifiers for many languages
> > (e.g., Java, Scala) and compilers (GCC).
> > - Move the mapping symbol check in machine__process_ksymbol_register()
> > to the beginning of the function, before any map/dso allocation
> > or insertion, to avoid leaving empty maps in the kernel map tree.
> >
> > Link (v1): https://lore.kernel.org/all/20260504090609.1801880-1-qirui.001@xxxxxxxxxxxxx/
> >
> > Rui Qi (2):
> > perf: Extract is_ignored_kernel_symbol() for kernel mapping symbol
> > filtering
> > perf: Apply is_ignored_kernel_symbol() filter in ELF loading path for
> > kernel DSOs
>
> Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>

Thanks, applied to perf-tools-next, for v7.2.

- Arnaldo