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.

tracing: Have trace_printk functions use flags instead of using global_trace

The trace.c file has become a dumping ground for all tracing code and has
become quite large. In order to move the trace_printk functions out of it
these functions can not access global_trace directly, as that is something
that needs to stay static in trace.c.

Instead of testing the trace_array tr pointer to &global_trace, test the
tr->flags to see if TRACE_ARRAY_FL_GLOBAL set.

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.491116245@kernel.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

+5 -4
+5 -4
kernel/trace/trace.c
··· 1071 1071 if (!(tr->trace_flags & TRACE_ITER(PRINTK))) 1072 1072 return 0; 1073 1073 1074 - if (unlikely(tracing_selftest_running && tr == &global_trace)) 1074 + if (unlikely(tracing_selftest_running && 1075 + (tr->flags & TRACE_ARRAY_FL_GLOBAL))) 1075 1076 return 0; 1076 1077 1077 1078 if (unlikely(tracing_disabled)) ··· 3387 3386 int trace_array_vprintk(struct trace_array *tr, 3388 3387 unsigned long ip, const char *fmt, va_list args) 3389 3388 { 3390 - if (tracing_selftest_running && tr == &global_trace) 3389 + if (tracing_selftest_running && (tr->flags & TRACE_ARRAY_FL_GLOBAL)) 3391 3390 return 0; 3392 3391 3393 3392 return __trace_array_vprintk(tr->array_buffer.buffer, ip, fmt, args); ··· 3423 3422 return -ENOENT; 3424 3423 3425 3424 /* This is only allowed for created instances */ 3426 - if (tr == &global_trace) 3425 + if (tr->flags & TRACE_ARRAY_FL_GLOBAL) 3427 3426 return 0; 3428 3427 3429 3428 if (!(tr->trace_flags & TRACE_ITER(PRINTK))) ··· 3450 3449 return -ENOENT; 3451 3450 3452 3451 /* This is only allowed for created instances */ 3453 - if (tr == &global_trace) 3452 + if (tr->flags & TRACE_ARRAY_FL_GLOBAL) 3454 3453 return -EINVAL; 3455 3454 3456 3455 return alloc_percpu_trace_buffer();