Re: [GIT PULL] printk for 5.20

From: Sebastian Andrzej Siewior
Date: Wed Aug 03 2022 - 12:34:43 EST


On 2022-08-03 09:08:07 [-0700], Linus Torvalds wrote:
> But thinking some more about it, even the "serious RT" people almost
> certainly don't really want some kind of static "disable it all". Not
> even if it was a separate Kconfig question like I suggested.
>
> You'd most likely want it to be dynamic, because things like "log to
> console" is different at bootup when the system hasn't started yet -
> you can't really have realtime response when your hardware hasn't even
> initialized yet - and when things are actually running.
>
> So I think even then you really just want a "turn off console logging"
> dynamic flag, not a Kconfig option.

Having such a flag would mean we have to set it starting with
SYSTEM_SCHEDULING because otherwise we risk a deadlock once the console
driver tries to acquire its lock. The printk code invokes the console
drivers with disabled interrupts and the console driver use spinlock_t
locking which become sleeping locks on PREEMPT_RT and must not be
acquired with disabled interrupts.
The long term solution is to have a printing thread for the console
driver and the atomic console support to print directly in an emergency
case.

> Which I think we already have, in the form of log levels. No?
>
> Linus

Sebastian