]> www.infradead.org Git - users/jedix/linux-maple.git/commit
kernel/async.c: stop guarding pr_debug() statements
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Thu, 22 Apr 2021 06:43:08 +0000 (16:43 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 5 May 2021 22:09:26 +0000 (08:09 +1000)
commit57bf09180cbfeb7b99fe5a114827b511b0635add
tree6ad75e6fa569ae6134ea31c0afec137083cf7d4d
parent5150a1e613a23b70aaa391199aaa13bcde70b673
kernel/async.c: stop guarding pr_debug() statements

It's currently nigh impossible to get these pr_debug()s to print
something.  Being guarded by initcall_debug means one has to enable tons
of other debug output during boot, and the system_state condition further
means it's impossible to get them when loading modules later.

Also, the compiler can't know that these global conditions do not change,
so there are W=2 warnings

kernel/async.c:125:9: warning: `calltime' may be used uninitialized in this function [-Wmaybe-uninitialized]
kernel/async.c:300:9: warning: `starttime' may be used uninitialized in this function [-Wmaybe-uninitialized]

Make it possible, for a DYNAMIC_DEBUG kernel, to get these to print their
messages by booting with appropriate 'dyndbg="file async.c +p"' command
line argument.  For a non-DYNAMIC_DEBUG kernel, pr_debug() compiles to
nothing.

This does cost doing an unconditional ktime_get() for the starttime value,
but the corresponding ktime_get for the end time can be elided by
factoring it into a function which only gets called if the printk()
arguments end up being evaluated.

Link: https://lkml.kernel.org/r/20210309151723.1907838-1-linux@rasmusvillemoes.dk
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
kernel/async.c