All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4.19 regression fix] printk: For early boot messages check loglevel when flushing the buffer
@ 2018-09-04 18:01 Hans de Goede
  2018-09-05  2:35 ` Sergey Senozhatsky
  2018-09-06 14:34 ` kbuild test robot
  0 siblings, 2 replies; 20+ messages in thread
From: Hans de Goede @ 2018-09-04 18:01 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H . Peter Anvin, Sergey Senozhatsky
  Cc: Hans de Goede, x86, linux-kernel, Steven Rostedt, Petr Mladek,
	Maninder Singh

Commit 375899cddcbb ("printk: make sure to print log on console."), moved
the checking of the loglevel of messages from flush time to the actual
log time.

This introduces one problem, some early boot messages are printed before
parse_early_param() gets called and thus before kernel commandline options
such as quiet, loglevel and ignore_loglevel are parsed.

This causes e.g. the following messages to get printed on x86 systems,
despite the presence of the "quiet" option:

[    0.000000] BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x0000000000057fff] usable
...
[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x0000000874ffffff] usable

This commit fixes this by setting a new LOG_CHK_LEVEL on early boot
messages and doing the loglevel check for these while flushing as before.

Cc: Petr Mladek <pmladek@suse.com>
Cc: Maninder Singh <maninder1.s@samsung.com>
Fixes: 375899cddcbb ("printk: make sure to print log on console.")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 kernel/printk/printk.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index fd6f8ed28e01..c5ffd46239a0 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -355,6 +355,7 @@ enum log_flags {
 	LOG_NEWLINE	= 2,	/* text ended with a newline */
 	LOG_PREFIX	= 4,	/* text started with a prefix */
 	LOG_CONT	= 8,	/* text is a fragment of a continuation line */
+	LOG_CHK_LEVEL	= 16,	/* check log level during flush */
 };
 
 struct printk_log {
@@ -1881,7 +1882,10 @@ int vprintk_store(int facility, int level,
 	if (dict)
 		lflags |= LOG_PREFIX|LOG_NEWLINE;
 
-	if (suppress_message_printing(level))
+	/* During early boot loglevel is not setup yet, check it later */
+	if (early_boot_irqs_disabled)
+		lflags |= LOG_CHK_LEVEL;
+	else if (suppress_message_printing(level))
 		lflags |= LOG_NOCONS;
 
 	return log_output(facility, level, lflags,
@@ -2368,7 +2372,9 @@ void console_unlock(void)
 			break;
 
 		msg = log_from_idx(console_idx);
-		if (msg->flags & LOG_NOCONS) {
+		if ((msg->flags & LOG_NOCONS) ||
+		    ((msg->flags & LOG_CHK_LEVEL) &&
+				suppress_message_printing(msg->level))) {
 			/*
 			 * Skip record if !ignore_loglevel, and
 			 * record has level above the console loglevel.
-- 
2.19.0.rc0


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

end of thread, other threads:[~2018-09-13  2:25 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-04 18:01 [PATCH 4.19 regression fix] printk: For early boot messages check loglevel when flushing the buffer Hans de Goede
2018-09-05  2:35 ` Sergey Senozhatsky
2018-09-05  4:53   ` Hans de Goede
2018-09-05  5:36     ` Sergey Senozhatsky
2018-09-05  5:51       ` Sergey Senozhatsky
2018-09-05  8:33       ` Sergey Senozhatsky
2018-09-05 11:02         ` Petr Mladek
2018-09-05 15:20           ` Hans de Goede
2018-09-06 14:31             ` Petr Mladek
2018-09-06  7:29           ` Sergey Senozhatsky
2018-09-06 14:28             ` Petr Mladek
2018-09-07  4:21               ` Sergey Senozhatsky
2018-09-10 14:57                 ` Petr Mladek
2018-09-10 15:02                   ` Hans de Goede
2018-09-11  2:30                   ` Sergey Senozhatsky
2018-09-11  8:47                     ` Petr Mladek
2018-09-12  7:49                       ` Sergey Senozhatsky
2018-09-12 13:33                         ` Petr Mladek
2018-09-13  2:25                           ` Sergey Senozhatsky
2018-09-06 14:34 ` kbuild test robot

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.