838818e
From 79bfd044ed82290603093be1a3759672176f3e6f Mon Sep 17 00:00:00 2001
838818e
From: Hans de Goede <hdegoede@redhat.com>
838818e
Date: Tue, 19 Jun 2018 13:30:04 +0200
838818e
Subject: [PATCH] printk: Make CONSOLE_LOGLEVEL_QUIET configurable
838818e
838818e
The goal of passing the "quiet" option to the kernel is for the kernel
838818e
to be quiet unless something really is wrong.
838818e
838818e
Sofar passing quiet has been (mostly) equivalent to passing
838818e
loglevel=4 on the kernel commandline. Which means to show any messages
838818e
with a level of KERN_ERR or higher severity on the console.
838818e
838818e
In practice this often does not result in a quiet boot though, since
838818e
there are many false-positive or otherwise harmless error messages printed,
838818e
defeating the purpose of the quiet option. Esp. the ACPICA code is really
838818e
bad wrt this, but there are plenty of others too.
838818e
838818e
This commit makes CONSOLE_LOGLEVEL_QUIET configurable.
838818e
838818e
This for example will allow distros which want quiet to really mean quiet
838818e
to set CONSOLE_LOGLEVEL_QUIET so that only messages with a higher severity
838818e
then KERN_ERR (CRIT, ALERT, EMERG) get printed, avoiding an endless game
838818e
of whack-a-mole silencing harmless error messages.
838818e
838818e
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
838818e
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
838818e
---
838818e
 include/linux/printk.h |  6 +++---
838818e
 lib/Kconfig.debug      | 11 +++++++++++
838818e
 2 files changed, 14 insertions(+), 3 deletions(-)
838818e
838818e
diff --git a/include/linux/printk.h b/include/linux/printk.h
838818e
index 6d7e800affd8..18602bb3eca8 100644
838818e
--- a/include/linux/printk.h
838818e
+++ b/include/linux/printk.h
838818e
@@ -50,15 +50,15 @@ static inline const char *printk_skip_headers(const char *buffer)
838818e
 /* We show everything that is MORE important than this.. */
838818e
 #define CONSOLE_LOGLEVEL_SILENT  0 /* Mum's the word */
838818e
 #define CONSOLE_LOGLEVEL_MIN	 1 /* Minimum loglevel we let people use */
838818e
-#define CONSOLE_LOGLEVEL_QUIET	 4 /* Shhh ..., when booted with "quiet" */
838818e
 #define CONSOLE_LOGLEVEL_DEBUG	10 /* issue debug messages */
838818e
 #define CONSOLE_LOGLEVEL_MOTORMOUTH 15	/* You can't shut this one up */
838818e
 
838818e
 /*
838818e
- * Default used to be hard-coded at 7, we're now allowing it to be set from
838818e
- * kernel config.
838818e
+ * Default used to be hard-coded at 7, quiet used to be hardcoded at 4,
838818e
+ * we're now allowing both to be set from kernel config.
838818e
  */
838818e
 #define CONSOLE_LOGLEVEL_DEFAULT CONFIG_CONSOLE_LOGLEVEL_DEFAULT
838818e
+#define CONSOLE_LOGLEVEL_QUIET	 CONFIG_CONSOLE_LOGLEVEL_QUIET
838818e
 
838818e
 extern int console_printk[];
838818e
 
838818e
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
838818e
index 8838d1158d19..0d1c48dd22a9 100644
838818e
--- a/lib/Kconfig.debug
838818e
+++ b/lib/Kconfig.debug
838818e
@@ -30,6 +30,17 @@ config CONSOLE_LOGLEVEL_DEFAULT
838818e
 	  usage in the kernel. That is controlled by the MESSAGE_LOGLEVEL_DEFAULT
838818e
 	  option.
838818e
 
838818e
+config CONSOLE_LOGLEVEL_QUIET
838818e
+	int "quiet console loglevel (1-15)"
838818e
+	range 1 15
838818e
+	default "4"
838818e
+	help
838818e
+	  loglevel to use when "quiet" is passed on the kernel commandline.
838818e
+
838818e
+	  When "quiet" is passed on the kernel commandline this loglevel
838818e
+	  will be used as the loglevel. IOW passing "quiet" will be the
838818e
+	  equivalent of passing "loglevel=<CONSOLE_LOGLEVEL_QUIET>"
838818e
+
838818e
 config MESSAGE_LOGLEVEL_DEFAULT
838818e
 	int "Default message log level (1-7)"
838818e
 	range 1 7
838818e
-- 
838818e
2.18.0
838818e