From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
There are some code which depends on CONFIG_MODULES. #ifdef
to enclose it.
Fixes: dca91c1c5468 ("tracing: Have persistent trace instances save module addresses")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/trace/trace.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index c3c79908766e..c70b2e709987 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -6001,6 +6001,7 @@ struct trace_scratch {
static DEFINE_MUTEX(scratch_mutex);
+#ifdef CONFIG_MODULES
static int save_mod(struct module *mod, void *data)
{
struct trace_array *tr = data;
@@ -6025,6 +6026,7 @@ static int save_mod(struct module *mod, void *data)
return 0;
}
+#endif
static void update_last_data(struct trace_array *tr)
{
@@ -6040,9 +6042,10 @@ static void update_last_data(struct trace_array *tr)
memset(tscratch->entries, 0,
flex_array_size(tscratch, entries, tscratch->nr_entries));
tscratch->nr_entries = 0;
-
+#ifdef CONFIG_MODULES
guard(mutex)(&scratch_mutex);
module_for_each_mod(save_mod, tr);
+#endif
}
if (!(tr->flags & TRACE_ARRAY_FL_LAST_BOOT))
On Fri, 14 Mar 2025 01:26:51 +0900 "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote: > @@ -6040,9 +6042,10 @@ static void update_last_data(struct trace_array *tr) > memset(tscratch->entries, 0, > flex_array_size(tscratch, entries, tscratch->nr_entries)); > tscratch->nr_entries = 0; > - > +#ifdef CONFIG_MODULES > guard(mutex)(&scratch_mutex); > module_for_each_mod(save_mod, tr); > +#endif > } Hmm, I think the real fix for this would be to make module_for_each_mod() a nop when modules are not configured. -- Steve
On Fri, 14 Mar 2025 05:42:57 -0400 Steven Rostedt <rostedt@goodmis.org> wrote: > On Fri, 14 Mar 2025 01:26:51 +0900 > "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote: > > > @@ -6040,9 +6042,10 @@ static void update_last_data(struct trace_array *tr) > > memset(tscratch->entries, 0, > > flex_array_size(tscratch, entries, tscratch->nr_entries)); > > tscratch->nr_entries = 0; > > - > > +#ifdef CONFIG_MODULES > > guard(mutex)(&scratch_mutex); > > module_for_each_mod(save_mod, tr); > > +#endif > > } > > Hmm, I think the real fix for this would be to make > module_for_each_mod() a nop when modules are not configured. Yeah, but in this case, save_mod() need to be removed too[*]. Or is it better to make save_mod() a nop too? [*] https://lore.kernel.org/oe-kbuild-all/202503142045.0sE1neLa-lkp@intel.com/ Thank you, > > -- Steve > -- Masami Hiramatsu (Google) <mhiramat@kernel.org>
© 2016 - 2025 Red Hat, Inc.