Re: [PATCH] arch: arm64: dts: apple: Remove stdout-path

From: Akihiko Odaki
Date: Thu Dec 01 2022 - 11:38:41 EST


Hi,

Thank you for reviewing and detailed explanation.

I'm withdrawing this patch. As you pointed out it makes earlycon difficult, which is serious in development workflow. As a normal user will use U-Boot, which changes stdout-path if appropriate, this kind of change should be designed to make development easier, and this change does the opposite.

On 2022/12/02 0:46, Hector Martin wrote:
> On 02/12/2022 00.19, Akihiko Odaki wrote:
>> So I think we should think more about the case when the kernel is booted
>> from m1n1. When using its hypervisor feature, it is more likely that you
>> want console on serial and and that is the opposite of this change.
>> However, it is still possible to get the console on framebuffer with
>> keyboard.
>
> Except if the framebuffer is broken, or everything is broken and it
> hangs on early boot, which happens all the time when I'm debugging using
> the hypervisor. Or maybe I'm just SSHing in remotely and not physically
> in front of the machine, which is also often the case. Or maybe I'm just
> booting headless because I didn't feel like swapping around the HDMI cable.

The user can change the kernel parameter in such a case. If you have already ran the kernel with this change, you should have learned that the console is tied to the framebuffer and keyboard and you need to supply the kernel parameter. It is easy to change the kernel parameter if you use m1n1 directly.

>
>> In contrary, if you boot the kernel without the hypervisor
>> feature and this change, you will completely lose the console.
>
> How so? The console goes to both places with stdout-path set to serial0.
> What it *does* change is where input is accepted prior to getty startup
> (which is why u-boot specifically conditions this on keyboard presence,
> modulo the USB issue - because if you *don't* have a keyboard then tty
> keyboard input is useless). But if you're booting kernels without u-boot
> along the way, you're probably doing it from the hypervisor or linux.py
> anyway, especially if you plan to do something like "init=/bin/sh",
> because without u-boot (+ optionally some EFI loader) there is no way of
> editing command line arguments at boot time stand-alone.

Well, that is not exactly the behavior I saw. In my case, if stdout-path is pointed to serial, there is no output on the framebuffer, and it just printed "_".

It looks like the kernel only outputs to either of serial and framebuffer, not both.

>
> However, while having stdout-path gives you both serial + tty output and
> serial input, *not* having stdout-path kills serial entirely. It also
> kills earlycon, and makes it so that you have to specify a bunch of
> obscure arguments to get earlycon to work, instead of just a plain
> "earlycon" argument which is much easier.

This is a valid argument. I always struggle when I try earlycon first for a computer. stdout-path should be maintained if it is freeing developers from such trouble.

>
> So for this to be considered at all, you would first need to propose a
> m1n1 patch to re-add stdout-path in boots under the hypervisor and
> (optionally?) on linux.py boots, so you don't regress tools that our
> developers use every day.
>
> But I still fail to see the benefit of this change. What scenario are
> you envisioning that this would improve (something people actually do,
> not a hypothetical)?
>

What I experienced is that when I directly booted the kernel from m1n1 without hypervisor, it showed no output to the display even though the same kernel worked with U-Boot. While I could tell it used wrong console by running the hypervisor, I wondered why it behaves differently without U-Boot, and found the aforementioned U-Boot change, coming up with this patch.

Regards,
Akihiko Odaki

> - Hector