From: Gary Guo <gary@garyguo.net>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: Danilo Krummrich <dakr@kernel.org>,
Alexandre Courbot <acourbot@nvidia.com>,
Joel Fernandes <joelagnelf@nvidia.com>,
nouveau@lists.freedesktop.org, rust-for-linux@vger.kernel.org,
Miguel Ojeda <ojeda@kernel.org>,
Alice Ryhl <aliceryhl@google.com>
Subject: Re: [PATCH 2/2] gpu: nova-core: add missing newlines to several print strings
Date: Thu, 8 Jan 2026 12:55:23 +0000 [thread overview]
Message-ID: <20260108125523.5c7810ae.gary@garyguo.net> (raw)
In-Reply-To: <CANiq72mKUxGh8cdZW0fXPCg20zoL19HY0GxRSDSYCj68Mp04vw@mail.gmail.com>
On Wed, 7 Jan 2026 10:54:42 +0100
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote:
> On Wed, Jan 7, 2026 at 3:10 AM John Hubbard <jhubbard@nvidia.com> wrote:
> >
> > So there is not yet a clear convention visible in the code.
> >
> > Miguel, Alice, Gary et al, is there actually a preference already?
>
> They are supposed to have the `\n`.
>
> For a bit of context: when we discussed the printing a long time ago,
> I originally had:
>
> info!("foo");
>
> instead of:
>
> pr_info!("foo\n");
>
> i.e. both the prefix and the newline were assumed, but we were asked
> to keep it close to the C side, which is fair.
In very early days (before RfL is upstreamed), I had a prototype print
macro that is designed like this:
info!("foo"); // pr_info("foo\n");
info!(target: dev, "foo"); // dev_info(dev, "foo\n");
info!(target: dev, once, "foo"); // dev_info_once(dev, "foo\n");
info!(target: dev, ratelimited, "foo"); // dev_info_ratelimited(dev, "foo\n");
There's a trait that is implemented for anything that can be used as a
printing target.
I still think this is superior than just having our macro mimicking the C
side (and as a result, having a lot of macros rather than just one for
each level).
I think with Rust printing machinary, `pr_cont` is rarely useful, instead
of calling `pr_info` followed by multiple `pr_cont`, you can just have a
custom `Display` implementation and print it in one go. This is also free
from racing against another print and have your lines broken into two
parts.
I would be much in favour of vouching deleteing `pr_cont` entirely from
Rust codebase and always have newlines automatically added.
Best,
Gary
WARNING: multiple messages have this Message-ID (diff)
From: Gary Guo <gary@garyguo.net>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: John Hubbard <jhubbard@nvidia.com>, Timur Tabi <ttabi@nvidia.com>,
Danilo Krummrich <dakr@kernel.org>,
Alexandre Courbot <acourbot@nvidia.com>,
Joel Fernandes <joelagnelf@nvidia.com>,
nouveau@lists.freedesktop.org, rust-for-linux@vger.kernel.org,
Miguel Ojeda <ojeda@kernel.org>,
Alice Ryhl <aliceryhl@google.com>
Subject: Re: [PATCH 2/2] gpu: nova-core: add missing newlines to several print strings
Date: Thu, 8 Jan 2026 12:55:23 +0000 [thread overview]
Message-ID: <20260108125523.5c7810ae.gary@garyguo.net> (raw)
In-Reply-To: <CANiq72mKUxGh8cdZW0fXPCg20zoL19HY0GxRSDSYCj68Mp04vw@mail.gmail.com>
On Wed, 7 Jan 2026 10:54:42 +0100
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote:
> On Wed, Jan 7, 2026 at 3:10 AM John Hubbard <jhubbard@nvidia.com> wrote:
> >
> > So there is not yet a clear convention visible in the code.
> >
> > Miguel, Alice, Gary et al, is there actually a preference already?
>
> They are supposed to have the `\n`.
>
> For a bit of context: when we discussed the printing a long time ago,
> I originally had:
>
> info!("foo");
>
> instead of:
>
> pr_info!("foo\n");
>
> i.e. both the prefix and the newline were assumed, but we were asked
> to keep it close to the C side, which is fair.
In very early days (before RfL is upstreamed), I had a prototype print
macro that is designed like this:
info!("foo"); // pr_info("foo\n");
info!(target: dev, "foo"); // dev_info(dev, "foo\n");
info!(target: dev, once, "foo"); // dev_info_once(dev, "foo\n");
info!(target: dev, ratelimited, "foo"); // dev_info_ratelimited(dev, "foo\n");
There's a trait that is implemented for anything that can be used as a
printing target.
I still think this is superior than just having our macro mimicking the C
side (and as a result, having a lot of macros rather than just one for
each level).
I think with Rust printing machinary, `pr_cont` is rarely useful, instead
of calling `pr_info` followed by multiple `pr_cont`, you can just have a
custom `Display` implementation and print it in one go. This is also free
from racing against another print and have your lines broken into two
parts.
I would be much in favour of vouching deleteing `pr_cont` entirely from
Rust codebase and always have newlines automatically added.
Best,
Gary
next prev parent reply other threads:[~2026-01-08 12:55 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-07 1:24 [PATCH 1/2] gpu: nova-core: check for overflow to DMATRFBASE1 Timur Tabi
2026-01-07 1:24 ` [PATCH 2/2] gpu: nova-core: add missing newlines to several print strings Timur Tabi
2026-01-07 2:10 ` John Hubbard
2026-01-07 2:21 ` Timur Tabi
2026-01-07 2:39 ` John Hubbard
2026-01-07 10:22 ` Miguel Ojeda
2026-01-07 10:22 ` Miguel Ojeda
2026-01-07 9:54 ` Miguel Ojeda
2026-01-07 9:54 ` Miguel Ojeda
2026-01-08 12:55 ` Gary Guo [this message]
2026-01-08 12:55 ` Gary Guo
2026-01-08 13:36 ` Danilo Krummrich
2026-01-08 13:36 ` Danilo Krummrich
2026-01-08 13:42 ` Alice Ryhl
2026-01-08 13:42 ` Alice Ryhl
2026-01-08 14:13 ` Gary Guo
2026-01-08 14:13 ` Gary Guo
2026-01-07 1:56 ` [PATCH 1/2] gpu: nova-core: check for overflow to DMATRFBASE1 John Hubbard
2026-01-07 2:04 ` Timur Tabi
2026-01-07 3:55 ` Joel Fernandes
2026-01-07 3:55 ` Joel Fernandes
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=20260108125523.5c7810ae.gary@garyguo.net \
--to=gary@garyguo.net \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=dakr@kernel.org \
--cc=joelagnelf@nvidia.com \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=nouveau@lists.freedesktop.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.