All of lore.kernel.org
 help / color / mirror / Atom feed
From: Schspa Shi <schspa@gmail.com>
To: pmladek@suse.com, sergey.senozhatsky@gmail.com,
	rostedt@goodmis.org, john.ogness@linutronix.de
Cc: linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	bigeasy@linutronix.de, tglx@linutronix.de, schspa@gmail.com
Subject: [PATCH 5.10-rt] printk: fix suppressed message print when reboot/panic
Date: Mon, 21 Mar 2022 13:38:16 +0800	[thread overview]
Message-ID: <20220321053815.71316-1-schspa@gmail.com> (raw)

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


             reply	other threads:[~2022-03-21  5:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21  5:38 Schspa Shi [this message]
2022-03-21  9:30 ` [PATCH 5.10-rt] printk: fix suppressed message print when reboot/panic 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220321053815.71316-1-schspa@gmail.com \
    --to=schspa@gmail.com \
    --cc=bigeasy@linutronix.de \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.