Re: [PATCH] printk: Add loglevel for "do not print to consoles".
From: Dmitry Safonov
Date: Fri Apr 24 2020 - 11:52:38 EST
On 4/24/20 4:42 PM, Steven Rostedt wrote:
> On Sat, 25 Apr 2020 00:28:53 +0900
> Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote:
>> For those who analyze log files (instead of console output), the point of
>> printk() is to save kernel messages into log files (via userspace syslog
>> daemon).
>>
>> By the way, I think
>>
>> printk(KERN_NO_CONSOLES "hello\n")
>>
>> is almost same with doing
>>
>> saved_loglevel = console_loglevel;
>> console_loglevel = CONSOLE_LOGLEVEL_SILENT;
>> printk("hello\n");
>> console_loglevel = saved_loglevel;
>>
>> used by vkdb_printf().
>
> And both shouldn't be done within the kernel. The "CONSOLE_LOGLEVEL_SILENT"
> if for user decided policy, not the kernel making that policy for the user.
Though, I believe the reverse KERN_UNSUPPRESSED [1] still makes sense
for sysrq/kdb where user expects their interactive messages to appear on
console. And unfortunately, userspace depends on the loglevel of those
messages as it is.
With KERN_UNSUPPRESSED I hope to remove all those console_loglevel
tricks and make it static variable for printk.
[1]: https://lore.kernel.org/lkml/20190528002412.1625-1-dima@xxxxxxxxxx/
Thanks,
Dmitry