Skip to contentSkip to conversation

"console: don't prefer first registered if DT specifies stdout-path" breaks console on video outputs of various ARM boards

REGRESSION Applied Hans de Goede 6 participants 14 messages Nov 4, 2016 – Nov 10, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi All,

While booting 4.9-rc# for the first time on an Allwinner A33 tablet, I noticed that after u-boot the LCD display stayed black. It turns out that there was an issue which caused X to never get up, and all kernel (and other startup) messages prior to that only went to ttyS0 which consists of 2 tiny testpads on the PCB with this tablet.

The same issue will also happen on any ARM boards which have a HDMI or composite video output and which use a stdout-path pointing to their serial console. I think this will e.g. also impact the Raspberry Pi, I know for certain that this will impact the 99 different Allwinnner boards currently supported by mainline u-boot + the mainline kernel.

This is a behavior changes from previous kernels and I consider this a regression. Thus I propose to revert the commit in question, for more info here is a partial copy of the commit message of the proposed revert:

The reverted commit changes existing behavior on which many ARM boards rely. Many ARM small-board-computers, like e.g. the Raspberry Pi have both a video output and a serial console. Depending on whether the user is using the device as a more regular computer; or as a headless device we need to have the console on either one or the other.

Many users rely on the kernel behavior of the console being present on both outputs, before the reverted commit the console setup with no console= kernel arguments on an ARM board which sets stdout-path in dt would look like this:

[root@localhost ~]# cat /proc/consoles

ttyS0                -W- (EC p a)    4:64
tty0                 -WU (E  p  )    4:1

Where as after the reverted commit, it looks like this:

[root@localhost ~]# cat /proc/consoles
ttyS0 -W- (EC p a) 4:64

This commit reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") restoring the original behavior.

Regards,

Hans

#1 lore raw

PATCH 1/1 Revert "console: don't prefer first registered if DT specifies stdout-path"

This reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path").

The reverted commit changes existing behavior on which many ARM boards rely. Many ARM small-board-computers, like e.g. the Raspberry Pi have both a video output and a serial console. Depending on whether the user is using the device as a more regular computer; or as a headless device we need to have the console on either one or the other.

Many users rely on the kernel behavior of the console being present on both outputs, before the reverted commit the console setup with no console= kernel arguments on an ARM board which sets stdout-path in dt would look like this:

[root@localhost ~]# cat /proc/consoles

ttyS0                -W- (EC p a)    4:64
tty0                 -WU (E  p  )    4:1

Where as after the reverted commit, it looks like this:

[root@localhost ~]# cat /proc/consoles
ttyS0 -W- (EC p a) 4:64

This commit reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") restoring the original behavior.

---
 drivers/of/base.c       |  2 --
 include/linux/console.h |  6 ------
 kernel/printk/printk.c  | 13 +------------
 3 files changed, 1 insertion(+), 20 deletions(-)
drivers/of/base.c +0 -2
index d687e6d..a0bccb5 100644
@@ -2077,8 +2077,6 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align))
 			name = of_get_property(of_aliases, "stdout", NULL);
 		if (name)
 			of_stdout = of_find_node_opts_by_path(name, &of_stdout_options);
-		if (of_stdout)
-			console_set_by_of();
 	}
 
 	if (!of_aliases)
include/linux/console.h +0 -6
index 3672809..d530c46 100644
@@ -173,12 +173,6 @@ static inline void console_sysfs_notify(void)
 #endif
 extern bool console_suspend_enabled;
 
-#ifdef CONFIG_OF
-extern void console_set_by_of(void);
-#else
-static inline void console_set_by_of(void) {}
-#endif
-
 /* Suspend and resume console messages over PM events */
 extern void suspend_console(void);
 extern void resume_console(void);
kernel/printk/printk.c +1 -12
index de08fc9..5028f4f 100644
@@ -253,17 +253,6 @@ static int preferred_console = -1;
 int console_set_on_cmdline;
 EXPORT_SYMBOL(console_set_on_cmdline);
 
-#ifdef CONFIG_OF
-static bool of_specified_console;
-
-void console_set_by_of(void)
-{
-	of_specified_console = true;
-}
-#else
-# define of_specified_console false
-#endif
-
 /* Flag: console code may call schedule() */
 static int console_may_schedule;
 
@@ -2657,7 +2646,7 @@ void register_console(struct console *newcon)
 	 *	didn't select a console we take the first one
 	 *	that registers here.
 	 */
-	if (preferred_console < 0 && !of_specified_console) {
+	if (preferred_console < 0) {
 		if (newcon->index < 0)
 			newcon->index = 0;
 		if (newcon->setup == NULL ||
Signature · 6 lines
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

Re: [PATCH] Revert "console: don't prefer first registered if DT specifies stdout-path"

Quoted 20 lines · On Fri, 4 Nov 2016 13:11:35 +0100 Hans de Goede…

This reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path").

The reverted commit changes existing behavior on which many ARM boards rely. Many ARM small-board-computers, like e.g. the Raspberry Pi have both a video output and a serial console. Depending on whether the user is using the device as a more regular computer; or as a headless device we need to have the console on either one or the other.

Many users rely on the kernel behavior of the console being present on both outputs, before the reverted commit the console setup with no console= kernel arguments on an ARM board which sets stdout-path in dt would look like this:

[root@localhost ~]# cat /proc/consoles

ttyS0                -W- (EC p a)    4:64
tty0                 -WU (E  p  )    4:1

Where as after the reverted commit, it looks like this:

Quoted 7 lines

[root@localhost ~]# cat /proc/consoles
ttyS0 -W- (EC p a) 4:64

This commit reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") restoring the original behavior.

I've added cc:[email protected] to my copy of this. --
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

Re: [PATCH] Revert "console: don't prefer first registered if DT specifies stdout-path"

In reply to Hans de Goede
Quoted 20 lines · Hans de Goede

This reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path").

The reverted commit changes existing behavior on which many ARM boards rely. Many ARM small-board-computers, like e.g. the Raspberry Pi have both a video output and a serial console. Depending on whether the user is using the device as a more regular computer; or as a headless device we need to have the console on either one or the other.

Many users rely on the kernel behavior of the console being present on both outputs, before the reverted commit the console setup with no console= kernel arguments on an ARM board which sets stdout-path in dt would look like this:

[root@localhost ~]# cat /proc/consoles

ttyS0                -W- (EC p a)    4:64
tty0                 -WU (E  p  )    4:1

Where as after the reverted commit, it looks like this:

Quoted 7 lines

[root@localhost ~]# cat /proc/consoles
ttyS0 -W- (EC p a) 4:64

This commit reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") restoring the original behavior.

This is also breaking various powerpc systems.

Linus can you please merge this revert for 4.9 ?

cheers
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [PATCH] Revert "console: don't prefer first registered if DT specifies stdout-path"

Quoted 25 lines · Michael Ellerman
Quoted 23 lines · Hans de Goede

This reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path").

The reverted commit changes existing behavior on which many ARM boards rely. Many ARM small-board-computers, like e.g. the Raspberry Pi have both a video output and a serial console. Depending on whether the user is using the device as a more regular computer; or as a headless device we need to have the console on either one or the other.

Many users rely on the kernel behavior of the console being present on both outputs, before the reverted commit the console setup with no console= kernel arguments on an ARM board which sets stdout-path in dt would look like this:

[root@localhost ~]# cat /proc/consoles

ttyS0                -W- (EC p a)    4:64
tty0                 -WU (E  p  )    4:1

Where as after the reverted commit, it looks like this:

[root@localhost ~]# cat /proc/consoles
ttyS0 -W- (EC p a) 4:64

Quoted 8 lines
Quoted 4 lines

This commit reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") restoring the original behavior.

This is also breaking various powerpc systems.

Linus can you please merge this revert for 4.9 ?

I'll queue it up with other tty changes for 4.9-final.

thanks,

greg k-h

#5 lore raw

Re: [PATCH] Revert "console: don't prefer first registered if DT specifies stdout-path"

Quoted 29 lines · Greg Kroah-Hartman
Quoted 28 lines · Michael Ellerman
Quoted 26 lines · Hans de Goede

This reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path").

The reverted commit changes existing behavior on which many ARM boards rely. Many ARM small-board-computers, like e.g. the Raspberry Pi have both a video output and a serial console. Depending on whether the user is using the device as a more regular computer; or as a headless device we need to have the console on either one or the other.

Many users rely on the kernel behavior of the console being present on both outputs, before the reverted commit the console setup with no console= kernel arguments on an ARM board which sets stdout-path in dt would look like this:

[root@localhost ~]# cat /proc/consoles

ttyS0                -W- (EC p a)    4:64
tty0                 -WU (E  p  )    4:1

Where as after the reverted commit, it looks like this:

[root@localhost ~]# cat /proc/consoles
ttyS0 -W- (EC p a) 4:64

This commit reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") restoring the original behavior.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

This is also breaking various powerpc systems.

Linus can you please merge this revert for 4.9 ?

I'll queue it up with other tty changes for 4.9-final.

Oops, wait, it's going through Andrew's tree, nevermind...

#6 lore raw
In reply to Hans de Goede

Hi Hans,

Quoted 38 lines · On Friday, 4 November 2016 13:11:34 GMT Hans de Goede wrote:

Hi All,

While booting 4.9-rc# for the first time on an Allwinner A33 tablet, I noticed that after u-boot the LCD display stayed black. It turns out that there was an issue which caused X to never get up, and all kernel (and other startup) messages prior to that only went to ttyS0 which consists of 2 tiny testpads on the PCB with this tablet.

The same issue will also happen on any ARM boards which have a HDMI or composite video output and which use a stdout-path pointing to their serial console. I think this will e.g. also impact the Raspberry Pi, I know for certain that this will impact the 99 different Allwinnner boards currently supported by mainline u-boot + the mainline kernel.

This is a behavior changes from previous kernels and I consider this a regression. Thus I propose to revert the commit in question, for more info here is a partial copy of the commit message of the proposed revert:

The reverted commit changes existing behavior on which many ARM boards rely. Many ARM small-board-computers, like e.g. the Raspberry Pi have both a video output and a serial console. Depending on whether the user is using the device as a more regular computer; or as a headless device we need to have the console on either one or the other.

Many users rely on the kernel behavior of the console being present on both outputs, before the reverted commit the console setup with no console= kernel arguments on an ARM board which sets stdout-path in dt would look like this:

[root@localhost ~]# cat /proc/consoles

ttyS0                -W- (EC p a)    4:64
tty0                 -WU (E  p  )    4:1

Where as after the reverted commit, it looks like this:

[root@localhost ~]# cat /proc/consoles
ttyS0 -W- (EC p a) 4:64

Quoted 6 lines

This commit reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") restoring the original behavior.

Regards,

Hans

Ugh... so the devices you're talking about rely upon set stdout-path in their device tree but effectively rely upon us ignoring it?

If that's the case then I guess reverting is probably the best option, but it does restore us to a position where we honor stdout-path for earlycon & then essentially ignore it for the proper kernel console. That seems pretty bust to me...

Thanks,
Paul

#7 lore raw

Hi,

Quoted 44 lines · Paul Burton

Hi Hans,

Quoted 41 lines · On Friday, 4 November 2016 13:11:34 GMT Hans de Goede wrote:

Hi All,

While booting 4.9-rc# for the first time on an Allwinner A33 tablet, I noticed that after u-boot the LCD display stayed black. It turns out that there was an issue which caused X to never get up, and all kernel (and other startup) messages prior to that only went to ttyS0 which consists of 2 tiny testpads on the PCB with this tablet.

The same issue will also happen on any ARM boards which have a HDMI or composite video output and which use a stdout-path pointing to their serial console. I think this will e.g. also impact the Raspberry Pi, I know for certain that this will impact the 99 different Allwinnner boards currently supported by mainline u-boot + the mainline kernel.

This is a behavior changes from previous kernels and I consider this a regression. Thus I propose to revert the commit in question, for more info here is a partial copy of the commit message of the proposed revert:

The reverted commit changes existing behavior on which many ARM boards rely. Many ARM small-board-computers, like e.g. the Raspberry Pi have both a video output and a serial console. Depending on whether the user is using the device as a more regular computer; or as a headless device we need to have the console on either one or the other.

Many users rely on the kernel behavior of the console being present on both outputs, before the reverted commit the console setup with no console= kernel arguments on an ARM board which sets stdout-path in dt would look like this:

[root@localhost ~]# cat /proc/consoles

ttyS0                -W- (EC p a)    4:64
tty0                 -WU (E  p  )    4:1

Where as after the reverted commit, it looks like this:

[root@localhost ~]# cat /proc/consoles
ttyS0 -W- (EC p a) 4:64

This commit reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") restoring the original behavior.

Quoted 6 lines
Quoted 3 lines

Regards,

Hans

Ugh... so the devices you're talking about rely upon set stdout-path in their device tree but effectively rely upon us ignoring it?

No they rely on the kernel using stdout-path as an extra console while keeping tty0 as console, not ignoring it. This how stdout-path has always worked (at least as long as the Allwinner boards have used it, which has been
2 - 3 years now).

If you want only the console specified by stdout-path you can get this by specifying it with console=... on the kernel cmdline.

Quoted 4 lines

If that's the case then I guess reverting is probably the best option, but it does restore us to a position where we honor stdout-path for earlycon & then essentially ignore it for the proper kernel console. That seems pretty bust to me...

We do not ignore it, we use both the tty pointed to by stdout-path and tty0.

Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
Quoted 67 lines · On Friday, 4 November 2016 14:22:17 GMT Hans de Goede wrote:

Hi,

Quoted 44 lines · Paul Burton

Hi Hans,

Quoted 41 lines · On Friday, 4 November 2016 13:11:34 GMT Hans de Goede wrote:

Hi All,

While booting 4.9-rc# for the first time on an Allwinner A33 tablet, I noticed that after u-boot the LCD display stayed black. It turns out that there was an issue which caused X to never get up, and all kernel (and other startup) messages prior to that only went to ttyS0 which consists of 2 tiny testpads on the PCB with this tablet.

The same issue will also happen on any ARM boards which have a HDMI or composite video output and which use a stdout-path pointing to their serial console. I think this will e.g. also impact the Raspberry Pi, I know for certain that this will impact the 99 different Allwinnner boards currently supported by mainline u-boot + the mainline kernel.

This is a behavior changes from previous kernels and I consider this a regression. Thus I propose to revert the commit in question, for more info here is a partial copy of the commit message of the proposed revert:

The reverted commit changes existing behavior on which many ARM boards rely. Many ARM small-board-computers, like e.g. the Raspberry Pi have both a video output and a serial console. Depending on whether the user is using the device as a more regular computer; or as a headless device we need to have the console on either one or the other.

Many users rely on the kernel behavior of the console being present on both outputs, before the reverted commit the console setup with no console= kernel arguments on an ARM board which sets stdout-path in dt would look like this:

[root@localhost ~]# cat /proc/consoles

ttyS0                -W- (EC p a)    4:64
tty0                 -WU (E  p  )    4:1

Where as after the reverted commit, it looks like this:

[root@localhost ~]# cat /proc/consoles
ttyS0 -W- (EC p a) 4:64

This commit reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") restoring the original behavior.

Quoted 6 lines
Quoted 3 lines

Regards,

Hans

Ugh... so the devices you're talking about rely upon set stdout-path in their device tree but effectively rely upon us ignoring it?

No they rely on the kernel using stdout-path as an extra console while keeping tty0 as console, not ignoring it. This how stdout-path has always worked (at least as long as the Allwinner boards have used it, which has been 2 - 3 years now).

If you want only the console specified by stdout-path you can get this by specifying it with console=... on the kernel cmdline.

Quoted 4 lines

If that's the case then I guess reverting is probably the best option, but it does restore us to a position where we honor stdout-path for earlycon & then essentially ignore it for the proper kernel console. That seems pretty bust to me...

Quoted 5 lines

We do not ignore it, we use both the tty pointed to by stdout-path and tty0.

Regards,

Hans

Hi Hans,

Could you walk me though how you're getting that behaviour from the current code? I don't see how that would happen besides perhaps if drivers are probed in a fortunate order. Is that what you're relying upon?

What I see in my systems, and what 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") addressed, is that if there are for example 2 UARTs uart0 & uart1 that are probed in that order and stdout-path indicates that we should use uart1 we wind up essentially ignoring it because the ordering of the relevant calls goes:

- of_console_check() for uart0
- add_preferred_console() for uart0
- register_console() for uart0
- of_console_check() for uart1
- add_preferred_console() for uart1
- register_console() for uart1

Since of_check_console() doesn't get called for uart1 until after uart0 has been probed, we don't add an entry for it to the console_cmdline array until after register_console() has already decided to enable uart0 because preferred_console == -1.

I'm not the only one seeing this oddity either, for example see the discussion on this patch:

https://patchwork.kernel.org/patch/9263753/

By simply reverting my patch you restore us to a position where so far as I can see we simply do not honor stdout-path for the real kernel console.

Thanks,
Paul

#9 lore raw

Hi,

Quoted 72 lines · Paul Burton
Quoted 71 lines · On Friday, 4 November 2016 14:22:17 GMT Hans de Goede wrote:

Hi,

Quoted 44 lines · Paul Burton

Hi Hans,

Quoted 41 lines · On Friday, 4 November 2016 13:11:34 GMT Hans de Goede wrote:

Hi All,

While booting 4.9-rc# for the first time on an Allwinner A33 tablet, I noticed that after u-boot the LCD display stayed black. It turns out that there was an issue which caused X to never get up, and all kernel (and other startup) messages prior to that only went to ttyS0 which consists of 2 tiny testpads on the PCB with this tablet.

The same issue will also happen on any ARM boards which have a HDMI or composite video output and which use a stdout-path pointing to their serial console. I think this will e.g. also impact the Raspberry Pi, I know for certain that this will impact the 99 different Allwinnner boards currently supported by mainline u-boot + the mainline kernel.

This is a behavior changes from previous kernels and I consider this a regression. Thus I propose to revert the commit in question, for more info here is a partial copy of the commit message of the proposed revert:

The reverted commit changes existing behavior on which many ARM boards rely. Many ARM small-board-computers, like e.g. the Raspberry Pi have both a video output and a serial console. Depending on whether the user is using the device as a more regular computer; or as a headless device we need to have the console on either one or the other.

Many users rely on the kernel behavior of the console being present on both outputs, before the reverted commit the console setup with no console= kernel arguments on an ARM board which sets stdout-path in dt would look like this:

[root@localhost ~]# cat /proc/consoles

ttyS0                -W- (EC p a)    4:64
tty0                 -WU (E  p  )    4:1

Where as after the reverted commit, it looks like this:

[root@localhost ~]# cat /proc/consoles
ttyS0 -W- (EC p a) 4:64

This commit reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") restoring the original behavior.

Quoted 6 lines
Quoted 3 lines

Regards,

Hans

Ugh... so the devices you're talking about rely upon set stdout-path in their device tree but effectively rely upon us ignoring it?

No they rely on the kernel using stdout-path as an extra console while keeping tty0 as console, not ignoring it. This how stdout-path has always worked (at least as long as the Allwinner boards have used it, which has been 2 - 3 years now).

If you want only the console specified by stdout-path you can get this by specifying it with console=... on the kernel cmdline.

Quoted 4 lines

If that's the case then I guess reverting is probably the best option, but it does restore us to a position where we honor stdout-path for earlycon & then essentially ignore it for the proper kernel console. That seems pretty bust to me...

We do not ignore it, we use both the tty pointed to by stdout-path and tty0.

Regards,

Quoted 7 lines
Quoted 1 line

Hans

Hi Hans,

Could you walk me though how you're getting that behaviour from the current code? I don't see how that would happen besides perhaps if drivers are probed in a fortunate order. Is that what you're relying upon?

I guess so, I never looked carefully at this, it has just always worked until your patch.

Quoted 18 lines

What I see in my systems, and what 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") addressed, is that if there are for example 2 UARTs uart0 & uart1 that are probed in that order and stdout-path indicates that we should use uart1 we wind up essentially ignoring it because the ordering of the relevant calls goes:

- of_console_check() for uart0
- add_preferred_console() for uart0
- register_console() for uart0
- of_console_check() for uart1
- add_preferred_console() for uart1
- register_console() for uart1

Since of_check_console() doesn't get called for uart1 until after uart0 has been probed, we don't add an entry for it to the console_cmdline array until after register_console() has already decided to enable uart0 because preferred_console == -1.

Quoted 7 lines

I'm not the only one seeing this oddity either, for example see the discussion on this patch:

https://patchwork.kernel.org/patch/9263753/

By simply reverting my patch you restore us to a position where so far as I can see we simply do not honor stdout-path for the real kernel console.

As said before, we do still honor it, but in your probe example we also get a (second) serial console on uart0, where as you only want one on uart1.

So I see a few possible solutions here:

1) Do a new version of your patch which changes the "&& !of_specified_console" check to "&& (newcon == tty0 || !of_specified_console)", then we would still always register tty0 (as long as it gets registered first, just like now) and we would not register uart0 in your above example, note the "newcon == tty0" check in my example is pseudo-code. I would be happy to try out such a patch

2) Add a new dt property to enable the new behavior you seek

I'm myself tending towards 1 as a better solution: treat tty0 special, because some existing setups rely on it always being registered as a console even if stdout-path is specified and otherwise always honor stdout-path.

Regards,

Hans

#10 lore raw

Hi Hans,

Quoted 22 lines · On Sunday, 6 November 2016 11:54:35 GMT Hans de Goede wrote:
Quoted 22 lines

What I see in my systems, and what 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") addressed, is that if there are for example 2 UARTs uart0 & uart1 that are probed in that order and stdout-path indicates that we should use uart1 we wind up essentially ignoring it because>
the ordering of the relevant calls goes:
- of_console_check() for uart0
- add_preferred_console() for uart0
- register_console() for uart0
- of_console_check() for uart1
- add_preferred_console() for uart1
- register_console() for uart1

Since of_check_console() doesn't get called for uart1 until after uart0 has
been probed, we don't add an entry for it to the console_cmdline array until after register_console() has already decided to enable uart0 because preferred_console == -1.

I'm not the only one seeing this oddity either, for example see the discussion on this patch:

Quoted 8 lines
Quoted 5 lines

https://patchwork.kernel.org/patch/9263753/

By simply reverting my patch you restore us to a position where so far as I
can see we simply do not honor stdout-path for the real kernel console.

As said before, we do still honor it, but in your probe example we also get a (second) serial console on uart0, where as you only want one on uart1.

...but don't we only support one console per type of device? That's what Documentation/serial-console.txt says anyway, which means having a console on both uart0 & uart1 does not work. I could live with having console output on an extra UART, but that's not what I was seeing when I wrote this patch.

Quoted 11 lines

So I see a few possible solutions here:

1) Do a new version of your patch which changes the "&& !of_specified_console" check to "&& (newcon == tty0 || !of_specified_console)", then we would still always register tty0 (as long as it gets registered first, just like now) and we would not register uart0 in your above example, note the "newcon == tty0" check in my example is pseudo-code. I would be happy to try out such a patch

2) Add a new dt property to enable the new behavior you seek

Quoted 8 lines

I'm myself tending towards 1 as a better solution: treat tty0 special, because some existing setups rely on it always being registered as a console even if stdout-path is specified and otherwise always honor stdout-path.

Regards,

Hans

That does feel a little hack-ish to me though... I don't like the reliance on probe ordering, nor special casing tty0 in general.

In any case I don't think I have the time to unpick all this at the moment, so I suggest we go ahead with your revert for now & I'll revisit the system I was working on when I find the time.

Thanks,
Paul

#11 lore raw

Hi,

Quoted 31 lines · Paul Burton

Hi Hans,

Quoted 28 lines · On Sunday, 6 November 2016 11:54:35 GMT Hans de Goede wrote:
Quoted 27 lines

What I see in my systems, and what 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") addressed, is that if there are for example 2 UARTs uart0 & uart1 that are probed in that order and stdout-path indicates that we should use uart1 we wind up essentially ignoring it because>
the ordering of the relevant calls goes:
- of_console_check() for uart0
- add_preferred_console() for uart0
- register_console() for uart0
- of_console_check() for uart1
- add_preferred_console() for uart1
- register_console() for uart1

Since of_check_console() doesn't get called for uart1 until after uart0 has
been probed, we don't add an entry for it to the console_cmdline array until after register_console() has already decided to enable uart0 because preferred_console == -1.

I'm not the only one seeing this oddity either, for example see the discussion on this patch:

https://patchwork.kernel.org/patch/9263753/

By simply reverting my patch you restore us to a position where so far as I
can see we simply do not honor stdout-path for the real kernel console.

Quoted 7 lines
Quoted 2 lines

As said before, we do still honor it, but in your probe example we also get a (second) serial console on uart0, where as you only want one on uart1.

...but don't we only support one console per type of device? That's what Documentation/serial-console.txt says anyway, which means having a console on both uart0 & uart1 does not work. I could live with having console output on an extra UART, but that's not what I was seeing when I wrote this patch.

Ah yes, you're probably right about that.

Quoted 16 lines
Quoted 16 lines

So I see a few possible solutions here:

1) Do a new version of your patch which changes the "&& !of_specified_console" check to "&& (newcon == tty0 || !of_specified_console)", then we would still always register tty0 (as long as it gets registered first, just like now) and we would not register uart0 in your above example, note the "newcon == tty0" check in my example is pseudo-code. I would be happy to try out such a patch

2) Add a new dt property to enable the new behavior you seek

I'm myself tending towards 1 as a better solution: treat tty0 special, because some existing setups rely on it always being registered as a console even if stdout-path is specified and otherwise always honor stdout-path.

Quoted 6 lines
Quoted 3 lines

Regards,

Hans

That does feel a little hack-ish to me though... I don't like the reliance on probe ordering, nor special casing tty0 in general.

Given that we've just got a "me too" reply from the ppc side of things, it seems that in reality people have been relying on probe ordering here for a long time now. IMHO tty0 is special, so it does make sense that it always gets probed first (*) and it does make sense to handle it special.

*) Even though that seems to be more how things work (an implicit thing) rather then explicit.

Quoted 3 lines

In any case I don't think I have the time to unpick all this at the moment, so I suggest we go ahead with your revert for now & I'll revisit the system I was working on when I find the time.

Ok.

Regards,

Hans

#12 lore raw
In reply to Hans de Goede
Quoted 67 lines · On Friday, 4 November 2016 14:22:17 GMT Hans de Goede wrote:

Hi,

Quoted 44 lines · Paul Burton

Hi Hans,

Quoted 41 lines · On Friday, 4 November 2016 13:11:34 GMT Hans de Goede wrote:

Hi All,

While booting 4.9-rc# for the first time on an Allwinner A33 tablet, I noticed that after u-boot the LCD display stayed black. It turns out that there was an issue which caused X to never get up, and all kernel (and other startup) messages prior to that only went to ttyS0 which consists of 2 tiny testpads on the PCB with this tablet.

The same issue will also happen on any ARM boards which have a HDMI or composite video output and which use a stdout-path pointing to their serial console. I think this will e.g. also impact the Raspberry Pi, I know for certain that this will impact the 99 different Allwinnner boards currently supported by mainline u-boot + the mainline kernel.

This is a behavior changes from previous kernels and I consider this a regression. Thus I propose to revert the commit in question, for more info here is a partial copy of the commit message of the proposed revert:

The reverted commit changes existing behavior on which many ARM boards rely. Many ARM small-board-computers, like e.g. the Raspberry Pi have both a video output and a serial console. Depending on whether the user is using the device as a more regular computer; or as a headless device we need to have the console on either one or the other.

Many users rely on the kernel behavior of the console being present on both outputs, before the reverted commit the console setup with no console= kernel arguments on an ARM board which sets stdout-path in dt would look like this:

[root@localhost ~]# cat /proc/consoles

ttyS0                -W- (EC p a)    4:64
tty0                 -WU (E  p  )    4:1

Where as after the reverted commit, it looks like this:

[root@localhost ~]# cat /proc/consoles
ttyS0 -W- (EC p a) 4:64

This commit reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") restoring the original behavior.

Quoted 6 lines
Quoted 3 lines

Regards,

Hans

Ugh... so the devices you're talking about rely upon set stdout-path in their device tree but effectively rely upon us ignoring it?

No they rely on the kernel using stdout-path as an extra console while keeping tty0 as console, not ignoring it. This how stdout-path has always worked (at least as long as the Allwinner boards have used it, which has been 2 - 3 years now).

If you want only the console specified by stdout-path you can get this by specifying it with console=... on the kernel cmdline.

Quoted 4 lines

If that's the case then I guess reverting is probably the best option, but it does restore us to a position where we honor stdout-path for earlycon & then essentially ignore it for the proper kernel console. That seems pretty bust to me...

Quoted 5 lines

We do not ignore it, we use both the tty pointed to by stdout-path and tty0.

Regards,

Hans

Hi Hans,

Could you walk me though how you're getting that behaviour from the current code? I don't see how that would happen besides perhaps if drivers are probed in a fortunate order. Is that what you're relying upon?

What I see in my systems, and what 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") addressed, is that if there are for example 2 UARTs uart0 & uart1 that are probed in that order and stdout-path indicates that we should use uart1 we wind up essentially ignoring it because the ordering of the relevant calls goes:

- of_console_check() for uart0
- add_preferred_console() for uart0
- register_console() for uart0
- of_console_check() for uart1
- add_preferred_console() for uart1
- register_console() for uart1

Since of_check_console() doesn't get called for uart1 until after uart0 has been probed, we don't add an entry for it to the console_cmdline array until after register_console() has already decided to enable uart0 because preferred_console == -1.

I'm not the only one seeing this oddity either, for example see the discussion on this patch:

https://patchwork.kernel.org/patch/9263753/

By simply reverting my patch you restore us to a position where so far as I can see we simply do not honor stdout-path for the real kernel console.

Thanks,
Paul

#13 lore raw
In reply to Hans de Goede

JFYI: I added below report to the list of regressions for Linux 4.9.
I'll watch this thread for further updates on this issue to document
progress in my weekly reports. Please let me know via regressions-rCxcAJFjeRkk+I/[email protected] in case the discussion moves to a different place (bugzilla or another mail thread for example).

Current status (afaics): Revert discussed

tia! Ciao, Thorsten

P.S.: Thx for CCing me!

Quoted 38 lines · Hans de Goede

Hi All,

While booting 4.9-rc# for the first time on an Allwinner A33 tablet, I noticed that after u-boot the LCD display stayed black. It turns out that there was an issue which caused X to never get up, and all kernel (and other startup) messages prior to that only went to ttyS0 which consists of 2 tiny testpads on the PCB with this tablet.

The same issue will also happen on any ARM boards which have a HDMI or composite video output and which use a stdout-path pointing to their serial console. I think this will e.g. also impact the Raspberry Pi, I know for certain that this will impact the 99 different Allwinnner boards currently supported by mainline u-boot + the mainline kernel.

This is a behavior changes from previous kernels and I consider this a regression. Thus I propose to revert the commit in question, for more info here is a partial copy of the commit message of the proposed revert:

The reverted commit changes existing behavior on which many ARM boards rely. Many ARM small-board-computers, like e.g. the Raspberry Pi have both a video output and a serial console. Depending on whether the user is using the device as a more regular computer; or as a headless device we need to have the console on either one or the other.

Many users rely on the kernel behavior of the console being present on both outputs, before the reverted commit the console setup with no console= kernel arguments on an ARM board which sets stdout-path in dt would look like this:

[root@localhost ~]# cat /proc/consoles

ttyS0                -W- (EC p a)    4:64
tty0                 -WU (E  p  )    4:1

Where as after the reverted commit, it looks like this:

[root@localhost ~]# cat /proc/consoles
ttyS0 -W- (EC p a) 4:64

Quoted 7 lines

This commit reverts commit 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path") restoring the original behavior.

Regards,

Hans

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html