Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

init/main.c: log initcall level when initcall_debug is used

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.

Link: https://lkml.kernel.org/r/20250316205014.2830071-2-francesco@valla.it
Signed-off-by: Francesco Valla <francesco@valla.it>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Tim Bird <tim.bird@sony.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Francesco Valla and committed by
Andrew Morton
3330dc1b 3ca55ca2

+16 -2
+16 -2
init/main.c
··· 1214 1214 fn, ret, (unsigned long long)ktime_us_delta(rettime, *calltime)); 1215 1215 } 1216 1216 1217 + static __init_or_module void 1218 + trace_initcall_level_cb(void *data, const char *level) 1219 + { 1220 + printk(KERN_DEBUG "entering initcall level: %s\n", level); 1221 + } 1222 + 1217 1223 static ktime_t initcall_calltime; 1218 1224 1219 1225 #ifdef TRACEPOINTS_ENABLED ··· 1231 1225 &initcall_calltime); 1232 1226 ret |= register_trace_initcall_finish(trace_initcall_finish_cb, 1233 1227 &initcall_calltime); 1228 + ret |= register_trace_initcall_level(trace_initcall_level_cb, NULL); 1234 1229 WARN(ret, "Failed to register initcall tracepoints\n"); 1235 1230 } 1236 1231 # define do_trace_initcall_start trace_initcall_start 1237 1232 # define do_trace_initcall_finish trace_initcall_finish 1233 + # define do_trace_initcall_level trace_initcall_level 1238 1234 #else 1239 1235 static inline void do_trace_initcall_start(initcall_t fn) 1240 1236 { ··· 1249 1241 if (!initcall_debug) 1250 1242 return; 1251 1243 trace_initcall_finish_cb(&initcall_calltime, fn, ret); 1244 + } 1245 + static inline void do_trace_initcall_level(const char *level) 1246 + { 1247 + if (!initcall_debug) 1248 + return; 1249 + trace_initcall_level_cb(NULL, level); 1252 1250 } 1253 1251 #endif /* !TRACEPOINTS_ENABLED */ 1254 1252 ··· 1328 1314 level, level, 1329 1315 NULL, ignore_unknown_bootoption); 1330 1316 1331 - trace_initcall_level(initcall_level_names[level]); 1317 + do_trace_initcall_level(initcall_level_names[level]); 1332 1318 for (fn = initcall_levels[level]; fn < initcall_levels[level+1]; fn++) 1333 1319 do_one_initcall(initcall_from_entry(fn)); 1334 1320 } ··· 1372 1358 { 1373 1359 initcall_entry_t *fn; 1374 1360 1375 - trace_initcall_level("early"); 1361 + do_trace_initcall_level("early"); 1376 1362 for (fn = __initcall_start; fn < __initcall0_start; fn++) 1377 1363 do_one_initcall(initcall_from_entry(fn)); 1378 1364 }