Re: [PATCH] init/main.c: log initcall level when initcall_debug is used

Petr Mladek <[email protected]> Thu, 3 Apr 2025 11:49:43 +0200
Newsgroups org.kernel.vger.linux-embedded,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Thu 2025-04-03 00:09:35, Andrew Morton wrote:
> On Thu, 3 Apr 2025 01:42:46 -0500 Rob Landley <[email protected]> wrote:
> 
> > On 4/2/25 21:55, Andrew Morton wrote:
> > > Please review and test this fixlet:
> > > 
> > > --- a/init/main.c~init-mainc-log-initcall-level-when-initcall_debug-is-used-fix
> > > +++ a/init/main.c
> > > @@ -1217,7 +1217,7 @@ trace_initcall_finish_cb(void *data, ini
> > >   static __init_or_module void
> > >   trace_initcall_level_cb(void *data, const char *level)
> > >   {
> > > -	printk(KERN_DEBUG "entering initcall level: %s\n", level);
> > > +	pr_debug("entering initcall level: %s\n", level);
> > >   }
> > 
> > How do I tell kconfig to remove all pr_blah() below loglevel X so they 
> > aren't compiled into the kernel taking up space? I thought that was the 
> > reason for switching to the pr_thingy() macros (it was in the old -tiny 
> > tree Mackall walked away from) but last time I tried to do it in vanilla 
> > I couldn't find the knob or trace the relevant plumbing...
> 
> Ask the maintainer :)
> 
> I can't see a way.  Maybe it was never merged.

If I read the definition of pr_debug() correctly then it should
become nop when CONFIG_DYNAMIC_DEBUG is not defined, look
for "pr_debug" and "no_printk" in include/linux/printk.h.

That said, I have never checked this. Another condition is
that DEBUG must not be defined. But I guess that it is
the default.

Best Regards,
Petr