[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20061207205407.b4e356aa.akpm@osdl.org>
Date: Thu, 7 Dec 2006 20:54:07 -0800
From: Andrew Morton <akpm@...l.org>
To: vatsa@...ibm.com
Cc: Bjorn Helgaas <bjorn.helgaas@...com>, Ingo Molnar <mingo@...e.hu>,
linux-kernel@...r.kernel.org, Myron Stowe <myron.stowe@...com>,
Jens Axboe <axboe@...nel.dk>, Dipankar <dipankar@...ibm.com>,
Gautham shenoy <ego@...ibm.com>
Subject: Re: workqueue deadlock
On Fri, 8 Dec 2006 08:23:01 +0530
Srivatsa Vaddagiri <vatsa@...ibm.com> wrote:
> On Thu, Dec 07, 2006 at 11:37:00AM -0800, Andrew Morton wrote:
> > -static void flush_cpu_workqueue(struct cpu_workqueue_struct *cwq)
> > +/*
> > + * If cpu == -1 it's a single-threaded workqueue and the caller does not hold
> > + * workqueue_mutex
> > + */
> > +static void flush_cpu_workqueue(struct cpu_workqueue_struct *cwq, int cpu)
>
> Lets say @cpu = 4
>
> > {
> > if (cwq->thread == current) {
> > /*
> > * Probably keventd trying to flush its own queue. So simply run
> > * it by hand rather than deadlocking.
> > */
> > + if (cpu != -1)
> > + mutex_unlock(&workqueue_mutex);
>
> Lets say we release the workqueue mutex here (events/4 is trying to
> flush its own workqueue). Immediately another CPU takes this mutex
> (in CPU_DOWN_PREPARE) and brings down CPU4. In CPU_DEAD handling we now wait
> on events/4 thread to exit (cleanup_workqueue_thread).
>
> Couldnt this wait deadlock on :
>
> > run_workqueue(cwq);
>
> > + if (cpu != -1)
> > + mutex_lock(&workqueue_mutex);
>
> events/4 thread itself wanting the same mutex above?
>
Could do, not sure. I'm planning on converting all the locking around here
to preempt_disable() though.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists