[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZzW-3LIF8pdnrLe-@pathway.suse.cz>
Date: Thu, 14 Nov 2024 10:11:56 +0100
From: Petr Mladek <pmladek@...e.com>
To: Chris Down <chris@...isdown.name>
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
John Ogness <john.ogness@...utronix.de>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Tony Lindgren <tony.lindgren@...ux.intel.com>, kernel-team@...com
Subject: Re: [PATCH v6 08/11] printk: Support setting initial console
loglevel via console= on cmdline
On Mon 2024-10-28 16:45:52, Chris Down wrote:
> Extend the console= kernel command line parameter to support specifying
> per-console loglevels at boot time. This is achieved by introducing a
> new loglevel option that can be passed as a loglevel option within a
> console= stanza.
>
> For example, this is an example of how one might configure netconsole
> devices to print messages with a higher priority than loglevel 3
> (KERN_ERR) at startup:
>
> console=netcon0,loglevel:3
>
> --- a/Documentation/admin-guide/serial-console.rst
> +++ b/Documentation/admin-guide/serial-console.rst
> @@ -32,6 +32,33 @@ The format of this option is::
> and F is flow control ('r' for RTS). Default is
> 9600n8. The maximum baudrate is 115200.
>
> + One can also specify the per-console loglevel for this
> + console by providing a loglevel parameter, for example
> + "loglevel:4" to set this console's loglevel to 4. The
> + value provided can be from 0 (LOGLEVEL_EMERG) to 8
The real lower limit, enforced by clamp_loglevel(), is 1.
> + (LOGLEVEL_DEBUG + 1), and messages below that will be
> + emitted onto the console as they become available.
> +
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -3903,8 +3982,10 @@ static int try_enable_preferred_console(struct console *newcon,
> if (newcon->index < 0)
> newcon->index = c->index;
>
> - // TODO: Will be configurable in a later patch
> - newcon->level = -1;
> + if (c->level > 0)
> + newcon->level = c->level;
> + else
> + newcon->level = -1;
It seems that c->level is already set to -1 when it is not defined on
the command line. I think that that we could simply do:
newcon->level = c->level;
Just for record. We need to explicitely set newcon->level to -1 in
try_enable_default_console().
> newcon->classdev = NULL;
>
Otherwise, it looks good.
Best Regards,
Petr
Powered by blists - more mailing lists