[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DCLCG5OPAF9W.FA6HN1GCS2O1@nvidia.com>
Date: Sat, 06 Sep 2025 10:58:49 +0900
From: "Alexandre Courbot" <acourbot@...dia.com>
To: "John Hubbard" <jhubbard@...dia.com>, "Danilo Krummrich"
<dakr@...nel.org>
Cc: "Joel Fernandes" <joelagnelf@...dia.com>,
<linux-kernel@...r.kernel.org>, "David Airlie" <airlied@...il.com>, "Simona
Vetter" <simona@...ll.ch>, "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>, "Alice Ryhl" <aliceryhl@...gle.com>,
"Trevor Gross" <tmgross@...ch.edu>, "Alistair Popple" <apopple@...dia.com>,
<nouveau@...ts.freedesktop.org>, <dri-devel@...ts.freedesktop.org>,
<rust-for-linux@...r.kernel.org>
Subject: Re: [PATCH 1/2] nova-core: Add a library for bitfields in Rust
structs
On Sat Sep 6, 2025 at 6:29 AM JST, John Hubbard wrote:
> On 9/4/25 4:06 AM, Alexandre Courbot wrote:
>> On Thu Sep 4, 2025 at 4:16 PM JST, Danilo Krummrich wrote:
>>> On Thu Sep 4, 2025 at 5:16 AM CEST, Alexandre Courbot wrote:
>>>> On Thu Sep 4, 2025 at 12:15 AM JST, Joel Fernandes wrote:
>>>> <snip>
>>> pub struct PageTableEntry {
>>> 63:63 nx as bool,
>>> 62:52 available2 as u16,
>>> 51:12 pfn as u64,
>>> 11:9 available as u8,
>>> 1:1 writable as bool,
>>> 0:0 present as bool,
>>> }
>>>
>>> This is also what would be my preferred style for the kernel in general.
>>
>> Sorry for the confusion. The discussion was whether to keep using the
>> `H:L` syntax of the current macro, or use Rust's inclusive ranges syntax
>> (i.e. `L..=H`), as the `genmask_*` macros currently do.
>>
>
> The H:L (for example "11:9 available as u8", above) is elegant and readable.
>
> The Rust native syntax "L..=H", much less so.
>
> For this part of the kernel, dealing specifically with bits, feel pretty
> strongly that we should go with "H:L".
We discussed that bit during the Rust DRM meeting, and the consensus was
indeed to go with `H:L` for these macros as this is the syntax typically
used in fields definitions.
Powered by blists - more mailing lists