Re: [PATCH] printk: handle blank console arguments passed in.
From: Petr Mladek
Date: Wed Oct 07 2020 - 03:28:58 EST
On Wed 2020-10-07 02:15:04, Sergey Senozhatsky wrote:
> On (20/10/06 18:35), Petr Mladek wrote:
> > > > Whatever is decided, I'd like to have it made official and documented to
> > > > avoid a similar problem in the future.
> >
> > Sigh, it is even bigger mess than I expected. There is a magic
> > variable "console_set_on_cmdline". It used, for example, in
> > of_console_check() to prevent using the default console from dts.
>
> I wonder if we can do something like:
>
> ---
> @@ -2200,6 +2200,9 @@ static int __init console_setup(char *str)
> char *s, *options, *brl_options = NULL;
> int idx;
>
> if (str[0] == 0) {
> + console_set_on_cmdline = 1;
Unfortunately, this is not enough. We will also need to prevent
enabling the fallback console when has_preferred_console is not set.
The following might work:
/*
* Dirty hack to prevent using any console with tty
* binding as a fallback and adding the empty
* name into console_cmdline array.
*/
preferred_console = MAX_CMDLINECONSOLES;
> return 1;
> }
It might be the minimal change that would fix the regression and keep
the original fix. But it would make the code even more hairy.
It might be acceptable as a hotfix. But we really should somehow clean
up the code and try to make the behavior more consistent.
Best Regards,
Petr