Re: [PATCH] disable non-boot CPUs before poweroff

From: Mark Lord
Date: Fri Sep 28 2007 - 10:12:12 EST

Mark Lord wrote:

We need to disable all CPUs other than the boot CPU (usually 0)
before attempting to power-off modern SMP machines.
This seems to fix the hang-on-poweroff issue
that one of my SMP boxes exhibits. More testing required.

Signed-off-by: Mark Lord <mlord@xxxxxxxxx>

--- linux/kernel/sys.c.orig 2007-09-13 09:49:11.000000000 -0400
+++ linux/kernel/sys.c 2007-09-28 09:48:54.000000000 -0400
@@ -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>
@@ -879,6 +880,7 @@
if (pm_power_off_prepare)
+ disable_nonboot_cpus();
printk(KERN_EMERG "Power down.\n");

Okay, verified now. Prior to this patch, *both* CPUs were still up and running
when machine_power_off() got called, and there was no guarantee that CPU0 was
the one calling machine_power_off(). BUG.

The above patch guarantees that only the single boot CPU is running
and calling machine_power_off().

Hopefully this buries the SMP-power-off bogeyman for good!

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at