linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Docs: printk: add 'console=null|""' to admin/kernel-parameters
@ 2022-02-15  0:56 Randy Dunlap
  2022-02-15 17:26 ` Petr Mladek
  0 siblings, 1 reply; 3+ messages in thread
From: Randy Dunlap @ 2022-02-15  0:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Randy Dunlap, Petr Mladek, Sergey Senozhatsky, Steven Rostedt,
	John Ogness, Jonathan Corbet, linux-doc

Tell about 'console=null|""' and how to use it.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: John Ogness <john.ogness@linutronix.de>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
---
 Documentation/admin-guide/kernel-parameters.txt |    6 ++++++
 1 file changed, 6 insertions(+)

--- linux-next-20220214.orig/Documentation/admin-guide/kernel-parameters.txt
+++ linux-next-20220214/Documentation/admin-guide/kernel-parameters.txt
@@ -724,6 +724,12 @@
 		hvc<n>	Use the hypervisor console device <n>. This is for
 			both Xen and PowerPC hypervisors.
 
+		{ null | "" }
+			Use to disable console output, i.e., to have kernel
+			console messages discarded.
+			This must be the first (or only) console= string
+			used on the kernel command line.
+
 		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

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

* Re: [PATCH] Docs: printk: add 'console=null|""' to admin/kernel-parameters
  2022-02-15  0:56 [PATCH] Docs: printk: add 'console=null|""' to admin/kernel-parameters Randy Dunlap
@ 2022-02-15 17:26 ` Petr Mladek
  2022-02-16 20:35   ` Randy Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Mladek @ 2022-02-15 17:26 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: linux-kernel, Sergey Senozhatsky, Steven Rostedt, John Ogness,
	Jonathan Corbet, linux-doc

On Mon 2022-02-14 16:56:15, Randy Dunlap wrote:
> Tell about 'console=null|""' and how to use it.
> 
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: John Ogness <john.ogness@linutronix.de>
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: linux-doc@vger.kernel.org
> ---
>  Documentation/admin-guide/kernel-parameters.txt |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> --- linux-next-20220214.orig/Documentation/admin-guide/kernel-parameters.txt
> +++ linux-next-20220214/Documentation/admin-guide/kernel-parameters.txt
> @@ -724,6 +724,12 @@
>  		hvc<n>	Use the hypervisor console device <n>. This is for
>  			both Xen and PowerPC hypervisors.
>  
> +		{ null | "" }
> +			Use to disable console output, i.e., to have kernel
> +			console messages discarded.
> +			This must be the first (or only) console= string
> +			used on the kernel command line.

It must be the only console= parameter on the command line. Otherwise,
the other consoles get enabled as well.

It might make sense to detect this situation and print a warning or
so. Nobody has sent a patch for this so far.

But there is even bigger problem. The default console is also used
as stdin/stdout/stderr for the init process. It might fail when there
is no console driver associated with it.

The problem with stdin/stdout/stderr does not happen when
CONFIG_NULL_TTY is enabled and ttynull driver is available.
Unfortunately, it can't be enabled by default because it can
be used by mistake, see the commit a91bd6223ecd46addc71e
("Revert "init/console: Use ttynull as a fallback when there
is no console").

And there is still a mystery that has not been explained yet,
see https://lore.kernel.org/r/a46e9a26-5b9f-f14c-26be-0b4d41fa7429@roeck-us.net

On the positive note. console=null mostly works. All the problems are
hard to reproduce.


Now, what to do with this patch. I would suggest two changes:

1. Replace "must be the first (or only)" with "must be the only"

2. Mention that it is suggested to enable CONFIG_NULL_TTY that
   will avoid problems with stdin/stdout/stderr of the init process.
   But it might cause the ttynull might be used even when a real
   console is configured. And that more details can be found
   in the commit a91bd6223ecd46addc71e ("Revert "init/console:
   Use ttynull as a fallback when there is no console").

   It might be enough to mention this in the commit message.

Best Regards,
Petr


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

* Re: [PATCH] Docs: printk: add 'console=null|""' to admin/kernel-parameters
  2022-02-15 17:26 ` Petr Mladek
@ 2022-02-16 20:35   ` Randy Dunlap
  0 siblings, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2022-02-16 20:35 UTC (permalink / raw)
  To: Petr Mladek
  Cc: linux-kernel, Sergey Senozhatsky, Steven Rostedt, John Ogness,
	Jonathan Corbet, linux-doc

Hi Petr,

On 2/15/22 09:26, Petr Mladek wrote:
> On Mon 2022-02-14 16:56:15, Randy Dunlap wrote:
>> Tell about 'console=null|""' and how to use it.
>>
>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
>> Cc: Petr Mladek <pmladek@suse.com>
>> Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
>> Cc: Steven Rostedt <rostedt@goodmis.org>
>> Cc: John Ogness <john.ogness@linutronix.de>
>> Cc: Jonathan Corbet <corbet@lwn.net>
>> Cc: linux-doc@vger.kernel.org
>> ---
>>  Documentation/admin-guide/kernel-parameters.txt |    6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> --- linux-next-20220214.orig/Documentation/admin-guide/kernel-parameters.txt
>> +++ linux-next-20220214/Documentation/admin-guide/kernel-parameters.txt
>> @@ -724,6 +724,12 @@
>>  		hvc<n>	Use the hypervisor console device <n>. This is for
>>  			both Xen and PowerPC hypervisors.
>>  
>> +		{ null | "" }
>> +			Use to disable console output, i.e., to have kernel
>> +			console messages discarded.
>> +			This must be the first (or only) console= string
>> +			used on the kernel command line.
> 
> It must be the only console= parameter on the command line. Otherwise,
> the other consoles get enabled as well.
> 
> It might make sense to detect this situation and print a warning or
> so. Nobody has sent a patch for this so far.
> 
> But there is even bigger problem. The default console is also used
> as stdin/stdout/stderr for the init process. It might fail when there
> is no console driver associated with it.
> 
> The problem with stdin/stdout/stderr does not happen when
> CONFIG_NULL_TTY is enabled and ttynull driver is available.
> Unfortunately, it can't be enabled by default because it can
> be used by mistake, see the commit a91bd6223ecd46addc71e
> ("Revert "init/console: Use ttynull as a fallback when there
> is no console").
> 
> And there is still a mystery that has not been explained yet,
> see https://lore.kernel.org/r/a46e9a26-5b9f-f14c-26be-0b4d41fa7429@roeck-us.net
> 
> On the positive note. console=null mostly works. All the problems are
> hard to reproduce.
> 
> 
> Now, what to do with this patch. I would suggest two changes:
> 
> 1. Replace "must be the first (or only)" with "must be the only"
> 
> 2. Mention that it is suggested to enable CONFIG_NULL_TTY that
>    will avoid problems with stdin/stdout/stderr of the init process.
>    But it might cause the ttynull might be used even when a real
>    console is configured. And that more details can be found
>    in the commit a91bd6223ecd46addc71e ("Revert "init/console:
>    Use ttynull as a fallback when there is no console").
> 
>    It might be enough to mention this in the commit message.

Thanks for the history summary and suggestions.
I'll send a v2...

-- 
~Randy

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

end of thread, other threads:[~2022-02-16 20:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15  0:56 [PATCH] Docs: printk: add 'console=null|""' to admin/kernel-parameters Randy Dunlap
2022-02-15 17:26 ` Petr Mladek
2022-02-16 20:35   ` Randy Dunlap

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).