From: John Hubbard <jhubbard@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>
Cc: "Alice Ryhl" <aliceryhl@google.com>,
'@google.com, "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>,
"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 14:29:55 -0700 [thread overview]
Message-ID: <4f8e038e-ff0e-484f-915b-3b292cd91363@nvidia.com> (raw)
In-Reply-To: <DHI4SCEVOQXG.1LN5Z1S7XYYLM@kernel.org>
On 4/1/26 2:20 PM, Danilo Krummrich wrote:
> On Wed Apr 1, 2026 at 10:22 PM CEST, John Hubbard wrote:
>> On 4/1/26 2:46 AM, Alice Ryhl wrote:
>>> On Tue, Mar 31, 2026 at 03:43:18PM -0700, John Hubbard wrote:
...
>>> The name `DeviceSize` seems overly specific to the use-case you had. It
>>
>> Yes, actually this name has been worrying me from the start. Because
>> it is not necessary to tie it, conceptually, to devices at all.
>>
>>> also makes it sound like something you would implement *for* the device
>>> type rather than for the integer type. Why not name it something more
>>> generic such as SizeConstants?
>>
>> Yes, thanks, I do think SizeConstants is more accurate.
>>
>> I'm inclined to make that change, unless someone else tells me not
>> to...let's see.
>
> I think I brought up the name DeviceSize when I proposed this.
I let this patchset linger so long in my backlog that I forgot the
trait's naming provenance. :)
>
> The reason is that when I proposed this I was thinking of it as a marker trait
> for "complex" types around u32, u64, etc. that we can use in DRM APIs (or any
> other device centric API) though generics.
>
> For instance, instead of GpuVm<T>::vm_start() -> u64, it could be
> GpuVm<T, V: DeviceSize>::vm_start() -> V.
>
> Another example would be buddy::Block<V: DeviceSize>::offset() -> V instead of
> buddy::Block::offset() -> u64.
>
> This way you can interact with the API with the actual device native size.
Yes. But it's an uneasy fit, somehow. I can (again) see the idea, but
it's also true that SizeConstants is something that is generally
desirable elsewhere, too.
>
> That said, I'm perfectly fine renaming this to something else; the "device
Excellent!
> semantics" comes from the API using the type, not the type itself.
That's exactly where I landed, too. And of course, when naming APIs,
it's best to pick names that describe what the API provides, rather
than to (often imperfectly) predict what current and future callers
may do.
thanks,
--
John Hubbard
next prev parent reply other threads:[~2026-04-01 21:30 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 [this message]
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
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=4f8e038e-ff0e-484f-915b-3b292cd91363@nvidia.com \
--to=jhubbard@nvidia.com \
--cc='@google.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=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
all inboxes | Powered by JetHome®