Re: [PATCH 2/2] x86: Make the x86-64 stacktrace code safelycallable from scheduler

From: Peter Zijlstra
Date: Fri May 13 2011 - 09:20:12 EST


On Fri, 2011-05-13 at 14:48 +0200, Frederic Weisbecker wrote:
> I haven't observed any deadlock. trace events disable preemption and
> other tracers do too (my changelog was buggy).
>
> I just worried about potential other users, like a WARN_ON in the
> scheduler or so.
>
> My worry is the following scenario:
>
> schedule() {
> acquire(rq)
> set_tsk_need_resched
> WARN_ON() {
> stack_trace() {
> preempt_enable() {
> preempt_schedule() {

Would never happen, because rq->lock is a spinlock which holds another
preempt count so preempt_enable() would never schedule.

> acquire(rq)
> }
> }
> }
> }
> }



> I don't know if it happens that one set TIF_NEED_RESCHED remotely,

Yes

> or if TIF_NEED_RESCHED can be set when we hold the rq,

Yes

> and then we
> can be followed by a WARN_ON, ...

Not quite sure, but possible.

> So I preferred to be careful.

Still not quite seeing how all things could go bang.
--
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/