Skip to contentSkip to conversation

properly stop devices before poweroff

PATCH In review Olaf Hering 2 participants 4 messages Aug 1, 2005 – Aug 2, 2005 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 28 lines · Linux Kernel Mailing List

tree e2de713c76ddb42b091305b88aa7ca4938081789
parent 5ce47e59c9688d8480ae41100117d8188c191401
author Pavel Machek <[email protected]> Sun, 26 Jun 2005 04:55:11 -0700 committer Linus Torvalds <[email protected]> Sun, 26 Jun 2005 06:24:33 -0700

[PATCH] properly stop devices before poweroff

Without this patch, Linux provokes emergency disk shutdowns and similar nastiness. It was in SuSE kernels for some time, IIRC.

 include/linux/pm.h |   33 +++++++++++++++++++++------------
 kernel/sys.c       |    3 +++
 2 files changed, 24 insertions(+), 12 deletions(-)

+++ b/kernel/sys.c

(quoted diff) +1 -0
@@ -405,6 +405,7 @@ asmlinkage long sys_reboot(int magic1, i
 	case LINUX_REBOOT_CMD_HALT:
 		notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL);
 		system_state = SYSTEM_HALT;
+		device_suspend(PMSG_SUSPEND);
 		device_shutdown();
 		printk(KERN_EMERG "System halted.\n");
 		machine_halt();

Review asmlinkage long sys_reboot(int magic1, i · line 422

Quoted 7 lines
(quoted diff) +1 -0
@@ -415,6 +416,7 @@ asmlinkage long sys_reboot(int magic1, i
 	case LINUX_REBOOT_CMD_POWER_OFF:
 		notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL);
 		system_state = SYSTEM_POWER_OFF;
+		device_suspend(PMSG_SUSPEND);
 		device_shutdown();
 		printk(KERN_EMERG "Power down.\n");
 		machine_power_off();

This change for 'case LINUX_REBOOT_CMD_POWER_OFF' causes an endless hang after 'halt -p' on my Macs with USB keyboard.
It went into rc1, but the hang in an usb device (1-1.3) shows up only with rc3. Why is device_suspend() called anyway if the system will go down anyway in a few milliseconds?

#2 lore raw

PATCH 1/1 remove device_suspend calls in sys_reboot path

A recent change for 'case LINUX_REBOOT_CMD_POWER_OFF' causes an endless hang after 'halt -p' on my Macs with USB keyboard.
It went into rc1, but the hang in an usb device (1-1.3) shows up only with rc3. Why is device_suspend() called anyway if the system will go down anyway in a few milliseconds?

power down works again with this patch.

 kernel/sys.c |    4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)
kernel/sys.c +1 -3
Index: linux-2.6.13-rc4-git4/kernel/sys.c
===================================================================
@@ -392,7 +392,6 @@ void kernel_kexec(void)
 	}
 	notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL);
 	system_state = SYSTEM_RESTART;
-	device_suspend(PMSG_FREEZE);
 	device_shutdown();
 	printk(KERN_EMERG "Starting new kernel\n");
 	machine_shutdown();
@@ -405,7 +404,7 @@ void kernel_halt(void)
 {
 	notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL);
 	system_state = SYSTEM_HALT;
-	device_suspend(PMSG_SUSPEND);
+	device_suspend(PMSG_SUSPEND); /* FIXME */
 	device_shutdown();
 	printk(KERN_EMERG "System halted.\n");
 	machine_halt();
@@ -416,7 +415,6 @@ void kernel_power_off(void)
 {
 	notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL);
 	system_state = SYSTEM_POWER_OFF;
-	device_suspend(PMSG_SUSPEND);
 	device_shutdown();
 	printk(KERN_EMERG "Power down.\n");
 	machine_power_off();
#3 lore raw

Re: [PATCH] remove device_suspend calls in sys_reboot path

Quoted 6 lines · Olaf Hering

A recent change for 'case LINUX_REBOOT_CMD_POWER_OFF' causes an endless hang after 'halt -p' on my Macs with USB keyboard.
It went into rc1, but the hang in an usb device (1-1.3) shows up only with rc3. Why is device_suspend() called anyway if the system will go down anyway in a few milliseconds?

After reading last weeks sys_reboot thread, I'm not sure if this patch is correct. But halt -p should work again in 2.6.13, so we need something. Perhaps USB is broken now.

#4 lore raw

Re: [PATCH] remove device_suspend calls in sys_reboot path

In reply to Olaf Hering

Hi!

Quoted 7 lines

A recent change for 'case LINUX_REBOOT_CMD_POWER_OFF' causes an endless hang after 'halt -p' on my Macs with USB keyboard.
It went into rc1, but the hang in an usb device (1-1.3) shows up only with rc3. Why is device_suspend() called anyway if the system will go down anyway in a few milliseconds?

power down works again with this patch.

You are shooting the messenger, and will cause emergency disk stops. Bad.

Pavel

Signature · 1 line
teflon -- maybe it is a trademark, but it should not be.