Re: [PATCH] printk: Add loglevel for "do not print to consoles".

From: Tetsuo Handa
Date: Wed May 13 2020 - 11:20:48 EST


On 2020/05/13 22:55, Steven Rostedt wrote:
> On Wed, 13 May 2020 20:03:53 +0900
> Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote:
>
>> I think that basically only oops (e.g. WARN()/BUG()/panic()) messages worth
>> printing to consoles and the rest messages do not worth printing to consoles.
>> Existing KERN_$LOGLEVEL is too rough-grained.
>
> Why don't you look into having a "noconsole" command line option that will
> not print anything to the consoles but oops messages.

Well, such global option can be as harmful as "ignore_loglevel" command line
option in that we have to worry about how per-console loglevel can co-exist.

The idea of per-console loglevel is to allow specifying different threshold
based on characteristics of each console while the effect of ignore_loglevel
is to disallow specifying different threshold. (I'm wondering whether
ignore_loglevel should be valid under CONSOLE_LOGLEVEL_SILENT, for
CONSOLE_LOGLEVEL_SILENT says "don't print to consoles" while ignore_loglevel
says "always print to consoles".)

If we want to implement per-console loglevel in the future, shouldn't we first
deprecate the conflicting "ignore_loglevel" command line option (and get rid
of it by asking users to use LOGLEVEL_DEBUG as console loglevel)?

The idea of "noconsole" command line option is to disallow printing almost all
messages regardless of KERN_$LOGLEVEL while the idea of per-console loglevel is
to allow printing some messages based on KERN_$LOGLEVEL.

>
> Sounds more like what you would like, and something that perhaps would be
> acceptable by the larger community.

More we introduce global switches, more difficult to introduce fine-grained
switches (e.g. per-console loglevel).