Skip to contentSkip to conversation

ARM: early_printk: respect keep parameter

PATCH In review Alexandre Belloni 2 participants 4 messages Jul 11, 2018 – Jul 17, 2018 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: early_printk: respect keep parameter

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.

---
 arch/arm/kernel/early_printk.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/kernel/early_printk.c +3 -0
index 9257736ec9fa..bbb10150b11a 100644
@@ -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;
Signature · 1 line
2.18.0
#1 lore raw
Quoted 7 lines · 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

Quoted 6 lines

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.

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.

Quoted 22 lines
---
 arch/arm/kernel/early_printk.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/kernel/early_printk.c +3 -0
index 9257736ec9fa..bbb10150b11a 100644
@@ -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;
Signature · 1 line
2.18.0
#2 lore raw
Quoted 14 lines · Nicolas Pitre
Quoted 12 lines · 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.

Quoted 5 lines
Quoted 1 line

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

Quoted 3 lines

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.

Quoted 23 lines
Quoted 22 lines
---
 arch/arm/kernel/early_printk.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/kernel/early_printk.c +3 -0
index 9257736ec9fa..bbb10150b11a 100644
@@ -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;
Signature · 1 line
2.18.0
Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw
Quoted 17 lines · Alexandre Belloni
Quoted 16 lines · Nicolas Pitre
Quoted 13 lines · 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.

Quoted 7 lines
Quoted 3 lines

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.

Quoted 6 lines
Quoted 3 lines

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.

Quoted 1 line

Also, atmel_serial doesn't yet have earlycon support.

Fair enough, and probably something you should mention too.

Quoted 29 lines
Quoted 23 lines
Quoted 22 lines
---
 arch/arm/kernel/early_printk.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/kernel/early_printk.c +3 -0
index 9257736ec9fa..bbb10150b11a 100644
@@ -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;
Signature · 1 line
2.18.0
Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com