linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] perf symbols: Handle '1' symbols in /proc/kallsyms
@ 2025-11-03 18:03 Arnaldo Carvalho de Melo
  2025-11-04  3:06 ` Namhyung Kim
  0 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-11-03 18:03 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Alex Gaynor, Alice Ryhl, Andreas Hindborg, Benno Lossin,
	Björn Roy Baron, Boqun Feng, Danilo Krummrich, Gary Guo,
	Trevor Gross, Adrian Hunter, Ian Rogers, James Clark, Jiri Olsa,
	Namhyung Kim, linux-kernel, linux-perf-users

Just FYI, I'm carrying this on the perf tools tree.

I started seeing this in recent Fedora 42 kernels:

  root@x1:~# uname -a
  Linux x1 6.17.4-200.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Oct 19 18:47:49 UTC 2025 x86_64 GNU/Linux
  root@x1:~#

  root@x1:~# perf test 1
    1: vmlinux symtab matches kallsyms     : FAILED!
  root@x1:~#

Related to:

  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_
  root@x1:~#

That is found in:

  root@x1:~# pahole --running_kernel_vmlinux
  /usr/lib/debug/lib/modules/6.17.4-200.fc42.x86_64/vmlinux
  root@x1:~#

  root@x1:~# readelf -sW /usr/lib/debug/lib/modules/6.17.4-200.fc42.x86_64/vmlinux | grep __pfx__RNCINvNtNtNtCsfwaGRd4cjqE_4core4iter8adapters3map12map_try_foldjNtCskFudTml27HW_12drm_panic_qr7VersionuINtNtNtBa_3ops12control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Iterator4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_
  150649: ffffffff81f8bc00    16 FUNC    LOCAL  DEFAULT    1 __pfx__RNCINvNtNtNtCsfwaGRd4cjqE_4core4iter8adapters3map12map_try_foldjNtCskFudTml27HW_12drm_panic_qr7VersionuINtNtNtBa_3ops12control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Iterator4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_
  root@x1:~#

But was being filtered out when reading /proc/kallsyms, as the '1'
symbol type was not being handled, do it, there are just two of them at
this point.

Cc: Alex Gaynor <alex.gaynor@gmail.com>
Cc: Alice Ryhl <aliceryhl@google.com>
Cc: Andreas Hindborg <a.hindborg@kernel.org>
Cc: Benno Lossin <lossin@kernel.org>
Cc: Björn Roy Baron <bjorn3_gh@protonmail.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Gary Guo <gary@garyguo.net>
Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Trevor Gross <tmgross@umich.edu>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index cc26b7bf302b29d6..948d3e8ad782bc2a 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -112,9 +112,13 @@ static bool symbol_type__filter(char __symbol_type)
 	// '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 == 'u' || __symbol_type == 'l' || __symbol_type == 'N' || __symbol_type == '1';
 }
 
 static int prefix_underscores_count(const char *str)
-- 
2.51.1


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

* Re: [PATCH 1/1] perf symbols: Handle '1' symbols in /proc/kallsyms
  2025-11-03 18:03 [PATCH 1/1] perf symbols: Handle '1' symbols in /proc/kallsyms Arnaldo Carvalho de Melo
@ 2025-11-04  3:06 ` Namhyung Kim
  2025-11-06 20:25   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 6+ messages in thread
From: Namhyung Kim @ 2025-11-04  3:06 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Miguel Ojeda, Alex Gaynor, Alice Ryhl, Andreas Hindborg,
	Benno Lossin, Björn Roy Baron, Boqun Feng, Danilo Krummrich,
	Gary Guo, Trevor Gross, Adrian Hunter, Ian Rogers, James Clark,
	Jiri Olsa, linux-kernel, linux-perf-users

Hi Arnaldo,

On Mon, Nov 03, 2025 at 03:03:23PM -0300, Arnaldo Carvalho de Melo wrote:
> Just FYI, I'm carrying this on the perf tools tree.
> 
> I started seeing this in recent Fedora 42 kernels:
> 
>   root@x1:~# uname -a
>   Linux x1 6.17.4-200.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Oct 19 18:47:49 UTC 2025 x86_64 GNU/Linux
>   root@x1:~#
> 
>   root@x1:~# perf test 1
>     1: vmlinux symtab matches kallsyms     : FAILED!
>   root@x1:~#
> 
> Related to:
> 
>   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_
>   root@x1:~#
> 
> That is found in:
> 
>   root@x1:~# pahole --running_kernel_vmlinux
>   /usr/lib/debug/lib/modules/6.17.4-200.fc42.x86_64/vmlinux
>   root@x1:~#
> 
>   root@x1:~# readelf -sW /usr/lib/debug/lib/modules/6.17.4-200.fc42.x86_64/vmlinux | grep __pfx__RNCINvNtNtNtCsfwaGRd4cjqE_4core4iter8adapters3map12map_try_foldjNtCskFudTml27HW_12drm_panic_qr7VersionuINtNtNtBa_3ops12control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Iterator4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_
>   150649: ffffffff81f8bc00    16 FUNC    LOCAL  DEFAULT    1 __pfx__RNCINvNtNtNtCsfwaGRd4cjqE_4core4iter8adapters3map12map_try_foldjNtCskFudTml27HW_12drm_panic_qr7VersionuINtNtNtBa_3ops12control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Iterator4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_
>   root@x1:~#
> 
> But was being filtered out when reading /proc/kallsyms, as the '1'
> symbol type was not being handled, do it, there are just two of them at
> this point.

Do you know what the type '1' means?  It seems they are from Rust.

Thanks,
Namhyung

> 
> Cc: Alex Gaynor <alex.gaynor@gmail.com>
> Cc: Alice Ryhl <aliceryhl@google.com>
> Cc: Andreas Hindborg <a.hindborg@kernel.org>
> Cc: Benno Lossin <lossin@kernel.org>
> Cc: Björn Roy Baron <bjorn3_gh@protonmail.com>
> Cc: Boqun Feng <boqun.feng@gmail.com>
> Cc: Danilo Krummrich <dakr@kernel.org>
> Cc: Gary Guo <gary@garyguo.net>
> Cc: Miguel Ojeda <ojeda@kernel.org>
> Cc: Trevor Gross <tmgross@umich.edu>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  tools/perf/util/symbol.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index cc26b7bf302b29d6..948d3e8ad782bc2a 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -112,9 +112,13 @@ static bool symbol_type__filter(char __symbol_type)
>  	// '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 == 'u' || __symbol_type == 'l' || __symbol_type == 'N' || __symbol_type == '1';
>  }
>  
>  static int prefix_underscores_count(const char *str)
> -- 
> 2.51.1
> 

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

* Re: [PATCH 1/1] perf symbols: Handle '1' symbols in /proc/kallsyms
  2025-11-04  3:06 ` Namhyung Kim
@ 2025-11-06 20:25   ` Arnaldo Carvalho de Melo
  2025-11-07  1:35     ` Miguel Ojeda
  0 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-11-06 20:25 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Miguel Ojeda, Alex Gaynor, Alice Ryhl, Andreas Hindborg,
	Benno Lossin, Björn Roy Baron, Boqun Feng, Danilo Krummrich,
	Gary Guo, Trevor Gross, Adrian Hunter, Ian Rogers, James Clark,
	Jiri Olsa, linux-kernel, linux-perf-users

On Mon, Nov 03, 2025 at 07:06:45PM -0800, Namhyung Kim wrote:
> On Mon, Nov 03, 2025 at 03:03:23PM -0300, Arnaldo Carvalho de Melo wrote:
> > Just FYI, I'm carrying this on the perf tools tree.

> > I started seeing this in recent Fedora 42 kernels:

> >   root@x1:~# uname -a
> >   Linux x1 6.17.4-200.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Oct 19 18:47:49 UTC 2025 x86_64 GNU/Linux
> >   root@x1:~#

> >   root@x1:~# perf test 1
> >     1: vmlinux symtab matches kallsyms     : FAILED!
> >   root@x1:~#

> > Related to:

> >   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_
> >   root@x1:~#

> > That is found in:
 
> >   root@x1:~# pahole --running_kernel_vmlinux
> >   /usr/lib/debug/lib/modules/6.17.4-200.fc42.x86_64/vmlinux
> >   root@x1:~#
 
> >   root@x1:~# readelf -sW /usr/lib/debug/lib/modules/6.17.4-200.fc42.x86_64/vmlinux | grep __pfx__RNCINvNtNtNtCsfwaGRd4cjqE_4core4iter8adapters3map12map_try_foldjNtCskFudTml27HW_12drm_panic_qr7VersionuINtNtNtBa_3ops12control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Iterator4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_
> >   150649: ffffffff81f8bc00    16 FUNC    LOCAL  DEFAULT    1 __pfx__RNCINvNtNtNtCsfwaGRd4cjqE_4core4iter8adapters3map12map_try_foldjNtCskFudTml27HW_12drm_panic_qr7VersionuINtNtNtBa_3ops12control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Iterator4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_
> >   root@x1:~#
> > 
> > But was being filtered out when reading /proc/kallsyms, as the '1'
> > symbol type was not being handled, do it, there are just two of them at
> > this point.
> 
> Do you know what the type '1' means?  It seems they are from Rust.

They are related to anonymous Rust closures in the QR encoder for the
DRM panic, this part:

drivers/gpu/drm/drm_panic_qr.rs

    fn from_segments(segments: &[&Segment<'_>]) -> Option<Version> {
        (1..=40)
            .map(Version)
            .find(|&v| v.max_data() * 8 >= segments.iter().map(|s| s.total_size_bits(v)).sum())
    }

That 

Using rustfilt we get:

core::iter::adapters::map::map_try_fold::<usize, drm_panic_qr::Version, (), core::ops::control_flow::ControlFlow<drm_panic_qr::Version>, drm_panic_qr::Version, core::iter::traits::iterator::Iterator::find::check<drm_panic_qr::Version, <drm_panic_qr::Version>::from_segments::{closure#0}>::{closure#0}>::{closure#0}
#

Both are for the same symbol, the __pfx__ is to do some stack probing.
LLVM may introduce this for other reasons.

So far, '1' symbols are Rust symbols, in the Linux kernel, for unnamed
closures and its prefix code checking for stack space, Miguel, do you
have something to add?

- Arnaldo

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

* Re: [PATCH 1/1] perf symbols: Handle '1' symbols in /proc/kallsyms
  2025-11-06 20:25   ` Arnaldo Carvalho de Melo
@ 2025-11-07  1:35     ` Miguel Ojeda
  2025-11-11 21:16       ` Miguel Ojeda
  0 siblings, 1 reply; 6+ messages in thread
From: Miguel Ojeda @ 2025-11-07  1:35 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Namhyung Kim, Miguel Ojeda, Alex Gaynor, Alice Ryhl,
	Andreas Hindborg, Benno Lossin, Björn Roy Baron, Boqun Feng,
	Danilo Krummrich, Gary Guo, Trevor Gross, Adrian Hunter,
	Ian Rogers, James Clark, Jiri Olsa, linux-kernel,
	linux-perf-users

On Thu, Nov 6, 2025 at 9:25 PM Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>
> So far, '1' symbols are Rust symbols, in the Linux kernel, for unnamed
> closures and its prefix code checking for stack space, Miguel, do you
> have something to add?

Wait, is `1` the symbol type? I don't know what that is. That column
in `readelf` isn't the symbol type, no?

And if I use `nm` on Fedora's `vmlinux`, I get a `t` (and the
`System.map` has the same). Something is fishy in `/proc/kallsyms`.

We don't handle the big symbol double-byte... I will send a patch.

Cheers,
Miguel

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

* Re: [PATCH 1/1] perf symbols: Handle '1' symbols in /proc/kallsyms
  2025-11-07  1:35     ` Miguel Ojeda
@ 2025-11-11 21:16       ` Miguel Ojeda
  2025-11-11 21:20         ` Miguel Ojeda
  0 siblings, 1 reply; 6+ messages in thread
From: Miguel Ojeda @ 2025-11-11 21:16 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Zheng Yejian
  Cc: Namhyung Kim, Miguel Ojeda, Alex Gaynor, Alice Ryhl,
	Andreas Hindborg, Benno Lossin, Björn Roy Baron, Boqun Feng,
	Danilo Krummrich, Gary Guo, Trevor Gross, Adrian Hunter,
	Ian Rogers, James Clark, Jiri Olsa, linux-kernel,
	linux-perf-users

On Fri, Nov 7, 2025 at 2:35 AM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> We don't handle the big symbol double-byte... I will send a patch.

For (cross-)reference, I sent this patch a few days ago:

    https://lore.kernel.org/rust-for-linux/20251107050414.511648-1-ojeda@kernel.org/

And then Gary told me today (thanks!) there was a similar path a year ago:

    https://lore.kernel.org/lkml/20241011143853.3022643-1-zhengyejian@huaweicloud.com/

So I think we should take Zheng's (Cc'd).

Thanks!

Cheers,
Miguel

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

* Re: [PATCH 1/1] perf symbols: Handle '1' symbols in /proc/kallsyms
  2025-11-11 21:16       ` Miguel Ojeda
@ 2025-11-11 21:20         ` Miguel Ojeda
  0 siblings, 0 replies; 6+ messages in thread
From: Miguel Ojeda @ 2025-11-11 21:20 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Zheng Yejian
  Cc: Namhyung Kim, Miguel Ojeda, Alex Gaynor, Alice Ryhl,
	Andreas Hindborg, Benno Lossin, Björn Roy Baron, Boqun Feng,
	Danilo Krummrich, Gary Guo, Trevor Gross, Adrian Hunter,
	Ian Rogers, James Clark, Jiri Olsa, linux-kernel,
	linux-perf-users

On Tue, Nov 11, 2025 at 10:16 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> So I think we should take Zheng's (Cc'd).

Trying another address, since that one failed...

Cheers,
Miguel

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

end of thread, other threads:[~2025-11-11 21:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-03 18:03 [PATCH 1/1] perf symbols: Handle '1' symbols in /proc/kallsyms Arnaldo Carvalho de Melo
2025-11-04  3:06 ` Namhyung Kim
2025-11-06 20:25   ` Arnaldo Carvalho de Melo
2025-11-07  1:35     ` Miguel Ojeda
2025-11-11 21:16       ` Miguel Ojeda
2025-11-11 21:20         ` Miguel Ojeda

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