Seems that Peter Zijlstra added a new check that is making old
code screem nasty warnings:

WARNING: CPU: 0 PID: 91 at kernel/sched/core.c:7253 __might_sleep+0x9a/0x378()
do not call blocking ops when !TASK_RUNNING; state=1 set at [<ffffffff8d79b511>] event_test_thread+0x48/0x93
Modules linked in:
CPU: 0 PID: 91 Comm: test-events Not tainted 3.17.0-rc7-00109-g2f85d18 #37
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
 0000000000000000 ffff880010ec3c80 ffffffff8c696943 ffff880010ec3cb8
 ffffffff8be7cae5 ffffffff8bead236 0000000000000001 ffff88001161fa01
 0000000000000001 0000000000000000 ffff880010ec3d20 ffffffff8be7cb46
Call Trace:
 [<ffffffff8c696943>] dump_stack+0x19/0x1b
 [<ffffffff8be7cae5>] warn_slowpath_common+0x8f/0xa8
 [<ffffffff8bead236>] ? __might_sleep+0x9a/0x378
 [<ffffffff8be7cb46>] warn_slowpath_fmt+0x48/0x50
 [<ffffffff8be0dd55>] ? sched_clock+0x9/0xd
 [<ffffffff8d79b511>] ? event_test_thread+0x48/0x93
 [<ffffffff8d79b511>] ? event_test_thread+0x48/0x93
 [<ffffffff8bead236>] __might_sleep+0x9a/0x378
 [<ffffffff8c6a0227>] down_read+0x26/0x98
 [<ffffffff8be8f503>] exit_signals+0x27/0x1c2
 [<ffffffff8be7fedd>] do_exit+0x193/0x10bd
 [<ffffffff8bfd1969>] ? kfree+0x4a0/0x4d7
 [<ffffffff8d79b4c9>] ? event_trace_self_tests+0x6d7/0x6d7
 [<ffffffff8d79b4c9>] ? event_trace_self_tests+0x6d7/0x6d7
 [<ffffffff8bea4b65>] kthread+0x156/0x156
 [<ffffffff8c69c0f8>] ? wait_for_common+0x3e/0x224
 [<ffffffff8bea4a0f>] ? insert_kthread_work+0xe7/0xe7
 [<ffffffff8c6a353a>] ret_from_fork+0x7a/0xb0
 [<ffffffff8bea4a0f>] ? insert_kthread_work+0xe7/0xe7
---[ end trace 14d02ef17adbc114 ]---

These are triggered by some self tests that run at start up when
configure in. Although the code is technically correct, they are a little
sloppy and not very robust. They work now because it runs at boot up
and the tests do not call anything that might trigger a spurious
wake up. But that doesn't mean those tests wont change in the future.

It's best to clean them now to make sure the tests used to test the
internal workings of the system don't cause breakage themselves.

This also quiets the warnings made by the new checks.
tracing: Clean up scheduling in trace_wakeup_test_thread()

Peter's new debugging tool triggers when tasks exit with !TASK_RUNNING.
The code in trace_wakeup_test_thread() also has a single schedule() call
that should be encompassed by a loop.

This cleans up the code a little to make it a bit more robust and
also makes the return exit properly with TASK_RUNNING.

Link: http://lkml.kernel.org/p/20141008135216.76142204@gandalf.local.home

Reported-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: Peter Zijlstra <peterz@infreadead.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 file changed