[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAH5fLgi05p6KTN2v=+jy4HoK-oC9pg7dYBuc8wvfx_uN6SVjOg@mail.gmail.com>
Date: Wed, 5 Feb 2025 14:14:51 +0100
From: Alice Ryhl <aliceryhl@...gle.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Andrew Lunn <andrew@...n.ch>, Christian Schrefl <chrisi.schrefl@...il.com>,
Arnd Bergmann <arnd@...db.de>, Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>,
Trevor Gross <tmgross@...ch.edu>, Jonathan Corbet <corbet@....net>, Russell King <linux@...linux.org.uk>,
Rudraksha Gupta <guptarud@...il.com>, Ard Biesheuvel <ardb@...nel.org>,
Geert Stappers <stappers@...ppers.nl>, Jamie Cunliffe <Jamie.Cunliffe@....com>,
Sven Van Asbroeck <thesven73@...il.com>, rust-for-linux@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
Catalin Marinas <catalin.marinas@....com>
Subject: Re: [PATCH v3] arm: rust: Enable Rust support for ARMv7
On Wed, Feb 5, 2025 at 2:12 PM Miguel Ojeda
<miguel.ojeda.sandonis@...il.com> wrote:
>
> On Fri, Jan 31, 2025 at 5:05 PM Andrew Lunn <andrew@...n.ch> wrote:
> >
> > Floating point is banned within the kernel, except for in very narrow
> > conditions, because the floating point registers are lazy saved on
> > context switch. If the kernel uses the floating point registers, you
> > can break user space in bad ways.
> >
> > I expect this has been discussed, since it is well known kernel
> > restriction. Maybe go see what happened to that discussion within RfL?
>
> Yeah, it has been discussed, including in the last couple weeks in the
> Rust Zulip due to the upcoming move to the aarch64 `softfloat` target
> (the disallowing of disabling `neon` in the hardfloat one).
>
> Ideally, I think upstream Rust could perhaps give us a way to do
> something like `-mgeneral-regs-only` or `-march=...+nofp` (in the form
> GCC does it, i.e. a hard error if one even tries to use the floating
> point types even within a function implementation, not just in
> interfaces like in Clang), i.e. a way to avoid unintended use of
> floating point facilities:
>
> https://godbolt.org/z/o1E5nrrzc
>
> Currently it is unclear what form that could take (e.g. whether a
> `-nofloat` target could be possible, "disabling" the `f*` types, just
> Clippy...).
Seems like we already have a warning for it:
warning: floating-point arithmetic detected
--> /home/aliceryhl/rust-for-linux/rust/kernel/lib.rs:89:5
|
89 | a + b
| ^^^^^
|
= help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#float_arithmetic
= note: requested on the command line with `-W clippy::float-arithmetic`
> Cc'ing Catalin in case he wants to be in the loop, since I discussed
> it with him recently.
>
> Cheers,
> Miguel
Powered by blists - more mailing lists