mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Raul Rangel <rrangel@chromium.org>
Cc: Randy Dunlap <rdunlap@infradead.org>,
	Mario Limonciello <mario.limonciello@amd.com>,
	linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	kramasub@chromium.org, Alexander Potapenko <glider@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ard Biesheuvel <ardb@kernel.org>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	Li Zhe <lizhe.67@bytedance.com>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Will Deacon <will@kernel.org>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Zhou jie <zhoujie@nfschina.com>
Subject: Re: [PATCH] init: Don't proxy console= to earlycon
Date: Fri, 14 Jul 2023 18:38:21 +0200	[thread overview]
Message-ID: <ZLF5_dJyQgzNnrnO@alley> (raw)
In-Reply-To: <CAHQZ30BLb13Mz5+3MCgV30eG-LiU-6-4F7AEinGQmsgiyzD-yA@mail.gmail.com>

On Mon 2023-07-10 09:30:19, Raul Rangel wrote:
> On Sun, Jul 9, 2023 at 8:43 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> >
> >
> >
> > On 7/9/23 18:15, Mario Limonciello wrote:
> > > On 7/9/23 18:46, Randy Dunlap wrote:
> > >>
> > >>
> > >> On 7/7/23 18:17, Raul E Rangel wrote:
> > >>> Right now we are proxying the `console=XXX` command line args to the
> > >>> param_setup_earlycon. This is done because the following are
> > >>> equivalent:
> > >>>
> > >>>      console=uart[8250],mmio,<addr>[,options]
> > >>>      earlycon=uart[8250],mmio,<addr>[,options]
> > >>>
> > >>> In addition, when `earlycon=` or just `earlycon` is specified on the
> > >>> command line, we look at the SPCR table or the DT to extract the device
> > >>> options.
> > >>>
> > >>> When `console=` is specified on the command line, it's intention is to
> > >>> disable the console. Right now since we are proxying the `console=`
> > >>
> > >> How do you figure this (its intention is to disable the console)?
> > >
> 
> https://www.kernel.org/doc/html/v6.1/admin-guide/kernel-parameters.html
> says the following:
> console=
>     { null | "" }
>             Use to disable console output, i.e., to have kernel
>             console messages discarded.
>             This must be the only console= parameter used on the
>             kernel command line.
> 
>         earlycon=       [KNL] Output early console device and options.
> 
>             When used with no options, the early console is
>             determined by stdout-path property in device tree's
>             chosen node or the ACPI SPCR table if supported by
>             the platform.

Sigh, I wasn't aware of this when we discussed the console= handling.

> The reason this bug showed up is that ChromeOS has set `console=` for a
> very long time:
> https://chromium.googlesource.com/chromiumos/platform/crosutils/+/main/build_kernel_image.sh#282
> I'm not sure on the exact history, but AFAIK, we don't have the ttyX devices.
>
> Coreboot recently added support for the ACPI SPCR table which in
> combination with the
> `console=` arg, we are now seeing earlycon enabled when it shouldn't be.

But this happens only when both "earlycon" and "console=" parameters
are used together. Do I get it correctly?

This combination is ambiguous on its own. Why would anyone add
"earlycon" parameter and wanted to keep it disabled?

> > >>> diff --git a/init/main.c b/init/main.c
> > >>> index aa21add5f7c54..f72bf644910c1 100644
> > >>> --- a/init/main.c
> > >>> +++ b/init/main.c
> > >>> @@ -738,8 +738,7 @@ static int __init do_early_param(char *param, char *val,
> > >>>       for (p = __setup_start; p < __setup_end; p++) {
> > >>>           if ((p->early && parameq(param, p->str)) ||
> > >>>               (strcmp(param, "console") == 0 &&
> > >>> -             strcmp(p->str, "earlycon") == 0)
> > >>> -        ) {
> > >>> +             strcmp(p->str, "earlycon") == 0 && val && val[0])) {
> > >>>               if (p->setup_func(val) != 0)
> > >>>                   pr_warn("Malformed early option '%s'\n", param);
> > >>>           }

Huh, this is getting more and more complicated.

You know, it is already bad that:

    + "console" enables the default console which might be overridden
      by ACPI SPCR and devicetree

    + "console=" causes that "ttynull" console is preferred,
	  it might cause that no console is registered at all

    + both "earlyconsole" and "earlyconsole=" cause that
          
     consoles is enabled 
   

It is already bad that "earlycon" and "console" handle the empty value
a different way. But this makes it even worse. The behaviour
would depend on a subtle difference whether "console" or
"console=" is used.



> > >>
> > >
> >
> > --
> > ~Randy

  parent reply	other threads:[~2023-07-14 16:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-08  1:17 Raul E Rangel
2023-07-09  0:48 ` Andrew Morton
2023-07-11 18:15   ` Raul Rangel
2023-07-09 23:46 ` Randy Dunlap
2023-07-10  1:15   ` Mario Limonciello
2023-07-10  2:43     ` Randy Dunlap
2023-07-10 15:30       ` Raul Rangel
2023-07-10 15:41         ` Randy Dunlap
2023-07-14 16:38         ` Petr Mladek [this message]
2023-07-14 17:21           ` Raul Rangel
2023-07-14 17:24             ` Raul Rangel
2023-07-14 18:35             ` Petr Mladek
2023-07-14 21:42               ` Raul Rangel
2023-07-18  9:50                 ` Petr Mladek
2023-07-28 17:57                   ` Raul Rangel
2024-08-08 17:30                     ` Raul Rangel
2024-08-21 14:38                       ` Petr Mladek
2024-08-21 15:30                         ` Raul Rangel
2024-08-22  8:15                           ` Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZLF5_dJyQgzNnrnO@alley \
    --to=pmladek@suse.com \
    --cc=Jason@zx2c4.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=ardb@kernel.org \
    --cc=glider@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kramasub@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhe.67@bytedance.com \
    --cc=mario.limonciello@amd.com \
    --cc=mark.rutland@arm.com \
    --cc=rdunlap@infradead.org \
    --cc=rrangel@chromium.org \
    --cc=will@kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=zhoujie@nfschina.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®