From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Gary Guo <gary@garyguo.net>
Cc: "Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Namhyung Kim" <namhyung@kernel.org>,
"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>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nick Desaulniers" <nick.desaulniers+lkml@gmail.com>,
"Bill Wendling" <morbo@google.com>,
"Justin Stitt" <justinstitt@google.com>,
"Andi Kleen" <ak@linux.intel.com>,
"Dmitry Vyukov" <dvyukov@google.com>,
"Stephen Brennan" <stephen.s.brennan@oracle.com>,
"Arnaldo Carvalho de Melo" <acme@redhat.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
rust-for-linux@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH v2] perf symbol: remove Rust symbol workarounds
Date: Mon, 5 Jan 2026 12:50:15 -0300 [thread overview]
Message-ID: <aVvdt90YmhJz3i5i@x1> (raw)
In-Reply-To: <20260105150106.567830-1-gary@kernel.org>
On Mon, Jan 05, 2026 at 03:00:57PM +0000, Gary Guo wrote:
> From: Gary Guo <gary@garyguo.net>
>
> Due to an off-by-one error introduced in commit 73bbb94466fd ("kallsyms:
> support "big" kernel symbols"), long symbols (which are currently only
> produced by Rust) can have their symbol type being wrongly parsed by
> kernel/kallsyms.c.
Looks sane, applied to perf-tools-next,
- Arnaldo
> This has been fixed in commit f3f9f42232dee5 ("kallsyms: Fix wrong "big"
> kernel symbol type read from procfs"), and these symbols are now
> reported correctly.
>
> Drop the workaround in perf symbol that filter out these symbol types.
>
> Specifically, '1' and 'l' can never be generated by nm -- 'u' does
> indicate GNU unique, however such symbols are only generated by G++ for
> C++ templates, and are never generated by LLVM (LLVM generates weak
> symbols in such cases instead). 'N' can appear if symbols exist inside
> debug sections, and 'n' may appear for symbols inside note sections,
> however these sections do not typically have symbol (and they're
> explicitly filtered out by kallsyms).
>
> Therefore, the previous occurrence of these symbols types must be due to
> the off-by-one error and can be safely removed.
>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Acked-by: Miguel Ojeda <ojeda@kernel.org>
> Signed-off-by: Gary Guo <gary@garyguo.net>
> ---
> v2:
> - Removed the "__" change as suggested by Miguel
> - Expanded the commit message to mention why "N" and "n" cannot appear
> - Link to v1: https://lore.kernel.org/rust-for-linux/20251223175216.1353814-1-gary@kernel.org/#t
> ---
> tools/perf/util/symbol.c | 19 ++++---------------
> 1 file changed, 4 insertions(+), 15 deletions(-)
>
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 814f960fa8f8d..8662001e1e25b 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -104,21 +104,10 @@ static enum dso_binary_type binary_type_symtab[] = {
>
> #define DSO_BINARY_TYPE__SYMTAB_CNT ARRAY_SIZE(binary_type_symtab)
>
> -static bool symbol_type__filter(char __symbol_type)
> -{
> - // Since 'U' == undefined and 'u' == unique global symbol, we can't use toupper there
> - // 'N' is for debugging symbols, 'n' is a non-data, non-code, non-debug read-only section.
> - // According to 'man nm'.
> - // 'N' first seen in:
> - // ffffffff9b35d130 N __pfx__RNCINvNtNtNtCsbDUBuN8AbD4_4core4iter8adapters3map12map_try_foldjNtCs6vVzKs5jPr6_12drm_panic_qr7VersionuINtNtNtBa_3ops12control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Iterator4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_
> - // a seemingly Rust mangled name
> - // Ditto for '1':
> - // root@x1:~# grep ' 1 ' /proc/kallsyms
> - // ffffffffb098bc00 1 __pfx__RNCINvNtNtNtCsfwaGRd4cjqE_4core4iter8adapters3map12map_try_foldjNtCskFudTml27HW_12drm_panic_qr7VersionuINtNtNtBa_3ops12control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Iterator4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_
> - // ffffffffb098bc10 1 _RNCINvNtNtNtCsfwaGRd4cjqE_4core4iter8adapters3map12map_try_foldjNtCskFudTml27HW_12drm_panic_qr7VersionuINtNtNtBa_3ops12control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Iterator4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_
> - char symbol_type = toupper(__symbol_type);
> - return symbol_type == 'T' || symbol_type == 'W' || symbol_type == 'D' || symbol_type == 'B' ||
> - __symbol_type == 'u' || __symbol_type == 'l' || __symbol_type == 'N' || __symbol_type == '1';
> +static bool symbol_type__filter(char symbol_type)
> +{
> + symbol_type = toupper(symbol_type);
> + return symbol_type == 'T' || symbol_type == 'W' || symbol_type == 'D' || symbol_type == 'B';
> }
>
> static int prefix_underscores_count(const char *str)
>
> base-commit: 3609fa95fb0f2c1b099e69e56634edb8fc03f87c
> --
> 2.51.2
next prev parent reply other threads:[~2026-01-05 15:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-05 15:00 [PATCH v2] perf symbol: remove Rust symbol workarounds Gary Guo
2026-01-05 15:50 ` Arnaldo Carvalho de Melo [this message]
2026-01-07 8:04 ` Namhyung Kim
2026-01-07 11:59 ` Miguel Ojeda
2026-01-07 18:22 ` Namhyung Kim
2026-01-07 18:25 ` Miguel Ojeda
2026-01-07 13:38 ` Arnaldo Carvalho de Melo
2026-01-07 18:18 ` Namhyung Kim
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=aVvdt90YmhJz3i5i@x1 \
--to=acme@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=dvyukov@google.com \
--cc=gary@garyguo.net \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=justinstitt@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=lossin@kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=morbo@google.com \
--cc=namhyung@kernel.org \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=ojeda@kernel.org \
--cc=peterz@infradead.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=stephen.s.brennan@oracle.com \
--cc=tmgross@umich.edu \
/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