From: John Hubbard <jhubbard@nvidia.com>
To: 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>
Subject: Re: [PATCH] gpu: nova-core: use CStr::from_bytes_until_nul() and remove util.rs
Date: Tue, 6 Jan 2026 16:24:32 -0800 [thread overview]
Message-ID: <70a8a73e-2dad-4bad-83bb-a245b83afe5d@nvidia.com> (raw)
In-Reply-To: <9a8f8500-aa1e-4145-b84d-7ce424ead644@kernel.org>
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
next prev parent reply other threads:[~2026-01-07 0:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-03 1:34 [PATCH] gpu: nova-core: use CStr::from_bytes_until_nul() and remove util.rs John Hubbard
2026-01-03 21:21 ` Joel Fernandes
2026-01-06 2:29 ` John Hubbard
2026-01-06 12:02 ` Danilo Krummrich
2026-01-06 22:09 ` John Hubbard
2026-01-06 22:44 ` Danilo Krummrich
2026-01-07 0:24 ` John Hubbard [this message]
2026-01-07 10:20 ` Danilo Krummrich
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=70a8a73e-2dad-4bad-83bb-a245b83afe5d@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=epeer@nvidia.com \
--cc=gary@garyguo.net \
--cc=joelagnelf@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.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