[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <70a8a73e-2dad-4bad-83bb-a245b83afe5d@nvidia.com>
Date: Tue, 6 Jan 2026 16:24:32 -0800
From: John Hubbard <jhubbard@...dia.com>
To: 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>, 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>,
nouveau@...ts.freedesktop.org, rust-for-linux@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] gpu: nova-core: use CStr::from_bytes_until_nul() and
remove util.rs
On 1/6/26 2:44 PM, Danilo Krummrich wrote:
> On 1/6/26 11:09 PM, John Hubbard wrote:
...
>> + let gpu_name = info
>> + .gpu_name()
>> + .inspect_err(|e| dev_warn!(pdev.as_ref(), "GPU name: {}\n", e))
>> + .unwrap_or("<unavailable>");
>> + dev_info!(pdev.as_ref(), "GPU name: {}\n", gpu_name);
>
> I'd probably only print one or the other. Also, I think this should be
Done.
> dev_dbg!() instead of dev_info!().
We have been *very* sparing with the dev_info(), and at this point,
there are precisely two places where Nova logs at info level: at first
probe, and after finding the true GPU marketing name (buried in the
firmware).
I think we've found a nice balance now. The output looks like this:
$ dmesg -t --level=info|grep NovaCore
NovaCore 0000:e1:00.0: NVIDIA (Chipset: GA104, Architecture: Ampere, Revision: a.1)
NovaCore 0000:e1:00.0: GPU name: NVIDIA RTX A4000
[drm] Initialized nova 0.0.0 for NovaCore.nova-drm.0 on minor 0
So I'd love to leave the GPU name at info level, if you agree that
this is about right.
>
>> +/// Error type for [`GetGspStaticInfoReply::gpu_name`].
>> +#[derive(Debug)]
>> +pub(crate) enum GpuNameError {
>> + /// The GPU name string does not contain a null terminator.
>> + NoNullTerminator(FromBytesUntilNulError),
>> +
>> + /// The GPU name string contains invalid UTF-8.
>> + InvalidUtf8(Utf8Error),
>> +}
>> +
>> +impl kernel::fmt::Display for GpuNameError {
>> + fn fmt(&self, f: &mut kernel::fmt::Formatter<'_>) -> kernel::fmt::Result {
>> + match self {
>> + Self::NoNullTerminator(_) => write!(f, "no null terminator"),
>> + Self::InvalidUtf8(e) => write!(f, "invalid UTF-8 at byte {}", e.valid_up_to()),
>> + }
>> + }
>> +}
>
> Do we need this Display impl, or is the derive(Debug) you have already good
> enough for the warning print?
>
Good point. Prettier printing is not worth it for such a rare corner case.
The Debug printer still provides the key information that one would need.
thanks,
--
John Hubbard
Powered by blists - more mailing lists