[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b79fc5fe-3682-4439-b669-663e234943b5@nvidia.com>
Date: Sat, 29 Nov 2025 14:44:20 -0800
From: John Hubbard <jhubbard@...dia.com>
To: Joel Fernandes <joelagnelf@...dia.com>,
Alexandre Courbot <acourbot@...dia.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"rust-for-linux@...r.kernel.org" <rust-for-linux@...r.kernel.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"dakr@...nel.org" <dakr@...nel.org>, "airlied@...il.com"
<airlied@...il.com>, Alistair Popple <apopple@...dia.com>,
"ojeda@...nel.org" <ojeda@...nel.org>,
"alex.gaynor@...il.com" <alex.gaynor@...il.com>,
"boqun.feng@...il.com" <boqun.feng@...il.com>,
"gary@...yguo.net" <gary@...yguo.net>,
"bjorn3_gh@...tonmail.com" <bjorn3_gh@...tonmail.com>,
"lossin@...nel.org" <lossin@...nel.org>,
"a.hindborg@...nel.org" <a.hindborg@...nel.org>,
"aliceryhl@...gle.com" <aliceryhl@...gle.com>,
"tmgross@...ch.edu" <tmgross@...ch.edu>, "simona@...ll.ch"
<simona@...ll.ch>,
"maarten.lankhorst@...ux.intel.com" <maarten.lankhorst@...ux.intel.com>,
"mripard@...nel.org" <mripard@...nel.org>,
"tzimmermann@...e.de" <tzimmermann@...e.de>, Timur Tabi <ttabi@...dia.com>,
"joel@...lfernandes.org" <joel@...lfernandes.org>,
"elle@...thered-steel.dev" <elle@...thered-steel.dev>,
"daniel.almeida@...labora.com" <daniel.almeida@...labora.com>,
Andrea Righi <arighi@...dia.com>, "phasta@...nel.org" <phasta@...nel.org>,
"nouveau@...ts.freedesktop.org" <nouveau@...ts.freedesktop.org>,
Nouveau <nouveau-bounces@...ts.freedesktop.org>
Subject: Re: [PATCH v2 1/3] rust: helpers: Add list helpers for C linked list
operations
On 11/28/25 1:49 PM, Joel Fernandes wrote:
> On 11/27/2025 8:46 AM, Alexandre Courbot wrote:
>> On Thu Nov 27, 2025 at 2:10 PM JST, Joel Fernandes wrote:
...
>> There is also at least one precedent: the Rust `page_align()` does not
>> call a C helper that wraps `PAGE_ALIGN()`, it just reimplements it. I
>> think `list_head` is a quite similar situation, but ultimately that's
>> for the core team to say.
>
> I don't think a one size/rule fits all will apply for this. We need carefully do
Case-by-case is certainly a good way to evaluate these things, yes.
> it on a case-by-case basis, for example - if we implement list_add directly in
> rust, we'd miss out on CONFIG_LIST_HARDENED. So for that, I will still use the
> bindings. For INIT_LIST_HEAD and iteration, it should be Ok, though. So I'll add
> that directly in Rust without bindings.
Here, I'm not so sure that even this case is a solid one. Because
CONFIG_LIST_HARDENED is a way for C code to help protect against
list corruption--which is generally going to come from the C side,
not the Rust side, for the most part.
Let the C code have its extra checks, but on the Rust side we can
either add them, or skip them--but I don't think we need to *invoke*
them via the C code.
thanks,
--
John Hubbard
Powered by blists - more mailing lists