From: Peter Zijlstra <peterz@infradead.org>
To: Brian King <brking@linux.vnet.ibm.com>
Cc: mingo@elte.hu, efault@gmx.de, vatsa@in.ibm.com,
balbir@linux.vnet.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] sched: CPU remove deadlock fix
Date: Tue, 09 Dec 2008 16:11:56 +0100 [thread overview]
Message-ID: <1228835516.8684.7.camel@twins> (raw)
In-Reply-To: <1228834794.8684.6.camel@twins>
On Tue, 2008-12-09 at 15:59 +0100, Peter Zijlstra wrote:
> On Tue, 2008-12-09 at 15:52 +0100, Peter Zijlstra wrote:
> > On Tue, 2008-12-09 at 08:47 -0600, Brian King wrote:
> > > This patch fixes a possible deadlock scenario in the CPU remove path.
> > > migration_call grabs rq->lock, then wakes up everything on rq->migration_queue
> > > with the lock held. Then one of the tasks on the migration queue ends up
> > > calling tg_shares_up which then also tries to acquire the same rq->lock.
> >
> > Looks ok, does lockdep agree?
>
> On second thought, I'm not seeing it at all..
>
> why doesn't every wakeup deadlock?
because I'm blind...
void __wake_up(wait_queue_head_t *q, unsigned int mode,
int nr_exclusive, void *key)
{
unsigned long flags;
spin_lock_irqsave(&q->lock, flags);
__wake_up_common(q, mode, nr_exclusive, 0, key);
spin_unlock_irqrestore(&q->lock, flags);
}
that's q->lock, not rq->lock...
> > > Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
> > > ---
> > >
> > > kernel/sched.c | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff -puN kernel/sched.c~sched_cpu_down_deadlock_fix kernel/sched.c
> > > --- linux-2.6/kernel/sched.c~sched_cpu_down_deadlock_fix 2008-12-09 08:42:09.000000000 -0600
> > > +++ linux-2.6-bjking1/kernel/sched.c 2008-12-09 08:42:09.000000000 -0600
> > > @@ -6587,7 +6587,9 @@ migration_call(struct notifier_block *nf
> > > req = list_entry(rq->migration_queue.next,
> > > struct migration_req, list);
> > > list_del_init(&req->list);
> > > + spin_unlock_irq(&rq->lock);
> > > complete(&req->done);
> > > + spin_lock_irq(&rq->lock);
> > > }
> > > spin_unlock_irq(&rq->lock);
> > > break;
> > > _
next prev parent reply other threads:[~2008-12-09 15:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-09 14:47 [PATCH 1/1] sched: CPU remove deadlock fix Brian King
2008-12-09 14:52 ` Peter Zijlstra
2008-12-09 14:59 ` Peter Zijlstra
2008-12-09 15:11 ` Peter Zijlstra [this message]
2008-12-09 15:14 ` Brian King
2008-12-09 15:07 ` Brian King
2008-12-09 18:12 ` Heiko Carstens
2008-12-09 18:27 ` Ingo Molnar
2008-12-09 18:27 ` Ingo Molnar
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=1228835516.8684.7.camel@twins \
--to=peterz@infradead.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=brking@linux.vnet.ibm.com \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox