Re: [PATCH 1/6 v2] sched: Init idle->on_rq in init_idle()

From: Thomas Gleixner
Date: Tue Feb 11 2014 - 10:34:43 EST


On Tue, 11 Feb 2014, Peter Zijlstra wrote:

> On Tue, Feb 11, 2014 at 10:17:58AM +0100, Sebastian Andrzej Siewior wrote:
> > The init task is state TASK_RUNNING and on_irq should be set to 1. It won't
>
> ^^^ irq? :-)
>
> > be set by scheduler because the idle task is never woken up, it is always the
> > task we fall back to if there is no other task pending.
>
> But why? Who cares? I mean, its true.. but what problem does it solve.
> Why did Thomas write this patch.

I could slap myself for not writing a proper changelog right away. It
took me some time to figure out why it was added in the first place,
why it's not longer necessary and why I kept it.

We stumbled in RT over a SMP bringup issue on ARM where the
idle->on_rq == 0 was causing try_to_wakeup() on the other cpu to run
into nada land.

After adding that idle->on_rq = 1; I was able to find the root cause
of the lockup: the idle task on the newly woken up cpu was fiddling
with a sleeping spinlock, which is a nono.

I kept the init of idle->on_rq to keep the state consistent and to
avoid another long lasting debug session.

As a side note, the whole debug mess could have been avoided if
might_sleep() would have yelled when called from the idle task. That's
fixed with patch 2/6 - and that one actually has a changelog :)

Thanks,

tglx






--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/