Re: [PATCH v4 1/2] printk: Add function to dump printk buffer directly to consoles

From: John Ogness
Date: Thu Feb 01 2024 - 06:28:47 EST


On 2024-02-01, Sreenath Vijayan <sreenath.vijayan@xxxxxxxx> wrote:
> It is useful to be able to dump the printk buffer directly to
> consoles in some situations so as to not flood the buffer.
> To do this, we reuse the CONSOLE_REPLAY_ALL mode code in
> console_flush_on_panic() by moving the code to a helper function
> console_rewind_all(). This is done because console_flush_on_panic()
> sets console_may_schedule to 0 but this should not be done in our
> case. Then console_rewind_all() is called from the new function
> dump_printk_buffer() with console lock held to set the console
> sequence number to oldest record in the buffer for all consoles.
> Releasing the console lock will flush the contents of printk buffer
> to the consoles.
>
> Suggested-by: John Ogness <john.ogness@xxxxxxxxxxxxx>
> Signed-off-by: Sreenath Vijayan <sreenath.vijayan@xxxxxxxx>
> Signed-off-by: Shimoyashiki Taichi <taichi.shimoyashiki@xxxxxxxx>

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