From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "John Hubbard" <jhubbard@nvidia.com>,
"Lyude Paul" <lyude@redhat.com>,
"Danilo Krummrich" <dakr@kernel.org>
Cc: "Alexandre Courbot" <acourbot@nvidia.com>,
"Joel Fernandes" <joelagnelf@nvidia.com>,
"Timur Tabi" <ttabi@nvidia.com>,
"Alistair Popple" <apopple@nvidia.com>,
"Edwin Peer" <epeer@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>,
nouveau@lists.freedesktop.org, rust-for-linux@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
Nouveau <nouveau-bounces@lists.freedesktop.org>
Subject: Re: [PATCH v2 2/5] gpu: nova-core: add FbRange.len() and use it in boot.rs
Date: Fri, 28 Nov 2025 14:27:49 +0900 [thread overview]
Message-ID: <DEK2VE9DDHUP.SH7LJ2D3TBBG@nvidia.com> (raw)
In-Reply-To: <49997040-a745-44aa-94d5-517845271094@nvidia.com>
On Thu Nov 27, 2025 at 9:53 AM JST, John Hubbard wrote:
> On 11/26/25 3:43 PM, Lyude Paul wrote:
>> I'm not sure this is necessary - for one, we could just use the .len() method
>> on the Range. As well - if we just implement Deref for FbRange (which I think
>> would be fine here) we could just use .len() through that.
>
> Hi Lyude!
>
> Good idea about the deref coercion. It has a minor type mismatch as-is,
> though: Range<u64>::len() returns usize, but FbRange::len() returns u64,
> which matches the callers that we have so far.
It's even worse than that, `Range<u64>::len()` simply doesn't exist. :)
`len()` is implemented through `ExactSizeIterator`, which specifies the
return type as `usize`. This obviously cannot provide a reliable result
when the range is u64, so the implementation was simply not done. See
[1] for evidence.
But having our own range type lets us slip our own `fn len(&self) ->
u64` implementation.
[1] https://doc.rust-lang.org/std/ops/struct.Range.html
next prev parent reply other threads:[~2025-11-28 5:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 1:39 [PATCH v2 0/5] gpu: nova-core: Hopper/Blackwell prerequisites John Hubbard
2025-11-26 1:39 ` [PATCH v2 1/5] gpu: nova-core: print FB sizes, along with ranges John Hubbard
2025-11-26 1:39 ` [PATCH v2 2/5] gpu: nova-core: add FbRange.len() and use it in boot.rs John Hubbard
2025-11-26 23:43 ` Lyude Paul
2025-11-27 0:53 ` John Hubbard
2025-11-28 5:27 ` Alexandre Courbot [this message]
2025-12-02 17:55 ` Lyude Paul
2025-11-26 1:39 ` [PATCH v2 3/5] gpu: nova-core: Hopper/Blackwell: basic GPU identification John Hubbard
2025-11-26 1:39 ` [PATCH v2 4/5] nova-core: factor .fwsignature* selection into a new get_gsp_sigs_section() John Hubbard
2025-11-26 1:39 ` [PATCH v2 5/5] gpu: nova-core: use GPU Architecture to simplify HAL selections John Hubbard
2025-12-03 5:26 ` [PATCH v2 0/5] gpu: nova-core: Hopper/Blackwell prerequisites 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=DEK2VE9DDHUP.SH7LJ2D3TBBG@nvidia.com \
--to=acourbot@nvidia.com \
--cc=a.hindborg@kernel.org \
--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=epeer@nvidia.com \
--cc=gary@garyguo.net \
--cc=jhubbard@nvidia.com \
--cc=joelagnelf@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=lyude@redhat.com \
--cc=nouveau-bounces@lists.freedesktop.org \
--cc=nouveau@lists.freedesktop.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).