Re: [PATCH printk v7 29/35] printk: Coordinate direct printing in panic

From: Linus Torvalds
Date: Tue Aug 06 2024 - 13:31:06 EST


On Tue, 6 Aug 2024 at 02:59, Petr Mladek <pmladek@xxxxxxxx> wrote:
>
> I want to be sure that this is acceptable to you.

Just going by the superficial code, it's perfectly fine to delay other
consoles, as long as *some* consoles don't get delayed.

So yes:

> It is a bit different from the buffering during Oops. In this case,
> the new nbcon consoles will still be flushed immediately.

that sounds fine to me.

In general, I think delaying flushing is fine if

(a) re-entrancy issues with already active (ie non-buffered) printing
on a console

(b) there are higher-priority consoles that did flush it so that
something made it out

and obviously the whole "nbcon existing" will match that (b) case.

(In a perfect world the (a) case would be per-cpu, ie a "avoid obvious
deadlock", but honestly, I think any oops while the console is already
busy synchronously printing is understandable - and any concurrent
synchronous printing may be the more immediate cause of the oops -
we've certainly seen lots of cases where a bug on one CPU will then
immediately trigger on another one).

Linus