Skip to content

Commit 78041c0

Browse files
committed
tracing: Disable trace_printk() on post poned tests
The tracing seftests checks various aspects of the tracing infrastructure, and one is filtering. If trace_printk() is active during a self test, it can cause the filtering to fail, which will disable that part of the trace. To keep the selftests from failing because of trace_printk() calls, trace_printk() checks the variable tracing_selftest_running, and if set, it does not write to the tracing buffer. As some tracers were registered earlier in boot, the selftest they triggered would fail because not all the infrastructure was set up for the full selftest. Thus, some of the tests were post poned to when their infrastructure was ready (namely file system code). The postpone code did not set the tracing_seftest_running variable, and could fail if a trace_printk() was added and executed during their run. Cc: [email protected] Fixes: 9afecfb ("tracing: Postpone tracer start-up tests till the system is more robust") Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 3c18a9b commit 78041c0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/trace/trace.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,6 +1837,7 @@ static __init int init_trace_selftests(void)
18371837

18381838
pr_info("Running postponed tracer tests:\n");
18391839

1840+
tracing_selftest_running = true;
18401841
list_for_each_entry_safe(p, n, &postponed_selftests, list) {
18411842
/* This loop can take minutes when sanitizers are enabled, so
18421843
* lets make sure we allow RCU processing.
@@ -1859,6 +1860,7 @@ static __init int init_trace_selftests(void)
18591860
list_del(&p->list);
18601861
kfree(p);
18611862
}
1863+
tracing_selftest_running = false;
18621864

18631865
out:
18641866
mutex_unlock(&trace_types_lock);

0 commit comments

Comments
 (0)