Thread (5 messages) 5 messages, 2 authors, 2025-03-18
STALE440d
Revisions (3)
  1. v4 current
  2. v5 [diff vs current]
  3. v6 [diff vs current]

[PATCH v4 1/2] tracing: Fix a compilation error without CONFIG_MODULES

From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Date: 2025-03-13 16:26:54
Also in: lkml
Subsystem: the rest, tracing · Maintainers: Linus Torvalds, Steven Rostedt, Masami Hiramatsu

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))
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help