Skip to contentSkip to conversation

printk: fix exclusive_console replaying

PATCH In review John Ogness 3 participants 4 messages Dec 19, 2019 – Jan 2, 2020 Printk

lore
Share & tools
lore

John Ogness

author maintainer
#0 lore raw

PATCH 1/1 printk: fix exclusive_console replaying

Commit f92b070f2dc8 ("printk: Do not miss new messages when replaying the log") introduced a new variable @exclusive_console_stop_seq to store when an exclusive console should stop printing. It should be set to the @console_seq value at registration. However, @console_seq is previously set to @syslog_seq so that the exclusive console knows where to begin. This results in the exclusive console immediately reactivating all the other consoles and thus repeating the messages for those consoles.

Set @console_seq after @exclusive_console_stop_seq has stored the current @console_seq value.

Fixes f92b070f2dc8 ("printk: Do not miss new messages when replaying the log")
---
 kernel/printk/printk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/printk/printk.c +2 -2
index 1ef6f75d92f1..fada22dc4ab6 100644
@@ -2770,8 +2770,6 @@ void register_console(struct console *newcon)
 		 * for us.
 		 */
 		logbuf_lock_irqsave(flags);
-		console_seq = syslog_seq;
-		console_idx = syslog_idx;
 		/*
 		 * We're about to replay the log buffer.  Only do this to the
 		 * just-registered console to avoid excessive message spam to
@@ -2783,6 +2781,8 @@ void register_console(struct console *newcon)
 		 */
 		exclusive_console = newcon;
 		exclusive_console_stop_seq = console_seq;
+		console_seq = syslog_seq;
+		console_idx = syslog_idx;
 		logbuf_unlock_irqrestore(flags);
 	}
 	console_unlock();
Signature · 1 line
2.20.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · John Ogness

Commit f92b070f2dc8 ("printk: Do not miss new messages when replaying the log") introduced a new variable @exclusive_console_stop_seq to store when an exclusive console should stop printing. It should be set to the @console_seq value at registration. However, @console_seq is previously set to @syslog_seq so that the exclusive console knows where to begin. This results in the exclusive console immediately reactivating all the other consoles and thus repeating the messages for those consoles.

Quoted 5 lines

Set @console_seq after @exclusive_console_stop_seq has stored the current @console_seq value.

Fixes f92b070f2dc8 ("printk: Do not miss new messages when replaying the log")

Grr, it was an ugly mistake. I am surprised that it has stayed there for more then one year without noticing. Thanks a lot for fixing.

Best Regards,
Petr

Acked-by on v1 1/1
#2 lore raw
In reply to John Ogness
Quoted 9 lines · John Ogness

Commit f92b070f2dc8 ("printk: Do not miss new messages when replaying the log") introduced a new variable @exclusive_console_stop_seq to store when an exclusive console should stop printing. It should be set to the @console_seq value at registration. However, @console_seq is previously set to @syslog_seq so that the exclusive console knows where to begin. This results in the exclusive console immediately reactivating all the other consoles and thus repeating the messages for those consoles.

Quoted 5 lines

Set @console_seq after @exclusive_console_stop_seq has stored the current @console_seq value.

Fixes f92b070f2dc8 ("printk: Do not miss new messages when replaying the log")

Thanks!

	-ss
maintainer
#3 lore raw
Quoted 10 lines · Sergey Senozhatsky
Quoted 9 lines · John Ogness

Commit f92b070f2dc8 ("printk: Do not miss new messages when replaying the log") introduced a new variable @exclusive_console_stop_seq to store when an exclusive console should stop printing. It should be set to the @console_seq value at registration. However, @console_seq is previously set to @syslog_seq so that the exclusive console knows where to begin. This results in the exclusive console immediately reactivating all the other consoles and thus repeating the messages for those consoles.

Quoted 7 lines
Quoted 5 lines

Set @console_seq after @exclusive_console_stop_seq has stored the current @console_seq value.

Fixes f92b070f2dc8 ("printk: Do not miss new messages when replaying the log")

The patch has been commited into printk.git, branch for-5.6.

Best Regards,
Petr