From: Joel Fernandes <joelagnelf@nvidia.com>
To: John Hubbard <jhubbard@nvidia.com>
Cc: Alexandre Courbot <acourbot@nvidia.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"rust-for-linux@vger.kernel.org" <rust-for-linux@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"dakr@kernel.org" <dakr@kernel.org>,
"airlied@gmail.com" <airlied@gmail.com>,
Alistair Popple <apopple@nvidia.com>,
"ojeda@kernel.org" <ojeda@kernel.org>,
"alex.gaynor@gmail.com" <alex.gaynor@gmail.com>,
"boqun.feng@gmail.com" <boqun.feng@gmail.com>,
"gary@garyguo.net" <gary@garyguo.net>,
"bjorn3_gh@protonmail.com" <bjorn3_gh@protonmail.com>,
"lossin@kernel.org" <lossin@kernel.org>,
"a.hindborg@kernel.org" <a.hindborg@kernel.org>,
"aliceryhl@google.com" <aliceryhl@google.com>,
"tmgross@umich.edu" <tmgross@umich.edu>,
"simona@ffwll.ch" <simona@ffwll.ch>,
"maarten.lankhorst@linux.intel.com"
<maarten.lankhorst@linux.intel.com>,
"mripard@kernel.org" <mripard@kernel.org>,
"tzimmermann@suse.de" <tzimmermann@suse.de>,
Timur Tabi <ttabi@nvidia.com>,
"joel@joelfernandes.org" <joel@joelfernandes.org>,
"elle@weathered-steel.dev" <elle@weathered-steel.dev>,
"daniel.almeida@collabora.com" <daniel.almeida@collabora.com>,
Andrea Righi <arighi@nvidia.com>,
"phasta@kernel.org" <phasta@kernel.org>,
"nouveau@lists.freedesktop.org" <nouveau@lists.freedesktop.org>,
Nouveau <nouveau-bounces@lists.freedesktop.org>
Subject: Re: [PATCH v2 1/3] rust: helpers: Add list helpers for C linked list operations
Date: Sun, 30 Nov 2025 01:04:50 +0000 [thread overview]
Message-ID: <021990F1-196A-47CB-8200-4B6887058BEA@nvidia.com> (raw)
In-Reply-To: <b79fc5fe-3682-4439-b669-663e234943b5@nvidia.com>
> On Nov 29, 2025, at 5:44 PM, John Hubbard <jhubbard@nvidia.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
>
next prev parent reply other threads:[~2025-11-30 1:04 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-11 17:13 Joel Fernandes
2025-11-11 17:13 ` [PATCH v2 2/3] rust: clist: Add basic list infrastructure and head iterator Joel Fernandes
2025-11-24 3:47 ` Alexandre Courbot
2025-11-25 23:03 ` Joel Fernandes
2025-11-25 23:06 ` Joel Fernandes
2025-11-28 18:39 ` Daniel Almeida
2025-11-11 17:13 ` [PATCH v2 3/3] rust: clist: Add typed iteration with FromListHead trait Joel Fernandes
2025-11-24 7:01 ` Alexandre Courbot
2025-11-25 23:29 ` Joel Fernandes
2025-11-26 1:03 ` Alexandre Courbot
2025-11-26 20:14 ` Joel Fernandes
2025-11-27 3:43 ` Alexandre Courbot
2025-11-27 5:08 ` Joel Fernandes
2025-11-11 17:13 ` [PATCH v2 0/3] rust: Introduce support for C linked list interfacing Joel Fernandes
2025-11-11 19:54 ` Miguel Ojeda
2025-11-11 21:52 ` Joel Fernandes
2025-11-25 14:52 ` [PATCH v2 1/3] rust: helpers: Add list helpers for C linked list operations Alexandre Courbot
2025-11-25 18:16 ` Joel Fernandes
2025-11-25 19:48 ` John Hubbard
2025-11-25 22:52 ` Joel Fernandes
2025-11-26 1:16 ` Alexandre Courbot
2025-11-26 1:39 ` John Hubbard
2025-11-26 10:06 ` Miguel Ojeda
2025-11-26 18:15 ` John Hubbard
2025-11-26 18:50 ` Joel Fernandes
2025-11-26 20:57 ` John Hubbard
2025-11-27 5:10 ` Joel Fernandes
2025-11-27 13:46 ` Alexandre Courbot
2025-11-28 21:49 ` Joel Fernandes
2025-11-29 22:44 ` John Hubbard
2025-11-30 1:04 ` Joel Fernandes [this message]
2025-11-28 18:20 ` Daniel Almeida
2025-11-28 18:17 ` Daniel Almeida
2025-12-03 3:30 ` Alexandre Courbot
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=021990F1-196A-47CB-8200-4B6887058BEA@nvidia.com \
--to=joelagnelf@nvidia.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=apopple@nvidia.com \
--cc=arighi@nvidia.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=elle@weathered-steel.dev \
--cc=gary@garyguo.net \
--cc=jhubbard@nvidia.com \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=nouveau-bounces@lists.freedesktop.org \
--cc=nouveau@lists.freedesktop.org \
--cc=ojeda@kernel.org \
--cc=phasta@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=tmgross@umich.edu \
--cc=ttabi@nvidia.com \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®