summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2026-02-07 22:24:25 -0500
committerSteven Rostedt (Google) <rostedt@goodmis.org>2026-02-08 21:01:12 -0500
commitaf1eea12ad24f62d65714c5318841894278a7aaa (patch)
tree5b91e89cb21d32d8c48f4c387b28c0b6a966d411 /kernel
parentf377912b3dd71312cbf9eaf2c60263cb6e7cba59 (diff)
tracing: Use system_state in trace_printk_init_buffers()
The function trace_printk_init_buffers() is used to expand tha trace_printk buffers when trace_printk() is used within the kernel or in modules. On kernel boot up, it holds off from starting the sched switch cmdline recorder, but will start it immediately when it is added by a module. Currently it uses a trick to see if the global_trace buffer has been allocated or not to know if it was called by module load or not. But this is more of a hack, and can not be used when this code is moved out of trace.c. Instead simply look at the system_state and if it is running then it is know that it could only be called by module load. Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Andrew Morton <akpm@linux-foundation.org> Link: https://patch.msgid.link/20260208032450.660237094@kernel.org Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index f4ae80564615..4066c33674e7 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3243,10 +3243,9 @@ void trace_printk_init_buffers(void)
/*
* trace_printk_init_buffers() can be called by modules.
* If that happens, then we need to start cmdline recording
- * directly here. If the global_trace.buffer is already
- * allocated here, then this was called by module code.
+ * directly here.
*/
- if (global_trace.array_buffer.buffer)
+ if (system_state == SYSTEM_RUNNING)
tracing_start_cmdline_record();
}
EXPORT_SYMBOL_GPL(trace_printk_init_buffers);