linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	John Ogness <john.ogness@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Shreyas Joshi <shreyas.joshi@biamp.com>,
	shreyasjoshi15@gmail.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	linux-kernel@vger.kernel.org, Petr Mladek <pmladek@suse.com>
Subject: RFC 2/2] printk: Restore and document obsolete ways to disable console output
Date: Thu, 22 Oct 2020 13:42:28 +0200	[thread overview]
Message-ID: <20201022114228.9098-3-pmladek@suse.com> (raw)
In-Reply-To: <20201022114228.9098-1-pmladek@suse.com>

The commit 48021f98130880dd7 ("printk: handle blank console arguments
passed in.") prevented crash caused by empty console= parameter value.

Unfortunately, this value is widely used on Chromebooks to disable
the console output. The above commit caused performance regression
because the messages were pushed on slow console even though nobody
was watching it.

"mute_console" kernel parameter has been introduced as a proper and
official was to disable console output. It avoids the performance
problem by suppressing all kernel messages. Also avoids the crash
by registering the default console.

Make console="" behave the same as "mute_console" to avoid
the performance regression on existing Chromebooks.

Do the same also for console=null which seem to be another widely
suggested and non-official way to disable the console output.

Suggested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
---
 Documentation/admin-guide/kernel-parameters.txt | 5 +++++
 kernel/printk/printk.c                          | 9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 52b9e7f5468d..14472f674a89 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -670,11 +670,16 @@
 		hvc<n>	Use the hypervisor console device <n>. This is for
 			both Xen and PowerPC hypervisors.
 
+		null
+		""	Obsolete way to disable console output. Please,
+			use "mute_console" instead.
+
 		If the device connected to the port is not a TTY but a braille
 		device, prepend "brl," before the device type, for instance
 			console=brl,ttyS0
 		For now, only VisioBraille is supported.
 
+
 	console_msg_format=
 			[KNL] Change console messages format
 		default
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 63fb96630767..08c50d8ba110 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2208,8 +2208,15 @@ static int __init console_setup(char *str)
 	char *s, *options, *brl_options = NULL;
 	int idx;
 
-	if (str[0] == 0)
+	/*
+	 * console="" or console=null have been suggested as a way to
+	 * disable console output. It worked just by chance and was not
+	 * reliable. It has been obsoleted by "mute_console" parameter.
+	 */
+	if (str[0] == 0 || strcmp(str, "null") == 0) {
+		mute_console = true;
 		return 1;
+	}
 
 	if (_braille_console_setup(&str, &brl_options))
 		return 1;
-- 
2.26.2


  parent reply	other threads:[~2020-10-22 11:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22 11:42 [RFC 0/2] printk: Official way to mute consoles Petr Mladek
2020-10-22 11:42 ` [RFC 1/2] printk: Add kernel parameter: mute_console Petr Mladek
2020-10-22 13:10   ` John Ogness
2020-10-22 14:15     ` Guenter Roeck
2020-10-22 14:53       ` John Ogness
2020-10-23 11:49         ` Petr Mladek
2020-10-23 14:52           ` Guenter Roeck
2020-10-22 13:45   ` Steven Rostedt
2020-10-22 14:22     ` Guenter Roeck
2020-10-23  9:46     ` Petr Mladek
2020-10-23  0:33   ` Sergey Senozhatsky
2020-10-23 12:11     ` Petr Mladek
2020-10-23 15:59   ` Linus Torvalds
2020-10-22 11:42 ` Petr Mladek [this message]
2020-10-22 14:23   ` RFC 2/2] printk: Restore and document obsolete ways to disable console output Guenter Roeck

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=20201022114228.9098-3-pmladek@suse.com \
    --to=pmladek@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=shreyas.joshi@biamp.com \
    --cc=shreyasjoshi15@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).