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

From: Tetsuo Handa
Date: Wed May 13 2020 - 07:25:06 EST


On 2020/05/13 19:49, Michal Hocko wrote:
> On Wed 13-05-20 12:04:13, Petr Mladek wrote:
>> What is so special about OOM dump task so that it would deserve such
>> complications?
>
> Nothing really. Except for the potential amount of the output.

"echo t > /proc/sysrq-trigger" from userspace program is another example.

> But as
> you've said there are two ways around that. Disable this output if you
> do not need it or make it a lower loglevel.

Disable this output for syslog is not acceptable for me, but disable this
output for consoles is preferable for me.

> I simply cannot tell whether somebody considers
> dump_tasks an important information to be printed on consoles.

I don't think dump_tasks() is important information to be printed on consoles.
But since somebody might think dump_tasks() is important information to be
printed on consoles, I suggest switching KERN_NO_CONSOLES using e.g. sysctl.

>
> If there is any need to control which messages should be routed to which
> backend then the proper solution would be to filter messages per log
> level per backend.

Possible backends will be "zero or more than zero" consoles + "zero or one"
syslog, and KERN_NO_CONSOLES is a method for force selecting "zero" console
backend.

> But I have no idea how feasible this is for the
> existing infrastructure - or maybe it already exists...

There is per-console loglevel proposal (which allows selecting "some" console
backends). But it is based on KERN_$LOGLEVEL which is too rough-grained.