From patchwork Wed Sep 24 10:07:52 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 1263 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id B729EDE11F for ; Wed, 24 Sep 2008 20:09:04 +1000 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from sipsolutions.net (xc.sipsolutions.net [83.246.72.84]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 95456DDED1 for ; Wed, 24 Sep 2008 20:08:48 +1000 (EST) Received: by sipsolutions.net with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1KiRIR-0002pg-9l; Wed, 24 Sep 2008 12:08:35 +0200 Subject: Re: [Bugme-new] [Bug 11629] New: quad G5 fails to shut down From: Johannes Berg To: Andrew Morton In-Reply-To: <20080923143057.e3e54536.akpm@linux-foundation.org> References: <20080923143057.e3e54536.akpm@linux-foundation.org> Date: Wed, 24 Sep 2008 12:07:52 +0200 Message-Id: <1222250872.18015.69.camel@johannes.berg> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Cc: linuxppc-dev@ozlabs.org, bugme-daemon@bugzilla.kernel.org, Thomas Gleixner , Ingo Molnar X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org On Tue, 2008-09-23 at 14:30 -0700, Andrew Morton wrote: > > Steps to reproduce: > > shut down the machine, see it fail. > > > > http://johannes.sipsolutions.net/files/dsc_2274.jpg > > > > That went splat in the clockevents code. This is still strange, it appears that when the CPUs fail to offline, we still call into the clockevents code and it rightfully crashes, but I'll check that out separately. I've found the problem, below is a tentative fix. The problem has been around for quite a while, here's the whole commit that "caused" it (because it's so short): commit 4047727e5ae33f9b8d2b7766d1994ea6e5ec2991 Author: Mark Lord Date: Mon Oct 1 01:20:10 2007 -0700 Fix SMP poweroff hangs 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 Acked-by: Thomas Gleixner Cc: "Rafael J. Wysocki" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds diff --git a/kernel/sys.c b/kernel/sys.c index 1b33b05..8ae2e63 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -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(); And here's the fix. From: Johannes Berg Subject: powerpc: fix shutdown I tracked down the shutdown regression to CPUs not dying when being shut down during power-off. This turns out to be due to the system_state being SYSTEM_POWER_OFF, which this code doesn't take as a valid state for shutting off CPUs in. This has never made sense to me, but when I added hotplug code to implement hibernate I only "made it work" and did not question the need to check the system_state. Thomas Gleixner helped me dig, but the only thing we found is that it was added with the original commit that added CPU hotplug support. Signed-off-by: Johannes Berg Cc: Thomas Gleixner Cc: Joel Schopp Cc: Benjamin Herrenschmidt --- arch/powerpc/kernel/idle.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/arch/powerpc/kernel/idle.c +++ b/arch/powerpc/kernel/idle.c @@ -36,9 +36,7 @@ #ifdef CONFIG_HOTPLUG_CPU /* this is used for software suspend, and that shuts down * CPUs even while the system is still booting... */ -#define cpu_should_die() (cpu_is_offline(smp_processor_id()) && \ - (system_state == SYSTEM_RUNNING \ - || system_state == SYSTEM_BOOTING)) +#define cpu_should_die() cpu_is_offline(smp_processor_id()) #else #define cpu_should_die() 0 #endif