Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Sun, 13 Oct 2002 15:51:36 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Sun, 13 Oct 2002 15:51:35 -0400 Received: from bgp01116664bgs.westln01.mi.comcast.net ([68.42.104.18]:48456 "HELO blackmagik.dynup.net") by vger.kernel.org with SMTP id ; Sun, 13 Oct 2002 15:51:29 -0400 Subject: Re: Patch: linux-2.5.42/kernel/sys.c - warm reboot should not suspend devices From: Eric Blade To: "Adam J. Richter" Cc: linux-kernel@vger.kernel.org In-Reply-To: <200210131924.MAA00308@baldur.yggdrasil.com> References: <200210131924.MAA00308@baldur.yggdrasil.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8.99 Date: 13 Oct 2002 15:51:57 -0400 Message-Id: <1034538718.1215.4.camel@cpq> Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3395 Lines: 82 On Sun, 2002-10-13 at 15:24, Adam J. Richter wrote: > linux-2.5.42 had an annoying new behavior. When I would > try to do a warm reboot, it would spin down the hard drives, which > just made the reboot take longer and gave the impression that a > halt or poweroff was in progress. > > At first, I suspected IDE, but I think the new behavior in IDE > of spinning down the hard drives on suspend is correct. The problem > is that the warm reboot system call is trying to suspend all of the > devices before a warm reboot for no reason. We already have a reboot > notifier chain that drivers can use to register code that has to be > run in order to safely reboot or halt. I am not talking about > eliminating that. I am only talking about the soft reboot putting > devices into a power saving mode that is allowed to take a long > recovery time, especially given that the reboot is likely to want to > talk to every hardware device connected to the system. > > Anyhow, here is the patch. As far as I can tell, there is no > delegated mainainer for kernel/sys.c, so I am sending this to > linux-kernel and I will resend it to Linus later if nobody points me > to another maintainer to go through and there are no complaints. Adam, I'm not sure the proper thing to do is necessarily remove the device_shutdown() call. I did the changes to the device_shutdown() function, but as far as I can tell, it should not have changed any behavior like that - all I did was re-work the logic a bit. In any case, what I did submit to the mailing list was absent a small piece of code (a change to device.h), and the person who forwarded it onto Linus (thank you!) did make a change to make it compile without that. Please try this patch to the base 2.5.42 code, and let me know if this returns it to the previous behavior? --- a/drivers/base/power.c Sat Oct 12 00:22:11 2002 +++ linux/drivers/base/power.c Sun Oct 13 15:42:46 2002 @@ -31,7 +31,7 @@ struct device * prev = NULL; int error = 0; - if(level == SUSPEND_POWER_DOWN) + if(level == SUSPEND_SHUT_DOWN) printk(KERN_EMERG "Shutting down devices\n"); else printk(KERN_EMERG "Suspending devices\n"); @@ -42,7 +42,7 @@ if (dev) { spin_unlock(&device_lock); if(dev->driver) { - if(level == SUSPEND_POWER_DOWN) { + if(level == SUSPEND_SHUT_DOWN) { if(dev->driver->remove) dev->driver->remove(dev); } else if(dev->driver->suspend) @@ -96,7 +96,7 @@ */ void device_shutdown(void) { - device_suspend(4, SUSPEND_POWER_DOWN); + device_suspend(4, SUSPEND_SHUT_DOWN); } EXPORT_SYMBOL(device_suspend); --- a/include/linux/device.h Sat Oct 12 00:22:19 2002 +++ linux/include/linux/device.h Sun Oct 13 15:43:03 2002 @@ -40,6 +40,7 @@ SUSPEND_SAVE_STATE, SUSPEND_DISABLE, SUSPEND_POWER_DOWN, + SUSPEND_SHUT_DOWN, }; enum { - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/