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

From: Frederic Weisbecker
Date: Fri May 13 2011 - 09:29:31 EST


On Fri, May 13, 2011 at 03:19:58PM +0200, Peter Zijlstra wrote:
> 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.

Oh right.

>
> > 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.

Nah, forget about that, I was just confused ;)
--
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/