tracing: Wait for preempt irq delay thread to execute
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Sun, 10 May 2020 15:35:10 +0000 (11:35 -0400)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Mon, 11 May 2020 21:00:34 +0000 (17:00 -0400)
commit8b1fac2e73e84ef0d6391051880a8e1d7044c847
treed8802615a1e3948b018965c74599492e9c162ead
parent9d82ccda2bc5c148060543d249d54f8703741bb4
tracing: Wait for preempt irq delay thread to execute

A bug report was posted that running the preempt irq delay module on a slow
machine, and removing it quickly could lead to the thread created by the
modlue to execute after the module is removed, and this could cause the
kernel to crash. The fix for this was to call kthread_stop() after creating
the thread to make sure it finishes before allowing the module to be
removed.

Now this caused the opposite problem on fast machines. What now happens is
the kthread_stop() can cause the kthread never to execute and the test never
to run. To fix this, add a completion and wait for the kthread to execute,
then wait for it to end.

This issue caused the ftracetest selftests to fail on the preemptirq tests.

Link: https://lore.kernel.org/r/20200510114210.15d9e4af@oasis.local.home
Cc: stable@vger.kernel.org
Fixes: d16a8c31077e ("tracing: Wait for preempt irq delay thread to finish")
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/preemptirq_delay_test.c