From nobody Sun Feb 8 05:40:31 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A854346FA5; Mon, 5 Jan 2026 15:01:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767625277; cv=none; b=ISFA8fnc6GnapBNkL4c1KEIu2k4iWGj3wwry6aZ5o5aRUyOWpuQs3CcfJhK626moBCQ/FbsNTBx9zwgWb+38mDbl2wrP4lCfLeUyDZsCFBqmQuClF1CY23IWnjVuROhUV0NOjtoGhq4/5Ul5yX/HBSCaB8p1R44TncUnxY8pogE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767625277; c=relaxed/simple; bh=YLMKOZuVzDuqeOTYIfEGrkR0nqoifKRHFSqLGuFhapk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MxpBBJ+WWNI9SrEGNKHPduPr8Oc0HYxwfApC53LIasi9HHzuzphq6s/SZs3aWwc8kdlKVrGngJfFN62qmuDQ8/l+wi4cPqSCYUxxmHQjqMrYs2JdJoicTgo57M3Lg6g9vUiRlxmWqke/c9tEQK5o/fypB+YM1M2pNDY5Cmerv2A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jRAWNi1k; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jRAWNi1k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14B1AC116D0; Mon, 5 Jan 2026 15:01:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767625276; bh=YLMKOZuVzDuqeOTYIfEGrkR0nqoifKRHFSqLGuFhapk=; h=From:To:Cc:Subject:Date:Reply-To:From; b=jRAWNi1kwqtS0MLuVIZiBHGKkOf/BJGcPYUpxF9YIgaGbLwytRM3q1qIqpY4oZ0lz rMK61sovOa9ZVhD9lQ7e9Q/B3oLd+d7qN7ShbybXyV7k4JMmmsp0hEuyYrXT3dHgsf PlGwwZNTek40g+NCoo+iP1VEm/NthQH6ROj5469/wAwZZOpFL3+Ib8JKt6ikGT3TG/ L+M96ABWz016ftyZVH4gsbwnK7qxJjXKIm0VF614tAhP3UVyxb658IY43En5demMwA DCxQmjnabz3KE0AO9Uv2qWJo7J5ngHDSE0GS3A0nK1mSnyYsKT+6tcXeTrTYxDaM0P jrNFxSSSPukpQ== From: Gary Guo To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Miguel Ojeda , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andi Kleen , Dmitry Vyukov , Stephen Brennan Cc: Arnaldo Carvalho de Melo , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH v2] perf symbol: remove Rust symbol workarounds Date: Mon, 5 Jan 2026 15:00:57 +0000 Message-ID: <20260105150106.567830-1-gary@kernel.org> X-Mailer: git-send-email 2.51.2 Reply-To: Gary Guo Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Gary Guo 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. 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 Acked-by: Miguel Ojeda Signed-off-by: Gary Guo --- 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[] =3D { =20 #define DSO_BINARY_TYPE__SYMTAB_CNT ARRAY_SIZE(binary_type_symtab) =20 -static bool symbol_type__filter(char __symbol_type) -{ - // Since 'U' =3D=3D undefined and 'u' =3D=3D unique global symbol, we can= 't use toupper there - // 'N' is for debugging symbols, 'n' is a non-data, non-code, non-debug r= ead-only section. - // According to 'man nm'. - // 'N' first seen in: - // ffffffff9b35d130 N __pfx__RNCINvNtNtNtCsbDUBuN8AbD4_4core4iter8adapter= s3map12map_try_foldjNtCs6vVzKs5jPr6_12drm_panic_qr7VersionuINtNtNtBa_3ops12= control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Itera= tor4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_ - // a seemingly Rust mangled name - // Ditto for '1': - // root@x1:~# grep ' 1 ' /proc/kallsyms - // ffffffffb098bc00 1 __pfx__RNCINvNtNtNtCsfwaGRd4cjqE_4core4iter8adapter= s3map12map_try_foldjNtCskFudTml27HW_12drm_panic_qr7VersionuINtNtNtBa_3ops12= control_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Itera= tor4find5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_ - // ffffffffb098bc10 1 _RNCINvNtNtNtCsfwaGRd4cjqE_4core4iter8adapters3map1= 2map_try_foldjNtCskFudTml27HW_12drm_panic_qr7VersionuINtNtNtBa_3ops12contro= l_flow11ControlFlowB10_ENcB10_0NCINvNvNtNtNtB8_6traits8iterator8Iterator4fi= nd5checkB10_NCNvMB12_B10_13from_segments0E0E0B12_ - char symbol_type =3D toupper(__symbol_type); - return symbol_type =3D=3D 'T' || symbol_type =3D=3D 'W' || symbol_type = =3D=3D 'D' || symbol_type =3D=3D 'B' || - __symbol_type =3D=3D 'u' || __symbol_type =3D=3D 'l' || __symbol_t= ype =3D=3D 'N' || __symbol_type =3D=3D '1'; +static bool symbol_type__filter(char symbol_type) +{ + symbol_type =3D toupper(symbol_type); + return symbol_type =3D=3D 'T' || symbol_type =3D=3D 'W' || symbol_type = =3D=3D 'D' || symbol_type =3D=3D 'B'; } =20 static int prefix_underscores_count(const char *str) base-commit: 3609fa95fb0f2c1b099e69e56634edb8fc03f87c --=20 2.51.2