Re: [PATCH printk v2 09/12] printk: add functions to prefer direct printing
From: John Ogness
Date: Thu Apr 07 2022 - 16:34:32 EST
On 2022-04-07, Helge Deller <deller@xxxxxx> wrote:
> In my case - while I debug low-level kernel code - I then just need to
> use pr_warn() or pr_emerg() and get it printed non-threadened. That's
> sufficient for me.
Actually, no. The loglevel does not determine if a message is direct
printed or not. By "warn" I was referring to WARN_ON(condition).
If you are debugging low-level kernel code, you usually will _want_
threaded printing. The timestamps match the printk() call, so you will
get accurate logs. And the runtime performance of your low-level kernel
code will not be significantly affected by the printk() call.
If for some reason you really want non-threaded printing, the patch we
are discussing creates new functions to manually activate it:
printk_prefer_direct_enter();
pr_info("debugging\n");
printk_prefer_direct_exit();
But then your pr_info() will cause significant latencies. The timestamp
would be the same, with or without direct printing.
John