LKML Archive on lore.kernel.org
 help / Atom feed
* [PATCH] ARM: early_printk: respect keep parameter
@ 2018-07-11 18:32 Alexandre Belloni
  2018-07-17 20:16 ` Nicolas Pitre
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Belloni @ 2018-07-11 18:32 UTC (permalink / raw)
  To: Russell King
  Cc: Nicolas Pitre, linux-arm-kernel, linux-kernel, Alexandre Belloni

Parse and use the keep parameter of earlyprintk to avoid having the kernel
output stop with:

Console: colour dummy device 80x30
console [tty0] enabled
bootconsole [earlycon0] disabled

This happens because once tty0, the virtual terminal console is registered,
it is selected as the default console, disregarding an existing stdout-path
DT property and the early console is shutdown before the console driver is
probed.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 arch/arm/kernel/early_printk.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/kernel/early_printk.c b/arch/arm/kernel/early_printk.c
index 9257736ec9fa..bbb10150b11a 100644
--- a/arch/arm/kernel/early_printk.c
+++ b/arch/arm/kernel/early_printk.c
@@ -42,6 +42,9 @@ static struct console early_console_dev = {
 
 static int __init setup_early_printk(char *buf)
 {
+	if (buf && strstr(buf, "keep"))
+		early_console_dev.flags &= ~CON_BOOT;
+
 	early_console = &early_console_dev;
 	register_console(&early_console_dev);
 	return 0;
-- 
2.18.0


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

* Re: [PATCH] ARM: early_printk: respect keep parameter
  2018-07-11 18:32 [PATCH] ARM: early_printk: respect keep parameter Alexandre Belloni
@ 2018-07-17 20:16 ` Nicolas Pitre
  2018-07-17 20:31   ` Alexandre Belloni
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Pitre @ 2018-07-17 20:16 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: Russell King, linux-arm-kernel, linux-kernel

On Wed, 11 Jul 2018, Alexandre Belloni wrote:

> Parse and use the keep parameter of earlyprintk to avoid having the kernel
> output stop with:
> 
> Console: colour dummy device 80x30
> console [tty0] enabled
> bootconsole [earlycon0] disabled
> 
> This happens because once tty0, the virtual terminal console is registered,
> it is selected as the default console, disregarding an existing stdout-path
> DT property and the early console is shutdown before the console driver is
> probed.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

Why can't you have a real console driver that takes over at that point 
which respects whatever DT property you give it?

The early_printk code is very raw and inefficient, and it shouldn't be 
used for anything but the debugging of early boot hangs.

> ---
>  arch/arm/kernel/early_printk.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/arm/kernel/early_printk.c b/arch/arm/kernel/early_printk.c
> index 9257736ec9fa..bbb10150b11a 100644
> --- a/arch/arm/kernel/early_printk.c
> +++ b/arch/arm/kernel/early_printk.c
> @@ -42,6 +42,9 @@ static struct console early_console_dev = {
>  
>  static int __init setup_early_printk(char *buf)
>  {
> +	if (buf && strstr(buf, "keep"))
> +		early_console_dev.flags &= ~CON_BOOT;
> +
>  	early_console = &early_console_dev;
>  	register_console(&early_console_dev);
>  	return 0;
> -- 
> 2.18.0
> 
> 


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

* Re: [PATCH] ARM: early_printk: respect keep parameter
  2018-07-17 20:16 ` Nicolas Pitre
@ 2018-07-17 20:31   ` Alexandre Belloni
  2018-07-17 20:48     ` Nicolas Pitre
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Belloni @ 2018-07-17 20:31 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: Russell King, linux-arm-kernel, linux-kernel

On 17/07/2018 16:16:44-0400, Nicolas Pitre wrote:
> On Wed, 11 Jul 2018, Alexandre Belloni wrote:
> 
> > Parse and use the keep parameter of earlyprintk to avoid having the kernel
> > output stop with:
> > 
> > Console: colour dummy device 80x30
> > console [tty0] enabled
> > bootconsole [earlycon0] disabled
> > 
> > This happens because once tty0, the virtual terminal console is registered,
> > it is selected as the default console, disregarding an existing stdout-path
> > DT property and the early console is shutdown before the console driver is
> > probed.
> > 
> > Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> 
> Why can't you have a real console driver that takes over at that point 
> which respects whatever DT property you give it?
> 

See Russell's analysis here:

https://www.spinics.net/lists/linux-serial/msg25363.html


> The early_printk code is very raw and inefficient, and it shouldn't be 
> used for anything but the debugging of early boot hangs.
> 

The issue I had is that he pinctrl driver wasn't probing so the real
console driver could never probe. I think this fits the use case.

Also, atmel_serial doesn't yet have earlycon support.

> > ---
> >  arch/arm/kernel/early_printk.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/arch/arm/kernel/early_printk.c b/arch/arm/kernel/early_printk.c
> > index 9257736ec9fa..bbb10150b11a 100644
> > --- a/arch/arm/kernel/early_printk.c
> > +++ b/arch/arm/kernel/early_printk.c
> > @@ -42,6 +42,9 @@ static struct console early_console_dev = {
> >  
> >  static int __init setup_early_printk(char *buf)
> >  {
> > +	if (buf && strstr(buf, "keep"))
> > +		early_console_dev.flags &= ~CON_BOOT;
> > +
> >  	early_console = &early_console_dev;
> >  	register_console(&early_console_dev);
> >  	return 0;
> > -- 
> > 2.18.0
> > 
> > 
> 

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH] ARM: early_printk: respect keep parameter
  2018-07-17 20:31   ` Alexandre Belloni
@ 2018-07-17 20:48     ` Nicolas Pitre
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Pitre @ 2018-07-17 20:48 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: Russell King, linux-arm-kernel, linux-kernel

On Tue, 17 Jul 2018, Alexandre Belloni wrote:

> On 17/07/2018 16:16:44-0400, Nicolas Pitre wrote:
> > On Wed, 11 Jul 2018, Alexandre Belloni wrote:
> > 
> > > Parse and use the keep parameter of earlyprintk to avoid having the kernel
> > > output stop with:
> > > 
> > > Console: colour dummy device 80x30
> > > console [tty0] enabled
> > > bootconsole [earlycon0] disabled
> > > 
> > > This happens because once tty0, the virtual terminal console is registered,
> > > it is selected as the default console, disregarding an existing stdout-path
> > > DT property and the early console is shutdown before the console driver is
> > > probed.
> > > 
> > > Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> > 
> > Why can't you have a real console driver that takes over at that point 
> > which respects whatever DT property you give it?
> > 
> 
> See Russell's analysis here:
> 
> https://www.spinics.net/lists/linux-serial/msg25363.html

That is a good analysis, but not necessarily a good argument for this 
particular patch.

> > The early_printk code is very raw and inefficient, and it shouldn't be 
> > used for anything but the debugging of early boot hangs.
> > 
> 
> The issue I had is that he pinctrl driver wasn't probing so the real
> console driver could never probe. I think this fits the use case.

Yes, that certainly fits.  This is not what your commit log message is 
saying though.

> Also, atmel_serial doesn't yet have earlycon support.

Fair enough, and probably something you should mention too.

> > > ---
> > >  arch/arm/kernel/early_printk.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/arch/arm/kernel/early_printk.c b/arch/arm/kernel/early_printk.c
> > > index 9257736ec9fa..bbb10150b11a 100644
> > > --- a/arch/arm/kernel/early_printk.c
> > > +++ b/arch/arm/kernel/early_printk.c
> > > @@ -42,6 +42,9 @@ static struct console early_console_dev = {
> > >  
> > >  static int __init setup_early_printk(char *buf)
> > >  {
> > > +	if (buf && strstr(buf, "keep"))
> > > +		early_console_dev.flags &= ~CON_BOOT;
> > > +
> > >  	early_console = &early_console_dev;
> > >  	register_console(&early_console_dev);
> > >  	return 0;
> > > -- 
> > > 2.18.0
> > > 
> > > 
> > 
> 
> -- 
> Alexandre Belloni, Bootlin (formerly Free Electrons)
> Embedded Linux and Kernel engineering
> https://bootlin.com
> 

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11 18:32 [PATCH] ARM: early_printk: respect keep parameter Alexandre Belloni
2018-07-17 20:16 ` Nicolas Pitre
2018-07-17 20:31   ` Alexandre Belloni
2018-07-17 20:48     ` Nicolas Pitre

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox