Re: [PATCH] printk: Allow direct printing for PREEMPT_RT during panic

From: John Ogness
Date: Thu Oct 10 2024 - 04:52:17 EST


On 2024-10-10, takakura@xxxxxxxxxxxxx wrote:
> If PREEMPT_RT was enabled, printing for legacy consoles are deferred
> by default, including after printk_legacy_allow_panic_sync() during
> panic which allows direct printing afterwards in case of !PREEMPT_RT.
> As a result, printing of messages during panic for PREEMPT_RT
> is handled by the console_flush_on_panic() called at the end.

This is on purpose because legacy consoles are not safe in many contexts
under PREEMPT_RT. console_flush_on_panic() is used as a final "hope and
pray" excercise even though it is not safe on PREEMPT_RT, which is why
it is at the end of panic(). printk_legacy_allow_panic_sync() only
exists for !PREEMPT_RT.

> In case if kexec was loaded, console_flush_on_panic() will not be
> called and starts booting into the second kernel without printing
> the messages.

If legacy printing is allowed before, the kexec may never happen because
the unsafe legacy printers can hang the system.

> Allow direct printing for PREEMPT_RT during panic so that messages
> before kexec gets printed.

Sorry, NACK. This goes against everything we have worked for with the
rework. The solution is to update your console drivers to NBCON.

John Ogness