[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5d569c73-6cb6-4d55-8423-c90937049366@nvidia.com>
Date: Mon, 9 Feb 2026 12:02:25 -0500
From: Joel Fernandes <joelagnelf@...dia.com>
To: Daniel Almeida <daniel.almeida@...labora.com>
Cc: linux-kernel@...r.kernel.org,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Jonathan Corbet <corbet@....net>, Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>, Tvrtko Ursulin
<tursulin@...ulin.net>, Huang Rui <ray.huang@....com>,
Matthew Auld <matthew.auld@...el.com>,
Matthew Brost <matthew.brost@...el.com>,
Lucas De Marchi <lucas.demarchi@...el.com>,
Thomas Hellström <thomas.hellstrom@...ux.intel.com>,
Helge Deller <deller@....de>, Danilo Krummrich <dakr@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, 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 <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>, Trevor Gross <tmgross@...ch.edu>,
John Hubbard <jhubbard@...dia.com>, Alistair Popple <apopple@...dia.com>,
Timur Tabi <ttabi@...dia.com>, Edwin Peer <epeer@...dia.com>,
Alexandre Courbot <acourbot@...dia.com>, Andrea Righi <arighi@...dia.com>,
Andy Ritger <aritger@...dia.com>, Zhi Wang <zhiw@...dia.com>,
Balbir Singh <balbirs@...dia.com>, Philipp Stanner <phasta@...nel.org>,
Elle Rhumsaa <elle@...thered-steel.dev>, joel@...lfernandes.org,
nouveau@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
rust-for-linux@...r.kernel.org, linux-doc@...r.kernel.org,
amd-gfx@...ts.freedesktop.org, intel-gfx@...ts.freedesktop.org,
intel-xe@...ts.freedesktop.org, linux-fbdev@...r.kernel.org
Subject: Re: [PATCH -next v7 1/2] rust: clist: Add support to interface with C
linked lists
On 2/6/2026 5:33 PM, Daniel Almeida wrote:
>>>
>>>
>>> Yeah, but my point being: is there a reason why the underlying list has to
>>> remain read-only? Is this a safety requirement or an invariant that is established
>>> by the code above?
>> I'm not fully sure if it's an invariant or a safety requirement, but anyone
>> creating a C list head on the rust side must guarantee that it is not modified.
>> Since rust has no visibility on the C side, I believe it is a Rust invariant
>> here that the existence of CListHead assumes that the list cannot be modified
>> once Rust has access over it. That is up to the creator (user) of the CListHead
>> to guarantee. In the DRM buddy case, once the list is allocated and accessible
>> from Rust, C code will not modify it while the Rust object exists.
>>
>> Does that make sense, or is there a better way to document this?
>>
>> --
>> Joel Fernandes
>
>
> In which case, I recommend moving this to a safety requirement when
> creating the list.
Ok, will do.
> I assume the purpose of not modifying the list on the C side is to avoid
> corrupting the list in Rust somehow?
Yes.
Thanks,
--
Joel Fernandes
Powered by blists - more mailing lists