patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Joel Fernandes <joelagnelf@nvidia.com>
To: Miguel Ojeda <ojeda@kernel.org>
Cc: "Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	patches@lists.linux.dev, stable@vger.kernel.org,
	"Josh Poimboeuf" <jpoimboe@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	ttabi@nvidia.com, acourbot@nvidia.com, jhubbard@nvidia.com,
	apopple@nvidia.com
Subject: Re: [PATCH 1/5] objtool/rust: add one more `noreturn` Rust function for Rust 1.87.0
Date: Tue, 13 May 2025 14:07:57 -0400	[thread overview]
Message-ID: <20250513180757.GA1295002@joelnvbox> (raw)
In-Reply-To: <20250502140237.1659624-2-ojeda@kernel.org>

Hello Miguel,

On Fri, May 02, 2025 at 04:02:33PM +0200, Miguel Ojeda wrote:
> Starting with Rust 1.87.0 (expected 2025-05-15), `objtool` may report:
> 
>     rust/core.o: warning: objtool: _R..._4core9panicking9panic_fmt() falls
>     through to next function _R..._4core9panicking18panic_nounwind_fmt()
> 
>     rust/core.o: warning: objtool: _R..._4core9panicking18panic_nounwind_fmt()
>     falls through to next function _R..._4core9panicking5panic()

We are seeing a similar issue with the patch [1]:

  RUSTC [M] drivers/gpu/nova-core/nova_core.o
drivers/gpu/nova-core/nova_core.o: warning: objtool:
<nova_core::vbios::PciAtBiosImage as
core::convert::TryFrom<nova_core::vbios::BiosImageBase>>::try_from() falls
through to next function <nova_core::vbios::FwSecBiosImage>::fwsec_header()

The code in concern is implementing try_from():
+
+impl TryFrom<BiosImageBase> for PciAtBiosImage {
+    type Error = Error;
+
+    fn try_from(base: BiosImageBase) -> Result<Self> {

I dumped the codegen [2] for this function and at the end of the codegen, there
is a call instruction to to the fwsec_header() function.

Any thoughts on how to fix the warning?

thanks,

 - Joel

[1] https://lore.kernel.org/all/20250420-nova-frts-v1-13-ecd1cca23963@nvidia.com/
[2] https://paste.debian.net/1374516/


> The reason is that `rust_begin_unwind` is now mangled:
> 
>     _R..._7___rustc17rust_begin_unwind
> 
> Thus add the mangled one to the list so that `objtool` knows it is
> actually `noreturn`.
> 
> See commit 56d680dd23c3 ("objtool/rust: list `noreturn` Rust functions")
> for more details.
> 
> Alternatively, we could remove the fixed one in `noreturn.h` and relax
> this test to cover both, but it seems best to be strict as long as we can.
> 
> Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs).
> Cc: Josh Poimboeuf <jpoimboe@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> ---
>  tools/objtool/check.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index 3a411064fa34..b21b12ec88d9 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -227,6 +227,7 @@ static bool is_rust_noreturn(const struct symbol *func)
>  	       str_ends_with(func->name, "_4core9panicking19assert_failed_inner")			||
>  	       str_ends_with(func->name, "_4core9panicking30panic_null_pointer_dereference")		||
>  	       str_ends_with(func->name, "_4core9panicking36panic_misaligned_pointer_dereference")	||
> +	       str_ends_with(func->name, "_7___rustc17rust_begin_unwind")				||
>  	       strstr(func->name, "_4core9panicking13assert_failed")					||
>  	       strstr(func->name, "_4core9panicking11panic_const24panic_const_")			||
>  	       (strstr(func->name, "_4core5slice5index24slice_") &&
> --
> 2.49.0

  reply	other threads:[~2025-05-13 18:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-02 14:02 [PATCH 0/5] Rust beta (1.87) and nightly (1.88) lint cleanups Miguel Ojeda
2025-05-02 14:02 ` [PATCH 1/5] objtool/rust: add one more `noreturn` Rust function for Rust 1.87.0 Miguel Ojeda
2025-05-13 18:07   ` Joel Fernandes [this message]
2025-05-13 21:58     ` Joel Fernandes
2025-05-14  0:22       ` John Hubbard
2025-05-14  0:43         ` Timur Tabi
2025-05-14 14:52           ` Joel Fernandes
2025-05-14 19:14             ` Josh Poimboeuf
2025-05-14 19:46               ` Timur Tabi
2025-05-15 16:18                 ` Josh Poimboeuf
2025-05-15 19:06                   ` Timur Tabi
2025-05-15 21:12                     ` Kane York
2025-05-15 22:16                     ` Josh Poimboeuf
2025-05-15 22:22                       ` Timur Tabi
2025-05-20 19:49     ` Miguel Ojeda
2025-05-02 14:02 ` [PATCH 2/5] rust: clean Rust 1.87.0's `clippy::ptr_eq` lints Miguel Ojeda
2025-05-05  9:23   ` Alice Ryhl
2025-05-05 15:25     ` Miguel Ojeda
2025-05-02 14:02 ` [PATCH 3/5] rust: clean Rust 1.88.0's `unnecessary_transmutes` lint Miguel Ojeda
2025-05-02 14:02 ` [PATCH 4/5] rust: clean Rust 1.88.0's warning about `clippy::disallowed_macros` configuration Miguel Ojeda
2025-05-02 14:02 ` [PATCH 5/5] rust: clean Rust 1.88.0's `clippy::uninlined_format_args` lint Miguel Ojeda
2025-05-02 16:01   ` Tamir Duberstein
2025-05-02 18:49   ` Benno Lossin
2025-05-05  9:23 ` [PATCH 0/5] Rust beta (1.87) and nightly (1.88) lint cleanups Alice Ryhl
2025-05-06 22:22 ` Miguel Ojeda

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=20250513180757.GA1295002@joelnvbox \
    --to=joelagnelf@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=apopple@nvidia.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=jhubbard@nvidia.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=peterz@infradead.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=ttabi@nvidia.com \
    /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;
as well as URLs for NNTP newsgroup(s).