lkml.org 
[lkml]   [2006]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: workqueue deadlock

* Andrew Morton <akpm@osdl.org> wrote:

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

yeah.

but i think your freeze_processes() idea is even better - it would unify
the suspend and the CPU-hotplug infrastructure even more. (and kprobes
wants to use freeze_processes() too)

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

\
 
 \ /
  Last update: 2006-12-11 07:13    [W:0.057 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site