The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Francesco Valla <francesco@valla.it>
To: Andrew Morton <akpm@linux-foundation.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-kernel@vger.kernel.org, linux-embedded@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Tim Bird <Tim.Bird@sony.com>
Subject: Re: [PATCH] init/main.c: log initcall level when initcall_debug is used
Date: Thu, 03 Apr 2025 22:11:35 +0200	[thread overview]
Message-ID: <3690359.dWV9SEqChM@fedora.fritz.box> (raw)
In-Reply-To: <CAMuHMdXSLhypYULqfCm55MQxZCwLzxBBc7mnr6OBcPaHFwh2Lw@mail.gmail.com>

On Thursday, 3 April 2025 at 10:27:14 Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> Hi Andrew,
> 
> On Thu, 3 Apr 2025 at 04:56, Andrew Morton <akpm@linux-foundation.org> wrote:
> > On Sun, 16 Mar 2025 21:50:15 +0100 Francesco Valla <francesco@valla.it> wrote:
> > > When initcall_debug is specified on the command line, the start and
> > > return point for each initcall is printed. However, no information on
> > > the initcall level is reported.
> > >
> > > Add to the initcall_debug infrastructure an additional print that
> > > informs when a new initcall level is entered. This is particularly
> > > useful when debugging dependency chains and/or working on boot time
> > > reduction.
> > >
> > > ...
> > >
> > > --- a/init/main.c
> > > +++ b/init/main.c
> > > @@ -1214,6 +1214,12 @@ trace_initcall_finish_cb(void *data, initcall_t fn, int ret)
> > >                fn, ret, (unsigned long long)ktime_us_delta(rettime, *calltime));
> > >  }
> > >
> > > +static __init_or_module void
> > > +trace_initcall_level_cb(void *data, const char *level)
> > > +{
> > > +     printk(KERN_DEBUG "entering initcall level: %s\n", level);
> > > +}
> >
> > 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);
> >  }
> >
> >  static ktime_t initcall_calltime;
> 
> I think the "printk(KERN_DEBUG ...)" construct is intentional.
> The message should be logged when "initcall_debug" is passed on
> the kernel command line, while pr_debug() is a no-op unless DEBUG is
> defined inside the source file.
> 
> See also the two existing users in init/main.c near
> https://elixir.bootlin.com/linux/v6.13.7/source/init/main.c#L1207.
> 

Yes, printk(KERN_DEBUG ...) here is intentional, or it would be removed,
as Geert is correctly saying.

We have another occurrence of this for the "probe" messages also related
to initcall_debug, with a nice explanatory comment:

https://elixir.bootlin.com/linux/v6.14-rc6/source/drivers/base/dd.c#L741


Thank you!

Francesco




      reply	other threads:[~2025-04-03 20:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-16 20:50 [PATCH] init/main.c: log initcall level when initcall_debug is used Francesco Valla
2025-04-01 17:57 ` Bird, Tim
2025-04-03 20:04   ` Francesco Valla
2025-04-03  2:55 ` Andrew Morton
2025-04-03  6:42   ` Rob Landley
2025-04-03  7:09     ` Andrew Morton
2025-04-03  9:49       ` Petr Mladek
2025-04-03  8:27   ` Geert Uytterhoeven
2025-04-03 20:11     ` Francesco Valla [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3690359.dWV9SEqChM@fedora.fritz.box \
    --to=francesco@valla.it \
    --cc=Tim.Bird@sony.com \
    --cc=akpm@linux-foundation.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-embedded@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox