From: Mark Lord <lkml@rtr.ca>
To: Linux Kernel <linux-kernel@vger.kernel.org>
Cc: Greg KH <gregkh@suse.de>,
akpm@linux-foundation.org, rjw@sisk.pl, tglx@linutronix.de,
rjw@sisk.pl, lenb@kernel.org,
linux-pm@lists.linux-foundation.org, davej@redhat.com
Subject: SMP poweroff hangs: it's baaaack! But on x86_64 this time.
Date: Wed, 17 Dec 2008 10:48:02 -0500 [thread overview]
Message-ID: <49491F32.1040400@rtr.ca> (raw)
In-Reply-To: <47616F8C.9030803@rtr.ca>
> Subject: Fix SMP poweroff hangs
> From: Mark Lord <lkml@rtr.ca>
>
> We need to disable all CPUs other than the boot CPU (usually 0) before
> attempting to power-off modern SMP machines. This fixes the
> hang-on-poweroff issue on my MythTV SMP box, and also on Thomas Gleixner's
> new toybox.
>
> Signed-off-by: Mark Lord <mlord@pobox.com>
> Acked-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> kernel/sys.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff -puN kernel/sys.c~fix-smp-poweroff-hangs kernel/sys.c
> --- a/kernel/sys.c~fix-smp-poweroff-hangs
> +++ a/kernel/sys.c
> @@ -32,6 +32,7 @@
> #include <linux/getcpu.h>
> #include <linux/task_io_accounting_ops.h>
> #include <linux/seccomp.h>
> +#include <linux/cpu.h>
>
> #include <linux/compat.h>
> #include <linux/syscalls.h>
> @@ -878,6 +879,7 @@ void kernel_power_off(void)
> kernel_shutdown_prepare(SYSTEM_POWER_OFF);
> if (pm_power_off_prepare)
> pm_power_off_prepare();
> + disable_nonboot_cpus();
> sysdev_shutdown();
> printk(KERN_EMERG "Power down.\n");
> machine_power_off();
..
This bug has returned here now, but on x86_86 this time around.
Same machine as before, just upgraded toa 64-bit kernel/user (2.6.27.9)
from the original 32-bit kernel/user that was originally fixed (above).
One hang at poweroff over the past 10 days. Not much, but enough
to destroy confidence in "unattended" operation.
I lack opportunity to dig further into the code for now,
but just wanted to flag the problem, in case similar reports
from others might already be out there.
In the meanwhile, I'm experimenting with this simple patch,
garnered from the 32-bit investigations last time around.
We should know in a few weeks whether it has any effect or not.
--- old/kernel/sys.c 2008-10-18 13:57:22.000000000 -0400
+++ linux-2.6.27.9/kernel/sys.c 2008-12-17 09:42:17.000000000 -0500
@@ -303,6 +303,8 @@
static void kernel_shutdown_prepare(enum system_states state)
{
+ set_cpus_allowed(current, cpumask_of_cpu(first_cpu(cpu_online_map)));
+ disable_nonboot_cpus();
blocking_notifier_call_chain(&reboot_notifier_list,
(state == SYSTEM_HALT)?SYS_HALT:SYS_POWER_OFF, NULL);
system_state = state;
@@ -333,7 +335,6 @@
kernel_shutdown_prepare(SYSTEM_POWER_OFF);
if (pm_power_off_prepare)
pm_power_off_prepare();
- disable_nonboot_cpus();
sysdev_shutdown();
printk(KERN_EMERG "Power down.\n");
machine_power_off();
next prev parent reply other threads:[~2008-12-17 15:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20071213053020.E28AB1454450@imap.suse.de>
[not found] ` <4761601B.3030408@rtr.ca>
[not found] ` <20071213164545.GA10593@suse.de>
2007-12-13 17:30 ` patch revert-fix-smp-poweroff-hangs.patch queued to -stable tree Dave Jones
[not found] ` <47616C15.7030604@rtr.ca>
[not found] ` <47616F8C.9030803@rtr.ca>
2008-12-17 15:48 ` Mark Lord [this message]
2008-12-19 11:59 ` SMP poweroff hangs: it's baaaack! But on x86_64 this time Pavel Machek
2008-12-20 2:19 ` Mark Lord
2008-12-22 15:48 ` Mark Lord
2009-01-05 4:37 ` Mark Lord
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=49491F32.1040400@rtr.ca \
--to=lkml@rtr.ca \
--cc=akpm@linux-foundation.org \
--cc=davej@redhat.com \
--cc=gregkh@suse.de \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=rjw@sisk.pl \
--cc=tglx@linutronix.de \
/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