Skip to content

Commit a2d910f

Browse files
committed
tracing: Have function_graph selftest call cond_resched()
When all kernel debugging is enabled (lockdep, KSAN, etc), the function graph enabling and disabling can take several seconds to complete. The function_graph selftest enables and disables function graph tracing several times. With full debugging enabled, the soft lockup watchdog was triggering because the selftest was running without ever scheduling. Add cond_resched() throughout the test to make sure it does not trigger the soft lockup detector. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent ac9d2cb commit a2d910f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

kernel/trace/trace_selftest.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,12 @@ trace_selftest_startup_function_graph(struct tracer *trace,
848848
}
849849

850850
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
851+
/*
852+
* These tests can take some time to run. Make sure on non PREEMPT
853+
* kernels, we do not trigger the softlockup detector.
854+
*/
855+
cond_resched();
856+
851857
tracing_reset_online_cpus(&tr->array_buffer);
852858
set_graph_array(tr);
853859

@@ -869,6 +875,8 @@ trace_selftest_startup_function_graph(struct tracer *trace,
869875
if (ret)
870876
goto out;
871877

878+
cond_resched();
879+
872880
ret = register_ftrace_graph(&fgraph_ops);
873881
if (ret) {
874882
warn_failed_init_tracer(trace, ret);
@@ -891,6 +899,8 @@ trace_selftest_startup_function_graph(struct tracer *trace,
891899
if (ret)
892900
goto out;
893901

902+
cond_resched();
903+
894904
tracing_start();
895905

896906
if (!ret && !count) {

0 commit comments

Comments
 (0)