From: Petr Mladek <pmladek@suse.com>
To: Aaron Tomlin <atomlin@atomlin.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
Lance Yang <lance.yang@linux.dev>,
sean@ashe.io, linux-kernel@vger.kernel.org, mhiramat@kernel.org,
akpm@linux-foundation.org,
John Ogness <john.ogness@linutronix.de>
Subject: Re: [PATCH 1/2] hung_task: Consolidate hung task warning into an atomic log block
Date: Wed, 10 Dec 2025 14:08:25 +0100 [thread overview]
Message-ID: <aTlwyfRklNvodnj2@pathway> (raw)
In-Reply-To: <hnysi7a375k5qlud6d6pirqxvvv4bapkdxypknw4oj7ahzjowf@2cwflngr2dyw>
On Tue 2025-12-09 17:14:40, Aaron Tomlin wrote:
> On Tue, Dec 09, 2025 at 03:56:58PM +0900, Greg KH wrote:
> > > "%s\n" forces an unconditional newline, causing a spurious blank line when
> > > the flag isn't set, right?
> >
> > The first \n should not be there, this should be all one line.
>
> Hi Greg,
>
> I agree. This will be resolved in a subsequent patch.
I am not sure what exactly is requested here. But a multiline message
defined on a single line would be a mess. I mean that
printk("aaaa\nbbbbb\ncccccc\n") is hard to follow, in compare with
printk("aaaa\n"
"bbbbb\n"
"cccccc\n");
IMHO, the only motivation to keep printk() message on a single line is
that it helps grepping. But the "\n" breaks the grepping anyway.
> > If you have multiple lines wanting to be printed, use multiple pr_err()
> > calls.
>
> Unfortunately, sequential pr_err() calls risk having their lines separated
> by other log messages, rendering the warning incoherent. The single-call
> implementation is necessary to ensure the entire message is atomically
> written.
With the "printk" maintainer hat on, I am a bit afraid to go this way.
printk() is not designed for huge text blobs. Especially:
+ A single record is flushed to a console atomically, often
under spin lock with IRQs disabled. Too long messages might
cause soft lockups on slow serial consoles. [*]
+ A single record can't be wrapped at the end of the data buffer.
Instead, the remaining space gets unused and the message is
stored from the beginning of the buffer. So, bigger messages
might cause more unused space. Note that this limitation
simplified the already complicated lock-less code.
Instead, the caller ID should allow to sort the messages by a post
processing, see CONFIG_PRINTK_CALLER.
[*] The single message does not make a big difference in this case
because the hung task report is done from atomic context. And
it is an emergency message so that even nbcon console drivers
try to flush it immediately.
Best Regards,
Petr
next prev parent reply other threads:[~2025-12-10 13:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-09 4:12 [PATCH 0/2] hung_task: Provide runtime reset interface for hung task detector Aaron Tomlin
2025-12-09 4:12 ` [PATCH 1/2] hung_task: Consolidate hung task warning into an atomic log block Aaron Tomlin
2025-12-09 5:12 ` Lance Yang
2025-12-09 6:56 ` Greg KH
2025-12-09 22:14 ` Aaron Tomlin
2025-12-10 7:37 ` Greg KH
2025-12-10 13:08 ` Petr Mladek [this message]
2025-12-09 22:11 ` Aaron Tomlin
2025-12-09 4:12 ` [PATCH 2/2] hung_task: Provide runtime reset interface for hung task detector Aaron Tomlin
2025-12-09 4:54 ` Lance Yang
2025-12-09 22:06 ` Aaron Tomlin
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=aTlwyfRklNvodnj2@pathway \
--to=pmladek@suse.com \
--cc=akpm@linux-foundation.org \
--cc=atomlin@atomlin.com \
--cc=gregkh@linuxfoundation.org \
--cc=john.ogness@linutronix.de \
--cc=lance.yang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=sean@ashe.io \
/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