Re: [RFC PATCH v4 9/9] printk: use a new ringbuffer implementation

Linus Torvalds
2019-08-09T15:57:35Z

On Thu, Aug 8, 2019 at 11:14 PM Peter Zijlstra <peterz@infradead.org> wrote:
>
> Note that you can hook this into printk as a fake early serial device;
> just have the serial device write to the DRAM buffer.

No, you really really can't.

Look, the whole point of that reboot buffer is that it works WHEN
NOTHING ELSE DOES.

Very much including things like "oh, we're doing a suspend/resume, so
the console lock is held to make sure we don't touch any devices that
are likely dead right now".

The poweroff buffer is not a console. Don't even try to think of it as
one. It's for when consoles don't work. Trying to make it be an
early-console would completely defeat the whole point.

Even the "early console" stuff tries to honor serialization by
console_lock and console_suspended etc. Or things like the "I'm in the
middle of the scheduler, so I won't be doing any real logging".

If the system works, and you get console output or you have a working
syslogd that saves messages to disk, all of this is entirely
irrelevant. Really.

Don't think of it as a console. If you do, you're doing it wrong.

Linus