Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1547064

[PATCH 2/2] printk: always report lost messages on serial console

From Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 2/2] printk: always report lost messages on serial console
Date 2016-12-24 15:20 +0100
Message-ID <sRVkZ-7ZZ-9@gated-at.bofh.it> (permalink)
References <sRVkZ-7ZZ-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The "printk messages dropped" report is 'attached' to a kernel
message located at console_idx offset. This does not work well
if we skip that message due to loglevel filtering, because in
this case we also skip/lose dropped message report.

Disable suppress_message_printing() loglevel filtering if we
must report "printk messages dropped" condition.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
 kernel/printk/printk.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 11a9842a2f47..6a7ebcb0bb6e 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2218,6 +2218,7 @@ void console_unlock(void)
 		struct printk_log *msg;
 		size_t ext_len = 0;
 		size_t len;
+		bool report_dropped_msg = false;
 
 		raw_spin_lock_irqsave(&logbuf_lock, flags);
 		if (seen_seq != log_next_seq) {
@@ -2232,6 +2233,7 @@ void console_unlock(void)
 			/* messages are gone, move to first one */
 			console_seq = log_first_seq;
 			console_idx = log_first_idx;
+			report_dropped_msg = true;
 		} else {
 			len = 0;
 		}
@@ -2240,7 +2242,8 @@ void console_unlock(void)
 			break;
 
 		msg = log_from_idx(console_idx);
-		if (suppress_message_printing(msg->level)) {
+		if (!report_dropped_msg &&
+				suppress_message_printing(msg->level)) {
 			/*
 			 * Skip record we have buffered and already printed
 			 * directly to the console when we received it, and
-- 
2.11.0

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] printk: always report dropped messages Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-24 15:20 +0100
  [PATCH 1/2] printk: drop call_console_drivers() unused param Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-24 15:20 +0100
    Re: [PATCH 1/2] printk: drop call_console_drivers() unused param Petr Mladek <pmladek@suse.com> - 2017-01-03 11:30 +0100
  [PATCH 2/2] printk: always report lost messages on serial console Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-24 15:20 +0100
    Re: [PATCH 2/2] printk: always report lost messages on serial console Petr Mladek <pmladek@suse.com> - 2017-01-03 16:00 +0100
      Re: [PATCH 2/2] printk: always report lost messages on serial console Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2017-01-03 16:50 +0100
        Re: [PATCH 2/2] printk: always report lost messages on serial console Petr Mladek <pmladek@suse.com> - 2017-01-03 18:20 +0100

csiph-web