[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <03f705dd-0135-40e8-9003-5d2a626bc439@nvidia.com>
Date: Tue, 13 Jan 2026 18:23:07 -0800
From: John Hubbard <jhubbard@...dia.com>
To: Gary Guo <gary@...yguo.net>, Danilo Krummrich <dakr@...nel.org>
Cc: Alexandre Courbot <acourbot@...dia.com>,
Joel Fernandes <joelagnelf@...dia.com>, Timur Tabi <ttabi@...dia.com>,
Alistair Popple <apopple@...dia.com>, Edwin Peer <epeer@...dia.com>,
Zhi Wang <zhiw@...dia.com>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Bjorn Helgaas <bhelgaas@...gle.com>,
Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, 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>, nouveau@...ts.freedesktop.org,
rust-for-linux@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
Gent Binaku <binakugent@...il.com>
Subject: Re: [PATCH 01/31] gpu: nova-core: print FB sizes, along with ranges
On 1/13/26 5:28 AM, Gary Guo wrote:
> On Wed Dec 3, 2025 at 5:58 AM GMT, John Hubbard wrote:
...
>> +pub(crate) struct FbRange(Range<u64>);
>
> How useful do you think this is in general? Would it make sense to have a
> dedicated PhysAddrRange type in kernel crate that provides this feature?
Pretty useful. Yes that sounds like a good move. And I see from Miguel's
reply that Gent Binaku (+CC) has a patch that proposes adding a
PhysAddrRange. I'll go review it in detail.
>
>> +
>> +impl From<Range<u64>> for FbRange {
>> + fn from(range: Range<u64>) -> Self {
>> + Self(range)
>> + }
>> +}
>> +
>> +impl Deref for FbRange {
>> + type Target = Range<u64>;
>> +
>> + fn deref(&self) -> &Self::Target {
>> + &self.0
>> + }
>> +}
>> +
>> +impl fmt::Debug for FbRange {
>> + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
>
> If you want to make this more generic, you can gate the size printing on
> `f.alternate()`. So if people use `{:?}` to print a compact form of `FbLayout`,
> they get just the range, and if they use `{:#?}` then they also get the sizes.
>
>> + let size_mb = (self.0.end - self.0.start) >> 20;
>> + f.write_fmt(fmt!(
>> + "{:#x}..{:#x} ({} MB)",
Great idea, that printing choice is extremely nice to have in exactly this situation.
>
> I would either just use IEC prefix "MiB", or alternatively use the coreutils
> convention and use "M" to represent MiB.
OK.
thanks,
--
John Hubbard
Powered by blists - more mailing lists