[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20061210043446.d7eda6f0.akpm@osdl.org>
Date: Sun, 10 Dec 2006 04:34:46 -0800
From: Andrew Morton <akpm@...l.org>
To: Ingo Molnar <mingo@...e.hu>
Cc: vatsa@...ibm.com, Bjorn Helgaas <bjorn.helgaas@...com>,
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 Sun, 10 Dec 2006 13:19:15 +0100
Ingo Molnar <mingo@...e.hu> wrote:
>
> * Andrew Morton <akpm@...l.org> wrote:
>
> > This is actually not cpu-hotplug safe ;)
> >
> > > > > {
> > > > > int cpu = raw_smp_processor_id();
> > > > > /*
> > > > > * Interrupts/softirqs are hotplug-safe:
> > > > > */
> > > > > if (in_interrupt())
> > > > > return;
> > > > > if (current->hotplug_depth++)
> > > > > return;
> >
> > <preempt, cpu hot-unplug, resume on different CPU>
> >
> > > > > current->hotplug_lock = &per_cpu(hotplug_lock, cpu);
> >
> > <use-after-free>
> >
> > > > > mutex_lock(current->hotplug_lock);
> >
> > And it sleeps, so we can't use preempt_disable().
>
> i explained it in the other mail - this is the 'read' side. The 'write'
> side (code actually wanting to /do/ a CPU hotplug state transition) has
> to take /all/ these locks before it can take a CPU down.
Doesn't matter - the race is still there.
Well, not really, because we don't free the percpu data of offlined CPUs,
but we'd like to.
And it's easily fixable by using a statically-allocated array. That would
make life easier for code which wants to take this lock early in boot too.
> so this is still a global CPU hotplug lock, but made scalable.
Scalability is not the problem. At present, at least.
-
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