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