public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Prarit Bhargava <prarit@redhat.com>
Cc: linux-kernel@vger.kernel.org, jbeulich@novell.com,
	anil.s.keshavamurthy@intel.com, amul.shah@unisys.com
Subject: Re: [PATCH]: Use stop_machine_run in the Intel RNG driver
Date: Wed, 28 Feb 2007 22:16:19 -0800	[thread overview]
Message-ID: <20070228221619.dc135f3c.akpm@linux-foundation.org> (raw)
In-Reply-To: <45E42268.30209@redhat.com>

On Tue, 27 Feb 2007 07:22:00 -0500 Prarit Bhargava <prarit@redhat.com> wrote:

> Replace call_smp_function with stop_machine_run in the Intel RNG driver.
> 
> CPU A has done read_lock(&lock)
> CPU B has done write_lock_irq(&lock) and is waiting for A to release the lock.
> 
> A third CPU calls call_smp_function and issues the IPI.  CPU A takes CPU C's
> IPI.  CPU B is waiting with interrupts disabled and does not see the IPI.
> CPU C is stuck waiting for CPU B to respond to the IPI.
> 
> Deadlock.

I think what you're describing here is just the standard old
smp_call_function() deadlock, rather than anything which is specific to
intel-rng, yes?

It is "well known" that you can't call smp_call_function() with local
interrupts disabled.  In fact i386 will spit a warning if you try it.


intel-rng doesn't do that, but what it _does_ do is:

	smp_call_function(..., wait = 0);
	local_irq_disable();

so some CPUs will still be entering the IPI while this CPU has gone and
disabled interrupts, thus exposing us to the deadlock, yes?

In which case a suitable fix might be to make intel-rng spin until all the
other CPUs have entered intel_init_wait().

> The solution is to use stop_machine_run instead of call_smp_function
> (call_smp_function should not be called in situations where the CPUs may
> be suspended).

But that seems to be a nice change anyway.  It took rather a lot of code
churn to do it, and it does find it necessary to export stop_machine_run()
to modules, but that seems OK too.


  reply	other threads:[~2007-03-01  6:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-27 12:08 [PATCH]: Use stop_machine_run in the Intel RNG driver Prarit Bhargava
2007-02-27 12:22 ` Prarit Bhargava
2007-03-01  6:16   ` Andrew Morton [this message]
2007-03-01 12:11     ` Prarit Bhargava

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=20070228221619.dc135f3c.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=amul.shah@unisys.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=jbeulich@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prarit@redhat.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