summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSteven Rostedt (Google) <rostedt@goodmis.org>2023-05-28 07:17:39 +0200
committerSteven Rostedt (Google) <rostedt@goodmis.org>2023-05-29 03:15:17 +0200
commit9da705d432a07927526005a0688d81fbbf30e349 (patch)
tree73abdfa23b84c1c414fcec0ecbfbbf3cfcaa5893 /kernel
parenttracing: Move setting of tracing_selftest_running out of register_tracer() (diff)
downloadlinux-9da705d432a07927526005a0688d81fbbf30e349.tar.xz
linux-9da705d432a07927526005a0688d81fbbf30e349.zip
tracing: Have tracer selftests call cond_resched() before running
As there are more and more internal selftests being added to the Linux kernel (KSAN, lockdep, etc) the selftests are taking longer to run when these are enabled. Add a cond_resched() to the calling of do_run_tracer_selftest() to force a schedule if NEED_RESCHED is set, otherwise the soft lockup watchdog may trigger on boot up. Link: https://lkml.kernel.org/r/20230528051742.1325503-3-rostedt@goodmis.org Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 87e5920b141f..70f2b511b9cd 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2045,6 +2045,13 @@ static int do_run_tracer_selftest(struct tracer *type)
{
int ret;
+ /*
+ * Tests can take a long time, especially if they are run one after the
+ * other, as does happen during bootup when all the tracers are
+ * registered. This could cause the soft lockup watchdog to trigger.
+ */
+ cond_resched();
+
tracing_selftest_running = true;
ret = run_tracer_selftest(type);
tracing_selftest_running = false;