2022-03-21 17:34:32

by Schspa Shi

[permalink] [raw]
Subject: [PATCH 5.10-rt] printk: fix suppressed message print when reboot/panic

Update printk_seq for suppressed message.

Affects 5.9-rt and 5.10-rt

When message is suppressed, printk_seq should be updated, otherwise
this message will be printed when reboot. This problem was introduced
in commit 3edc0c85d154 ("printk: Rebase on top of new ring buffer").

Signed-off-by: Schspa Shi <[email protected]>
---
kernel/printk/printk.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 0c56873396a9..f68c4ba7eb4d 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2826,8 +2826,17 @@ static int printk_kthread_func(void *data)
if (!(con->flags & CON_ENABLED))
continue;

- if (suppress_message_printing(r.info->level))
+ printk_seq = atomic64_read(&con->printk_seq);
+
+ if (suppress_message_printing(r.info->level)) {
+ /*
+ * Skip record we have buffered and already printed
+ * directly to the console when we received it, and
+ * record that has level above the console loglevel.
+ */
+ atomic64_cmpxchg_relaxed(&con->printk_seq, printk_seq, seq);
continue;
+ }

if (con->flags & CON_EXTENDED) {
len = info_print_ext_header(ext_text,
@@ -2843,7 +2852,6 @@ static int printk_kthread_func(void *data)
printk_time);
}

- printk_seq = atomic64_read(&con->printk_seq);

console_lock();
console_may_schedule = 0;
--
2.29.0


Subject: Re: [PATCH 5.10-rt] printk: fix suppressed message print when reboot/panic

On 2022-03-21 13:38:16 [+0800], Schspa Shi wrote:
> Update printk_seq for suppressed message.
>
> Affects 5.9-rt and 5.10-rt
>
> When message is suppressed, printk_seq should be updated, otherwise
> this message will be printed when reboot. This problem was introduced
> in commit 3edc0c85d154 ("printk: Rebase on top of new ring buffer").

So it is only 5.10 given that 5.9 is not maintained.
That commits points to the printk update in v5.9.1-rt18.
John?

> Signed-off-by: Schspa Shi <[email protected]>
> ---
> kernel/printk/printk.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 0c56873396a9..f68c4ba7eb4d 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -2826,8 +2826,17 @@ static int printk_kthread_func(void *data)
> if (!(con->flags & CON_ENABLED))
> continue;
>
> - if (suppress_message_printing(r.info->level))
> + printk_seq = atomic64_read(&con->printk_seq);
> +
> + if (suppress_message_printing(r.info->level)) {
> + /*
> + * Skip record we have buffered and already printed
> + * directly to the console when we received it, and
> + * record that has level above the console loglevel.
> + */
> + atomic64_cmpxchg_relaxed(&con->printk_seq, printk_seq, seq);
> continue;
> + }
>
> if (con->flags & CON_EXTENDED) {
> len = info_print_ext_header(ext_text,
> @@ -2843,7 +2852,6 @@ static int printk_kthread_func(void *data)
> printk_time);
> }
>
> - printk_seq = atomic64_read(&con->printk_seq);
>
> console_lock();
> console_may_schedule = 0;
> --
> 2.29.0
>

2022-07-11 16:20:18

by Schspa Shi

[permalink] [raw]
Subject: Re: [PATCH 5.10-rt] printk: fix suppressed message print when reboot/panic

Hi guys:

Do we need to add this to the rt stable tree?
The stable tree still have this issues.

--
BRs
Schspa Shi