Re: [GIT PULL] printk for 6.11

From: Peter Zijlstra
Date: Wed Jul 24 2024 - 08:47:56 EST


On Wed, Jul 24, 2024 at 10:42:11AM +0200, Petr Mladek wrote:
> On Tue 2024-07-23 14:07:12, Linus Torvalds wrote:
> > On Tue, 23 Jul 2024 at 13:41, John Ogness <john.ogness@xxxxxxxxxxxxx> wrote:
> > >
> > > Petr's pull request provides the functionality for a CPU to call
> > > printk() during emergencies so that each line only goes into the
> > > buffer. We also include a function to perform the flush at any time. As
> > > the series is implemented now, that flush happens after the warning is
> > > completely stored into the buffer. In cases where there is lots of data
> > > in the warning (such as in RCU stalls or lockdep splats), the flush
> > > happens after significant parts of the warning.
> >
> > I really think the flushing needs to be *way* more aggressive for any
> > oops. The "flush at end" is not even remotely sane.
> >
> > Some amount of buffering can make sense, eg when printing out the
> > regular register state over a few lines, there certainly shouldn't be
> > anything there that can cause problems.
>
> Yes, this was the intention. I have missed the code path calling
> the notifiers. The Oops/die code is more complicated.
>
> Otherwise, nbcon_cpu_emergency_enter()/exit() is
> used only around code printing various well defined debug
> reports, like WARN(), lockdep, or RCU stall.
>
> Note that the buffering is only in the emergency sections.
> The messages are flushed directly after reaching panic().
>
> Just to be sure. The buffering is _not_ there to solve cosmetic
> problems. It should allow storing important information before
> trying to flush it to consoles. It is because the flushing to consoles
> is slow, might trigger softlockups and even cause system to die.

So.. I've complained about this emergency buffering before. At the very
least the atomic consoles should never buffer and immediately print
everything. Per their definition they always work.

Slow is not a consideration. You might never reach the end of the
section, anything you can get before the machine dies is a win.