[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <021990F1-196A-47CB-8200-4B6887058BEA@nvidia.com>
Date: Sun, 30 Nov 2025 01:04:50 +0000
From: Joel Fernandes <joelagnelf@...dia.com>
To: John Hubbard <jhubbard@...dia.com>
CC: Alexandre Courbot <acourbot@...dia.com>, "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 Nov 29, 2025, at 5:44 PM, John Hubbard <jhubbard@...dia.com> wrote:
>
> 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.
I think we do. This is a C list abstraction (rust interacting with C-side code, the list_head comes from C bindings). If we want a pure rust list, we should not be using clist in the first place. There is list.rs for that.
Imagine C and rust both adding items to a C list but one is having debugging code but the other does not. That is really weird.
Thanks.
>
>
>
> thanks,
> --
> John Hubbard
>
Powered by blists - more mailing lists