tracing: Only make selftest conditionals affect the global_trace
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Sun, 28 May 2023 05:17:41 +0000 (01:17 -0400)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Mon, 29 May 2023 01:15:33 +0000 (21:15 -0400)
commitac9d2cb1d5f8e22235c399338504dadc87d14e74
tree25b1edb4a119d12f23a9057e029400d488b8bd68
parenta3ae76d7ff781208100e6acc58eb09afb7b4b177
tracing: Only make selftest conditionals affect the global_trace

The tracing_selftest_running and tracing_selftest_disabled variables were
to keep trace_printk() and other writes from affecting the tracing
selftests, as the tracing selftests would examine the ring buffer to see
if it contained what it expected or not. trace_printk() and friends could
add to the ring buffer and cause the selftests to fail (and then disable
the tracer that was being tested). To keep that from happening, these
variables were added and would keep trace_printk() and friends from
writing to the ring buffer while the tests were going on.

But this was only the top level ring buffer (owned by the global_trace
instance). There is no reason to prevent writing into ring buffers of
other instances via the trace_array_printk() and friends. For the
functions that could be used by other instances, check if the global_trace
is the tracer instance that is being written to before deciding to not
allow the write.

Link: https://lkml.kernel.org/r/20230528051742.1325503-5-rostedt@goodmis.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace.c