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

Andrew Morton <[email protected]> Wed, 2 Apr 2025 19:55:44 -0700
Newsgroups org.kernel.vger.linux-embedded,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Sun, 16 Mar 2025 21:50:15 +0100 Francesco Valla <[email protected]> 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;