From: Chris Wright Date: Thu, 16 Feb 2006 00:34:13 +0000 (-0800) Subject: Add fix for IPI badness during shutdown, fwd from Ashok Raj and akpm. X-Git-Tag: v2.6.15.5~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f479c153990eb15b278d32e3af7324ce5c1bffee;p=thirdparty%2Fkernel%2Fstable-queue.git Add fix for IPI badness during shutdown, fwd from Ashok Raj and akpm. Fixes bug: http://bugzilla.kernel.org/show_bug.cgi?id=6077 --- diff --git a/queue/i386-x86-64-don-t-ipi-to-offline-cpus-on-shutdown.patch b/queue/i386-x86-64-don-t-ipi-to-offline-cpus-on-shutdown.patch new file mode 100644 index 00000000000..91ec254d8a5 --- /dev/null +++ b/queue/i386-x86-64-don-t-ipi-to-offline-cpus-on-shutdown.patch @@ -0,0 +1,109 @@ +From stable-bounces@linux.kernel.org Wed Feb 15 15:55:47 2006 +Date: Wed, 15 Feb 2006 15:51:31 -0800 +From: Andrew Morton +To: stable@kernel.org +Cc: Ashok Raj +Subject: [PATCH] i386/x86-64: Don't IPI to offline cpus on shutdown + +From: Eric W. Biederman + +So why are we calling smp_send_stop from machine_halt? + +We don't. + +Looking more closely at the bug report the problem here +is that halt -p is called which triggers not a halt but +an attempt to power off. + +machine_power_off calls machine_shutdown which calls smp_send_stop. + +If pm_power_off is set we should never make it out machine_power_off +to the call of do_exit. So pm_power_off must not be set in this case. +When pm_power_off is not set we expect machine_power_off to devolve +into machine_halt. + +So how do we fix this? + +Playing too much with smp_send_stop is dangerous because it +must also be safe to be called from panic. + +It looks like the obviously correct fix is to only call +machine_shutdown when pm_power_off is defined. Doing +that will make Andi's assumption about not scheduling +true and generally simplify what must be supported. + +This turns machine_power_off into a noop like machine_halt +when pm_power_off is not defined. + +If the expected behavior is that sys_reboot(LINUX_REBOOT_CMD_POWER_OFF) +becomes sys_reboot(LINUX_REBOOT_CMD_HALT) if pm_power_off is NULL +this is not quite a comprehensive fix as we pass a different parameter +to the reboot notifier and we set system_state to a different value +before calling device_shutdown(). + +Unfortunately any fix more comprehensive I can think of is not +obviously correct. The core problem is that there is no architecture +independent way to detect if machine_power will become a noop, without +calling it. + +Signed-off-by: Andi Kleen +Signed-off-by: Linus Torvalds +Signed-off-by: Chris Wright +--- + + arch/i386/kernel/reboot.c | 7 ++++--- + arch/x86_64/kernel/reboot.c | 10 ++++++---- + 2 files changed, 10 insertions(+), 7 deletions(-) + +diff --git a/arch/i386/kernel/reboot.c b/arch/i386/kernel/reboot.c +index 2fa5803..d207242 100644 +--- linux-2.6.15.4.orig/arch/i386/kernel/reboot.c ++++ linux-2.6.15.4/arch/i386/kernel/reboot.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -355,10 +356,10 @@ void machine_halt(void) + + void machine_power_off(void) + { +- machine_shutdown(); +- +- if (pm_power_off) ++ if (pm_power_off) { ++ machine_shutdown(); + pm_power_off(); ++ } + } + + +--- linux-2.6.15.4.orig/arch/x86_64/kernel/reboot.c ++++ linux-2.6.15.4/arch/x86_64/kernel/reboot.c +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -154,10 +155,11 @@ void machine_halt(void) + + void machine_power_off(void) + { +- if (!reboot_force) { +- machine_shutdown(); +- } +- if (pm_power_off) ++ if (pm_power_off) { ++ if (!reboot_force) { ++ machine_shutdown(); ++ } + pm_power_off(); ++ } + } + diff --git a/queue/series b/queue/series index a4a48e5add4..e61a6fc2173 100644 --- a/queue/series +++ b/queue/series @@ -7,3 +7,4 @@ hugetlbfs-mmap-enomem-failure.patch reiserfs-disable-automatic-enabling-of-reiserfs-inode-attributes.patch revert-skb_copy_datagram_iovec-recursion-elimination.patch address-autoconfiguration-does-not-work-after-device-down-up-cycle.patch +i386-x86-64-don-t-ipi-to-offline-cpus-on-shutdown.patch