Re: [PATCH printk v3 13/14] printk: Avoid non-panic CPUs writing to ringbuffer

From: Petr Mladek
Date: Fri Feb 02 2024 - 04:29:50 EST


On Thu 2023-12-14 22:48:00, John Ogness wrote:
> Commit 13fb0f74d702 ("printk: Avoid livelock with heavy printk
> during panic") introduced a mechanism to silence non-panic CPUs
> if too many messages are being dropped. Aside from trying to
> workaround the livelock bugs of legacy consoles, it was also
> intended to avoid losing panic messages. However, if non-panic
> CPUs are writing to the ringbuffer, then reacting to dropped
> messages is too late.
>
> To avoid losing panic CPU messages, silence non-panic CPUs
> immediately on panic.
>
> Signed-off-by: John Ogness <john.ogness@xxxxxxxxxxxxx>

I am slightly nervous about this change because it looks
too agresive ;-)

But it makes perfect sense. And it nicely complements the 10th
patch, see
https://lore.kernel.org/r/20231214214201.499426-11-john.ogness@xxxxxxxxxxxxx
The 10th patch allows to skip messages in reserved state. It might
cause skipping random messages from other CPUs. So it really
looks better to skip/ignore them completely.

It would be nice to mention the relation to the 10th patch
in the commit message. Something like:

<proposal>
Another motivation is that non-finalized messages already might be
skipped in panic(). By other words, random messages from non-panic
CPUs might already get lost. It is better to ignore all to avoid
confusion.
</proposal>

With the updated commit message:

Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>

Best Regards,
Petr