From: Francesco Valla <francesco@valla.it>
To: linux-kernel@vger.kernel.org
Cc: linux-embedded@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
Tim Bird <Tim.Bird@sony.com>
Subject: [PATCH] init/main.c: print initcall level when initcall_debug is used
Date: Sun, 29 Dec 2024 17:29:01 +0100 [thread overview]
Message-ID: <20241229162901.126411-1-francesco@valla.it> (raw)
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.
Signed-off-by: Francesco Valla <francesco@valla.it>
---
init/main.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/init/main.c b/init/main.c
index 00fac1170294..160c93332536 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1223,6 +1223,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 %s initcall level\n", level);
+}
+
static ktime_t initcall_calltime;
#ifdef TRACEPOINTS_ENABLED
@@ -1234,10 +1240,12 @@ static void __init initcall_debug_enable(void)
&initcall_calltime);
ret |= register_trace_initcall_finish(trace_initcall_finish_cb,
&initcall_calltime);
+ ret |= register_trace_initcall_level(trace_initcall_level_cb, NULL);
WARN(ret, "Failed to register initcall tracepoints\n");
}
# define do_trace_initcall_start trace_initcall_start
# define do_trace_initcall_finish trace_initcall_finish
+# define do_trace_initcall_level trace_initcall_level
#else
static inline void do_trace_initcall_start(initcall_t fn)
{
@@ -1251,6 +1259,12 @@ static inline void do_trace_initcall_finish(initcall_t fn, int ret)
return;
trace_initcall_finish_cb(&initcall_calltime, fn, ret);
}
+static inline void do_trace_initcall_level(const char *level)
+{
+ if (!initcall_debug)
+ return;
+ trace_initcall_level_cb(NULL, level);
+}
#endif /* !TRACEPOINTS_ENABLED */
int __init_or_module do_one_initcall(initcall_t fn)
@@ -1323,7 +1337,7 @@ static void __init do_initcall_level(int level, char *command_line)
level, level,
NULL, ignore_unknown_bootoption);
- trace_initcall_level(initcall_level_names[level]);
+ do_trace_initcall_level(initcall_level_names[level]);
for (fn = initcall_levels[level]; fn < initcall_levels[level+1]; fn++)
do_one_initcall(initcall_from_entry(fn));
}
@@ -1367,7 +1381,7 @@ static void __init do_pre_smp_initcalls(void)
{
initcall_entry_t *fn;
- trace_initcall_level("early");
+ do_trace_initcall_level("early");
for (fn = __initcall_start; fn < __initcall0_start; fn++)
do_one_initcall(initcall_from_entry(fn));
}
--
2.47.1
reply other threads:[~2024-12-29 17:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20241229162901.126411-1-francesco@valla.it \
--to=francesco@valla.it \
--cc=Tim.Bird@sony.com \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).