All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: "Satyam Sharma" <satyam.sharma@gmail.com>
Cc: "Jan Glauber" <jan.glauber@de.ibm.com>,
	"Heiko Carstens" <heiko.carstens@de.ibm.com>,
	"David Miller" <davem@davemloft.net>,
	akpm@osdl.org, mingo@elte.hu, schwidefsky@de.ibm.com,
	linux-kernel@vger.kernel.org, "Alan Cox" <alan@redhat.com>
Subject: Re: [patch] i386/x86_64: smp_call_function locking inconsistency
Date: Fri, 8 Jun 2007 21:42:21 +0200	[thread overview]
Message-ID: <200706082142.21449.ak@suse.de> (raw)
In-Reply-To: <a781481a0706070707j301ba886h10f4607fd6a6e8de@mail.gmail.com>

On Thursday 07 June 2007 16:07:04 Satyam Sharma wrote:
> Hi,
> 
> I'm about six months late here(!), but I noticed this bug in
> arch/x86_64/kernel/smp.c while preparing another related
> patch today and then found this thread during Googling ...
> 
> On 2/9/07, Heiko Carstens <heiko.carstens@de.ibm.com> wrote:
> > On i386/x86_64 smp_call_function_single() takes call_lock with
> > spin_lock_bh(). To me this would imply that it is legal to call
> > smp_call_function_single() from softirq context.
> > It's not since smp_call_function() takes call_lock with just
> > spin_lock(). We can easily deadlock:
> >
> > -> [process context]
> > -> smp_call_function()
> > -> spin_lock(&call_lock)
> > -> IRQ -> do_softirq -> tasklet
> > -> [softirq context]
> > -> smp_call_function_single()
> > -> spin_lock_bh(&call_lock)
> > -> dead
> 
> You're absolutely right, and this bug still exists in the latest -git.

bug is definitely too strong a word. It might be unnecessary to disable bhs, 
but I don't see any bug in here as long as you can't show a case where
the smp_call_function() is called from BHs.

There was a patch floating around to use it from sysrq to display state
of all CPUs (and sysrq is softirq), but I don't think that ever
made it mainline.

And smp_call_function() can be called from panic which can violate
quite some assumptions, but some deadlock possibility there is ok.

I also don't like making it soft/hard irq save because that would
make it much more intrusive to the machine for no good reason
(e.g. slab can call it quite often in some cases)

The _bh should be probably just removed and possibly a WARN_ON added.

-Andi

  parent reply	other threads:[~2007-06-08 19:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-08 20:32 [patch] i386/x86_64: smp_call_function locking inconsistency Heiko Carstens
2007-02-08 20:43 ` David Miller
2007-02-09  8:42   ` Heiko Carstens
2007-02-09 12:57     ` Jan Glauber
2007-06-07 14:07       ` Satyam Sharma
2007-06-07 16:27         ` Heiko Carstens
2007-06-07 16:54           ` Satyam Sharma
2007-06-07 17:18             ` Satyam Sharma
2007-06-07 17:22               ` Avi Kivity
2007-06-07 17:33                 ` Satyam Sharma
2007-06-10  7:38                   ` Avi Kivity
2007-06-08 19:43             ` Andi Kleen
2007-06-08 19:42         ` Andi Kleen [this message]
2007-02-09  7:40 ` Andi Kleen

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=200706082142.21449.ak@suse.de \
    --to=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=alan@redhat.com \
    --cc=davem@davemloft.net \
    --cc=heiko.carstens@de.ibm.com \
    --cc=jan.glauber@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=satyam.sharma@gmail.com \
    --cc=schwidefsky@de.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.