Re: [PATCH v5 1/2] printk: Add function to replay kernel log on consoles

From: John Ogness
Date: Thu Mar 07 2024 - 08:54:36 EST


On 2024-03-07, Sreenath Vijayan <sreenath.vijayan@xxxxxxxx> wrote:
> Add a generic function console_replay_all() for replaying
> the kernel log on consoles, in any context. It would allow
> viewing the logs on an unresponsive terminal via sysrq.
>
> Reuse the existing code from console_flush_on_panic() for
> resetting the sequence numbers, by introducing a new helper
> function __console_rewind_all(). It is safe to be called
> under console_lock().
>
> Try to acquire lock on the console subsystem without waiting.
> If successful, reset the sequence number to oldest available
> record on all consoles and call console_unlock() which will
> automatically flush the messages to the consoles.
>
> Suggested-by: John Ogness <john.ogness@xxxxxxxxxxxxx>
> Suggested-by: Petr Mladek <pmladek@xxxxxxxx>
> Signed-off-by: Sreenath Vijayan <sreenath.vijayan@xxxxxxxx>
> Signed-off-by: Shimoyashiki Taichi <taichi.shimoyashiki@xxxxxxxx>

Reviewed-by: John Ogness <john.ogness@xxxxxxxxxxxxx>