mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Mark Lord <lkml@rtr.ca>
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
	npiggin@suse.de, torvalds@linux-foundation.org
Subject: Re: [PATCH 1/11] Add generic helpers for arch IPI function calls
Date: Wed, 23 Apr 2008 15:51:11 +0200	[thread overview]
Message-ID: <20080423135110.GO12774@kernel.dk> (raw)
In-Reply-To: <480F3CBC.60305@rtr.ca>

On Wed, Apr 23 2008, Mark Lord wrote:
> >>>Date:	Thu, 15 Nov 2007 12:07:48 -0500
> >>>From: Mark Lord <lkml@rtr.ca>
> >>>To: Greg KH <gregkh@suse.de>
> >>>Cc: Yasunori Goto <y-goto@jp.fujitsu.com>,
> >>>	Andrew Morton <akpm@linux-foundation.org>,
> >>>	Alexey Dobriyan <adobriyan@sw.ru>, linux-kernel@vger.kernel.org
> >>>Subject: Re: EIP is at device_shutdown+0x32/0x60
> >>>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> >>>Content-Transfer-Encoding: 7bit
> >>>Sender: linux-kernel-owner@vger.kernel.org
> >>>
> >>>... < snip > ...
> >>>
> >>>Greg, I don't know if this is relevant or not,
> >>>but x86 has bugs in the halt/reboot code for SMP.
> >>>
> >>>Specifically, in native_smp_send_stop() the code now uses
> >>>spin_trylock() to "lock" the shared call buffers,
> >>>but then ignores the result.
> >>>
> >>>This means that multiple CPUs can/will clobber each other
> >>>in that code.
> >>>
> >>>The second bug, is that this code does not wait for the
> >>>target CPUs to actually stop before it continues.
> >>>
> >>>This was the real cause of the failure-to-poweroff problems
> >>>I was having with 2.6.23, which we fixed by using CPU hotplug
> >>>to disable_nonboot_cpus() before the above code ever got run.
> 
> Jens Axboe wrote:
> >On Tue, Apr 22 2008, Mark Lord wrote:
> >>Jens,
> >>
> >>While you're in there, :)
> >>
> >>Could you perhaps fix this bug (above) if it still exists?
> >
> >I don't understand the bug - what are the shared call buffers you are
> >talking of?
> >
> >With the changes, there's not even an spin_trylock() in there anymore.
> >But I don't see the original bug either, so...
> ..
> 
> arch/x86/kernel/smp.c:
> 
> static void native_smp_send_stop(void)
> {
>        int nolock;
>        unsigned long flags;
> 
>        if (reboot_force)
>                return;
> 
>        /* Don't deadlock on the call lock in panic */
>        nolock = !spin_trylock(&call_lock);       <<<<<<<<<< buggy
>        local_irq_save(flags);
>        __smp_call_function(stop_this_cpu, NULL, 0, 0);
>        if (!nolock)
>                spin_unlock(&call_lock);
>        disable_local_APIC();
>        local_irq_restore(flags);
> }
> 
> The spinlock is trying to protect access to the global variable
> "call_data" (higher up in the same file), which is used
> in __smp_call_function() and friends.
> 
> But since the spinlock is ignored in this case,
> the global "call_data will get clobbered if it was already in-use.

Ah I see, that bug doesn't exist with the converted code.

> The second bug, is that for the halt case at least,
> nobody waits for the other CPU to actually halt
> before continuing.. so we sometimes enter the shutdown
> code while other CPUs are still active.
> 
> This causes some machines to hang at shutdown,
> unless CPU_HOTPLUG is configured and takes them offline
> before we get here.

I'm guessing there's a reason it doesn't pass '1' as the last argument,
because that would fix that issue?

-- 
Jens Axboe


  reply	other threads:[~2008-04-23 13:51 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-22  7:57 [PATCH 0/11] Generic smp_call_function() and friends Jens Axboe
2008-04-22  7:57 ` [PATCH 1/11] Add generic helpers for arch IPI function calls Jens Axboe
2008-04-22  9:16   ` Avi Kivity
2008-04-22  9:22     ` Jens Axboe
2008-04-22 11:14       ` Jens Axboe
2008-04-22 13:00         ` Peter Zijlstra
2008-04-22 14:25           ` Jens Axboe
2008-04-22 14:38             ` Avi Kivity
2008-04-22 14:43               ` Peter Zijlstra
2008-04-22 14:47                 ` Avi Kivity
2008-04-22 14:53               ` Jens Axboe
2008-04-22 14:43   ` Linus Torvalds
2008-04-22 14:51     ` Jens Axboe
2008-04-22 15:01       ` Linus Torvalds
2008-04-22 16:49         ` Jens Axboe
2008-04-22 17:04           ` Jens Axboe
2008-04-22 17:13             ` Jens Axboe
2008-04-22 17:29               ` Linus Torvalds
2008-04-22 18:23                 ` Jens Axboe
2008-04-22 18:39                   ` Linus Torvalds
2008-04-22 14:58     ` Linus Torvalds
2008-04-22 15:07       ` Jens Axboe
2008-04-22 23:12   ` Mark Lord
2008-04-23  7:24     ` Jens Axboe
2008-04-23 13:42       ` Mark Lord
2008-04-23 13:51         ` Jens Axboe [this message]
2008-04-23 14:46           ` Mark Lord
2008-04-24 10:59             ` Jens Axboe
2008-04-24 12:44               ` Mark Lord
2008-04-24 21:30                 ` Rafael J. Wysocki
2008-04-25 11:08                 ` Pavel Machek
2008-04-26  8:04               ` Pavel Machek
2008-04-28 15:13                 ` Mark Lord
2008-05-01 16:23                   ` Pavel Machek
2008-04-22  7:57 ` [PATCH 2/11] x86: convert to generic helpers for " Jens Axboe
2008-04-22  8:38   ` Sam Ravnborg
2008-04-22  8:43     ` Jens Axboe
2008-04-22 11:15       ` Jens Axboe
2008-04-22  8:47   ` Ingo Molnar
2008-04-22  8:48     ` Jacek Luczak
2008-04-22  8:56       ` Jens Axboe
2008-04-22  9:04         ` Jacek Luczak
2008-04-22  8:52     ` Jens Axboe
2008-04-26  8:59     ` Jeremy Fitzhardinge
2008-04-22  7:57 ` [PATCH 3/11] powerpc: " Jens Axboe
2008-04-22 12:03   ` Paul Mackerras
2008-04-22 12:13     ` Jens Axboe
2008-04-22 12:42       ` Paul Mackerras
2008-04-22 18:51         ` Jens Axboe
2008-04-22  7:57 ` [PATCH 4/11] ia64: " Jens Axboe
2008-04-22  7:57 ` [PATCH 5/11] alpha: " Jens Axboe
2008-04-22  7:57 ` [PATCH 6/11] arm: " Jens Axboe
2008-04-22 15:00   ` Catalin Marinas
2008-04-22 18:43     ` Jens Axboe
2008-04-22  7:57 ` [PATCH 7/11] m32r: " Jens Axboe
2008-04-22  7:57 ` [PATCH 8/11] mips: " Jens Axboe
2008-04-22  7:57 ` [PATCH 9/11] parisc: " Jens Axboe
2008-04-22 14:09   ` Kyle McMartin
2008-04-22 14:27     ` Jens Axboe
2008-04-22 14:30       ` Kyle McMartin
2008-04-22 14:49         ` Jens Axboe
2008-04-22  7:57 ` [PATCH 10/11] sh: " Jens Axboe
2008-04-22  7:57 ` [PATCH 11/11] s390: " Jens Axboe
2008-04-22  8:04   ` Martin Schwidefsky
2008-04-22  8:07     ` Jens Axboe
2008-04-22  7:57 ` Jens Axboe
2008-04-22  8:48 ` [PATCH 0/11] Generic smp_call_function() and friends Peter Zijlstra
2008-04-22 18:50 [PATCH 0/11] Generic smp_call_function() #2 Jens Axboe
2008-04-22 18:50 ` [PATCH 1/11] Add generic helpers for arch IPI function calls Jens Axboe
2008-04-22 20:17   ` Peter Zijlstra
2008-04-23  6:07     ` Jens Axboe
2008-04-23  6:32       ` Peter Zijlstra
2008-04-23  7:49         ` Jens Axboe
2008-04-23  7:50           ` Peter Zijlstra
2008-04-24 22:01   ` Russell King
2008-04-25  7:18     ` Jens Axboe
2008-04-26  6:28       ` Jeremy Fitzhardinge
2008-04-28  7:38         ` Jes Sorensen
2008-04-26  6:11   ` Andrew Morton
2008-04-26 14:13     ` James Bottomley
2008-04-27  0:58     ` Paul E. McKenney
2008-04-27 10:36       ` Jens Axboe
2008-04-27 10:30     ` Jens Axboe
2008-04-28 14:25     ` David Howells
2008-04-28 14:43       ` James Bottomley

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=20080423135110.GO12774@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@rtr.ca \
    --cc=npiggin@suse.de \
    --cc=torvalds@linux-foundation.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

Powered by JetHome