From: John Hubbard <jhubbard@nvidia.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: "Danilo Krummrich" <dakr@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Joel Fernandes" <joelagnelf@nvidia.com>,
"Timur Tabi" <ttabi@nvidia.com>,
"Alistair Popple" <apopple@nvidia.com>,
"Eliot Courtney" <ecourtney@nvidia.com>,
"Shashank Sharma" <shashanks@nvidia.com>,
"Zhi Wang" <zhiw@nvidia.com>, "David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
rust-for-linux@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 1/2] rust: sizes: add DeviceSize trait for device address space constants
Date: Wed, 1 Apr 2026 13:33:52 -0700 [thread overview]
Message-ID: <b18b99df-8b25-40f7-ba0c-9f8f0da36fa8@nvidia.com> (raw)
In-Reply-To: <CANiq72mv7ZUest-yPV61Y+L-RtnYTWSKNMUfT7EGFiDG5jimKA@mail.gmail.com>
On 4/1/26 3:16 AM, Miguel Ojeda wrote:
> On Wed, Apr 1, 2026 at 12:43 AM John Hubbard <jhubbard@nvidia.com> wrote:
>>
>> +//! // usize constant (CPU-side)
>
> Some nits below -- possibly for apply time.
I've fixed all of them in a pending v4, which I think I'll need
to post in order to rename the trait, as per the other thread with
Alice.
Sorry that these slipped in, there are three separate systems
that should have caught them, each of which requires a bit of
maintenance:
* My brain: still hasn't emotionally absorbed these rules yet,
especially the backtick thing. Work in progress... :)
* checkpatch.pl: it's still delighted to bless all of these
patches with a "has no obvious style problems and is ready for
submission, hooray!".
I could update checkpatch, but...I wonder if it's really
the right tool. I forget what we decided lately, but I vaguely
recall wanting the Rust toolchain to help.
* Local AI reviewer tool(s): this at least I can quickly fix: I've
added a few lines to the rules.
thanks,
--
John Hubbard
>
> Markdown and period:
>
> //! // `usize` constant (CPU-side).
>
>> +//! let num_pages_in_1m: usize = SZ_1M / kernel::page::PAGE_SIZE;
>
> Perhaps import `PAGE_SIZE` since we are doing imports above anyway?
>
>> +//! // Device-side constant via the trait
>
> Period at the end.
>
>> +//! let heap_size: u64 = 14 * u64::SZ_1M;
>> +//! let small: u32 = u32::SZ_4K;
>
> I guess the resulting types here are to make it clearer; or do we
> expect people to write the sizes for this? i.e. since part of the
> advantage of using the constants is that you get them already typed, I
> wonder if we should write the code as we would normally expect it to
> be written.
>
> Also, I always consider in examples whether to add `assert_eq!`s, but
> I am ambivalent for this case.
>
>> + /// 0x0000_0400
>> + SZ_1K,
>
> This is consistent with the other constants, but I wonder if there was
> a reason to not do something like:
>
> /// `0x0000_0400`.
>
> Anyway, all these is minor or can be fixed on apply.
>
> These constants are meant to be useful soon, so we could do the same
> as with the other patch, i.e. I could pick it already it depending on
> the rest of the discussion (especially if we confirm that the user
> patch is what we want).
>
> Thanks!
>
> Cheers,
> Miguel
next prev parent reply other threads:[~2026-04-01 20:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 22:43 [PATCH v3 0/2] rust, nova-core: add DeviceSize trait for SZ_* constants John Hubbard
2026-03-31 22:43 ` [PATCH v3 1/2] rust: sizes: add DeviceSize trait for device address space constants John Hubbard
2026-04-01 9:46 ` Alice Ryhl
2026-04-01 20:22 ` John Hubbard
2026-04-01 21:20 ` Danilo Krummrich
2026-04-01 21:29 ` John Hubbard
2026-04-02 1:42 ` Alexandre Courbot
2026-04-03 1:36 ` John Hubbard
2026-04-03 8:21 ` Alexandre Courbot
2026-04-03 12:56 ` Gary Guo
2026-04-03 13:07 ` Danilo Krummrich
2026-04-04 1:46 ` John Hubbard
2026-04-01 10:16 ` Miguel Ojeda
2026-04-01 20:33 ` John Hubbard [this message]
2026-03-31 22:43 ` [PATCH v3 2/2] gpu: nova-core: use DeviceSize trait for u64 size constants John Hubbard
2026-04-01 7:01 ` [PATCH v3 0/2] rust, nova-core: add DeviceSize trait for SZ_* constants Eliot Courtney
2026-04-01 20:46 ` John Hubbard
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=b18b99df-8b25-40f7-ba0c-9f8f0da36fa8@nvidia.com \
--to=jhubbard@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=bhelgaas@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=joelagnelf@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=shashanks@nvidia.com \
--cc=simona@ffwll.ch \
--cc=tmgross@umich.edu \
--cc=ttabi@nvidia.com \
--cc=zhiw@nvidia.com \
/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