2023-10-30 09:24:54

by Martin Hundebøll

[permalink] [raw]
Subject: [PATCH 2/2] reboot: flush printk buffers before final shutdown

Make sure printed messages are in fact printed before putting the system
down.

Signed-off-by: Martin Hundebøll <[email protected]>
---
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);
machine_restart(cmd);
}
EXPORT_SYMBOL_GPL(kernel_restart);
--
2.42.0


2023-10-31 11:12:20

by John Ogness

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

On 2023-10-30, Martin Hundebøll <[email protected]> wrote:
> Make sure printed messages are in fact printed before putting the system
> down.
>
> Signed-off-by: Martin Hundebøll <[email protected]>
> ---
> 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

2023-10-31 15:21:29

by John Ogness

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

On 2023-10-31, Martin Hundebøll <[email protected]> wrote:
>> printk() tries to print directly from the calling context. Are you
>> experiencing problems where you do not see the restarting message?
>
> Yes, but only with rt-patches. Sorry I forgot to mention that in the
> commit message. I considered sending the patches to the "rt-tree", but
> figured they don't need more patches to maintain, when the same
> changes could live in mainline just as well.

Thanks for clarifying. These patches really are only appropriate for the
rt-tree.

John Ogness