All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5.10-rt] printk: fix suppressed message print when reboot/panic
@ 2022-03-21  5:38 Schspa Shi
  2022-03-21  9:30 ` John Ogness
  2022-03-21  9:31 ` Sebastian Andrzej Siewior
  0 siblings, 2 replies; 7+ messages in thread
From: Schspa Shi @ 2022-03-21  5:38 UTC (permalink / raw)
  To: pmladek, sergey.senozhatsky, rostedt, john.ogness
  Cc: linux-rt-users, linux-kernel, bigeasy, tglx, schspa

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 <schspa@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 5.10-rt] printk: fix suppressed message print when reboot/panic
  2022-03-21  5:38 [PATCH 5.10-rt] printk: fix suppressed message print when reboot/panic Schspa Shi
@ 2022-03-21  9:30 ` John Ogness
  2022-03-21 11:57   ` Shi Schspa
  2022-07-11 16:31   ` Steven Rostedt
  2022-03-21  9:31 ` Sebastian Andrzej Siewior
  1 sibling, 2 replies; 7+ messages in thread
From: John Ogness @ 2022-03-21  9:30 UTC (permalink / raw)
  To: Schspa Shi, pmladek, sergey.senozhatsky, rostedt
  Cc: linux-rt-users, linux-kernel, bigeasy, tglx, schspa

On 2022-03-21, Schspa Shi <schspa@gmail.com> 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").
>
> Signed-off-by: Schspa Shi <schspa@gmail.com>

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

Nice catch. Thanks.

5.15-rt also has this issue, although the fix is slightly different. For
5.15-rt, writing to con->printk_seq (via latched_seq_write()) requires
the console locked. Would you like to post a patch for 5.15-rt as well,
or would you like me to do it?

5.16 and beyond does not have this issue.

John Ogness

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 5.10-rt] printk: fix suppressed message print when reboot/panic
  2022-03-21  5:38 [PATCH 5.10-rt] printk: fix suppressed message print when reboot/panic Schspa Shi
  2022-03-21  9:30 ` John Ogness
@ 2022-03-21  9:31 ` Sebastian Andrzej Siewior
  2022-07-11 16:05   ` Schspa Shi
  1 sibling, 1 reply; 7+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-03-21  9:31 UTC (permalink / raw)
  To: Schspa Shi
  Cc: pmladek, sergey.senozhatsky, rostedt, john.ogness,
	linux-rt-users, linux-kernel, tglx

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 <schspa@gmail.com>
> ---
>  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
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 5.10-rt] printk: fix suppressed message print when reboot/panic
  2022-03-21  9:30 ` John Ogness
@ 2022-03-21 11:57   ` Shi Schspa
  2022-07-11 16:31   ` Steven Rostedt
  1 sibling, 0 replies; 7+ messages in thread
From: Shi Schspa @ 2022-03-21 11:57 UTC (permalink / raw)
  To: John Ogness
  Cc: pmladek, sergey.senozhatsky, rostedt, linux-rt-users,
	linux-kernel, bigeasy, tglx

John Ogness <john.ogness@linutronix.de> writes:

> On 2022-03-21, Schspa Shi <schspa@gmail.com> 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").
>>
>> Signed-off-by: Schspa Shi <schspa@gmail.com>
>
> Reviewed-by: John Ogness <john.ogness@linutronix.de>
>
> Nice catch. Thanks.
>
> 5.15-rt also has this issue, although the fix is slightly different. For
> 5.15-rt, writing to con->printk_seq (via latched_seq_write()) requires
> the console locked. Would you like to post a patch for 5.15-rt as well,
> or would you like me to do it?
>

I have upload a new patch for 5.15-rt, please review it too.
Message-Id: <20220321111501.68241-1-schspa@gmail.com>

> 5.16 and beyond does not have this issue.
>
> John Ogness

BRs

Schspa Shi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 5.10-rt] printk: fix suppressed message print when reboot/panic
  2022-03-21  9:31 ` Sebastian Andrzej Siewior
@ 2022-07-11 16:05   ` Schspa Shi
  0 siblings, 0 replies; 7+ messages in thread
From: Schspa Shi @ 2022-07-11 16:05 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: pmladek, sergey.senozhatsky, rostedt, john.ogness,
	linux-rt-users, linux-kernel, tglx

Hi guys:

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

-- 
BRs
Schspa Shi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 5.10-rt] printk: fix suppressed message print when reboot/panic
  2022-03-21  9:30 ` John Ogness
  2022-03-21 11:57   ` Shi Schspa
@ 2022-07-11 16:31   ` Steven Rostedt
  2022-07-11 16:37     ` Steven Rostedt
  1 sibling, 1 reply; 7+ messages in thread
From: Steven Rostedt @ 2022-07-11 16:31 UTC (permalink / raw)
  To: John Ogness
  Cc: Schspa Shi, pmladek, sergey.senozhatsky, linux-rt-users,
	linux-kernel, bigeasy, tglx, Luis Claudio R. Goncalves


Luis,

Care to add this patch into the 5.10-rt stable?

Thanks,

-- Steve

On Mon, 21 Mar 2022 10:36:55 +0106
John Ogness <john.ogness@linutronix.de> wrote:

> On 2022-03-21, Schspa Shi <schspa@gmail.com> 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").
> >
> > Signed-off-by: Schspa Shi <schspa@gmail.com>  
> 
> Reviewed-by: John Ogness <john.ogness@linutronix.de>
> 
> Nice catch. Thanks.
> 
> 5.15-rt also has this issue, although the fix is slightly different. For
> 5.15-rt, writing to con->printk_seq (via latched_seq_write()) requires
> the console locked. Would you like to post a patch for 5.15-rt as well,
> or would you like me to do it?
> 
> 5.16 and beyond does not have this issue.
> 
> John Ogness


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 5.10-rt] printk: fix suppressed message print when reboot/panic
  2022-07-11 16:31   ` Steven Rostedt
@ 2022-07-11 16:37     ` Steven Rostedt
  0 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2022-07-11 16:37 UTC (permalink / raw)
  To: John Ogness
  Cc: Schspa Shi, pmladek, sergey.senozhatsky, linux-rt-users,
	linux-kernel, bigeasy, tglx, Luis Claudio R. Goncalves


I guess the lclaudio@uudg.org is no longer valid. I need to update my
address book :-/

On Mon, 11 Jul 2022 12:31:28 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> Luis,
> 
> Care to add this patch into the 5.10-rt stable?
> 
> Thanks,
> 
> -- Steve
> 
> On Mon, 21 Mar 2022 10:36:55 +0106
> John Ogness <john.ogness@linutronix.de> wrote:
> 
> > On 2022-03-21, Schspa Shi <schspa@gmail.com> 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").
> > >
> > > Signed-off-by: Schspa Shi <schspa@gmail.com>    
> > 
> > Reviewed-by: John Ogness <john.ogness@linutronix.de>
> > 
> > Nice catch. Thanks.
> > 
> > 5.15-rt also has this issue, although the fix is slightly different. For
> > 5.15-rt, writing to con->printk_seq (via latched_seq_write()) requires
> > the console locked. Would you like to post a patch for 5.15-rt as well,
> > or would you like me to do it?
> > 
> > 5.16 and beyond does not have this issue.
> > 
> > John Ogness  
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-07-11 16:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21  5:38 [PATCH 5.10-rt] printk: fix suppressed message print when reboot/panic Schspa Shi
2022-03-21  9:30 ` John Ogness
2022-03-21 11:57   ` Shi Schspa
2022-07-11 16:31   ` Steven Rostedt
2022-07-11 16:37     ` Steven Rostedt
2022-03-21  9:31 ` Sebastian Andrzej Siewior
2022-07-11 16:05   ` Schspa Shi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.