All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: vatsa@in.ibm.com, Bjorn Helgaas <bjorn.helgaas@hp.com>,
	linux-kernel@vger.kernel.org, Myron Stowe <myron.stowe@hp.com>,
	Jens Axboe <axboe@kernel.dk>, Dipankar <dipankar@in.ibm.com>,
	Gautham shenoy <ego@in.ibm.com>
Subject: Re: workqueue deadlock
Date: Sun, 10 Dec 2006 04:34:46 -0800	[thread overview]
Message-ID: <20061210043446.d7eda6f0.akpm@osdl.org> (raw)
In-Reply-To: <20061210121914.GA20466@elte.hu>

On Sun, 10 Dec 2006 13:19:15 +0100
Ingo Molnar <mingo@elte.hu> wrote:

> 
> * Andrew Morton <akpm@osdl.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.

  reply	other threads:[~2006-12-10 12:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-07  0:26 workqueue deadlock Bjorn Helgaas
2006-12-07  6:17 ` Srivatsa Vaddagiri
2006-12-07  6:45   ` Srivatsa Vaddagiri
2006-12-07 18:51 ` Andrew Morton
2006-12-07 19:37   ` Andrew Morton
2006-12-08  2:53     ` Srivatsa Vaddagiri
2006-12-08  4:54       ` Andrew Morton
2006-12-08  7:58         ` Srivatsa Vaddagiri
2006-12-09 10:26         ` Ingo Molnar
2006-12-09 19:47           ` Andrew Morton
2006-12-10  8:26             ` Ingo Molnar
2006-12-10  8:43               ` Andrew Morton
2006-12-10 11:49                 ` Ingo Molnar
2006-12-10 12:16                   ` Andrew Morton
2006-12-10 12:19                     ` Ingo Molnar
2006-12-10 12:34                       ` Andrew Morton [this message]
2006-12-11  6:09                         ` Ingo Molnar
2006-12-10 14:18                     ` Rafael J. Wysocki
2006-12-11  6:52                       ` Dipankar Sarma
2006-12-11 16:34                         ` Rafael J. Wysocki
2006-12-11  5:45                     ` Srivatsa Vaddagiri
2006-12-11  6:03                       ` Andrew Morton
2006-12-11  4:58               ` Srivatsa Vaddagiri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061210043446.d7eda6f0.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=axboe@kernel.dk \
    --cc=bjorn.helgaas@hp.com \
    --cc=dipankar@in.ibm.com \
    --cc=ego@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=myron.stowe@hp.com \
    --cc=vatsa@in.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.