Re: [PATCH 2/2] reboot: flush printk buffers before final shutdown

From: John Ogness
Date: Tue Oct 31 2023 - 07:12:14 EST


On 2023-10-30, Martin Hundebøll <martin@xxxxxxxxxx> wrote:
> Make sure printed messages are in fact printed before putting the system
> down.
>
> Signed-off-by: Martin Hundebøll <martin@xxxxxxxxxx>
> ---
> kernel/reboot.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/reboot.c b/kernel/reboot.c
> index 3bba88c7ffc6..bab8350d5dae 100644
> --- a/kernel/reboot.c
> +++ b/kernel/reboot.c
> @@ -273,6 +273,7 @@ void kernel_restart(char *cmd)
> else
> pr_emerg("Restarting system with command '%s'\n", cmd);
> kmsg_dump(KMSG_DUMP_SHUTDOWN);
> + pr_flush(1000, false);

printk() tries to print directly from the calling context. Are you
experiencing problems where you do not see the restarting message?

John Ogness