From: James Bottomley <James.Bottomley@SteelEye.com>
To: Paul Mackerras <paulus@samba.org>
Cc: linux-kernel@vger.kernel.org, James.Bottomley@SteelEye.com
Subject: Re: smp_send_reschedule vs. smp_migrate_task
Date: Thu, 14 Feb 2002 18:24:16 -0500 [thread overview]
Message-ID: <200202142324.g1ENOGs03741@localhost.localdomain> (raw)
> In that post I was really asking the following questions:
> * how often does smp_send_reschedule get called? * how often does
> smp_migrate_task get called? * if smp_send_reschedule and
> smp_migrate_task were mutually exclusive,
> i.e. both used the same spinlock, could that lead to deadlock?
> James Bottomley answered the first two for me but not the third.
I think the answer to the third is yes.
The potential deadlock is inherent in smp_migrate_task(). Any code which
takes a spinlock on one CPU and unlocks it on another via an IPI is asking for
a deadlock.
Here's the scenario:
CPU 1 does a smp_migrate_task() to CPU 2 at the same time CPU 2 does the same
thing to CPU 1. They both contend for the migration lock. CPU 1 wins,
acquires the migration lock and sends the IPI to CPU 2. If CPU 2 is spinning
on the migration lock *with interrupts disabled* then you have a deadlock (it
can never accept the IPI and release the lock).
The way out is to make sure interrupts are always enabled when taking the
migration lock (which is true for all the task migration code paths). This,
in turn imposes a condition: the lock may never be taken from an interrupt
(otherwise it may deadlock itself).
Since smp_send_reschedule() is called down many process wake up code paths,
I'm not sure you can comply with the no calling from interrupt requirement if
you make it share a lock with smp_migrate_task().
James
next reply other threads:[~2002-02-14 23:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-14 23:24 James Bottomley [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-02-13 7:37 Paul Mackerras
2002-02-14 22:03 ` Val Henson
2002-02-14 22:28 ` Paul Mackerras
2002-02-15 5:55 ` Val Henson
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=200202142324.g1ENOGs03741@localhost.localdomain \
--to=james.bottomley@steeleye.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
/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
all inboxes | Powered by JetHome®