Skip to contentSkip to conversation

Stop disks on reboot for laptop which cuts power

PATCH In review Bruno Prémont 3 participants 7 messages Apr 18, 2009 – Apr 22, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Stop disks on reboot for laptop which cuts power

Hi,

During shutdown (power off) the disks are stopped gracefully thus the stopping is skipped for reboot case.

On my Acer Travelmate 660 reboot is more like power-off as it cuts all power during reboot which currently causes the disk to emergency-park its head (noisy and shortens disk life).

This patch series adds a DMI-based check to ide-gd and sd to still stop the disks for affected laptop during reboot.

Has been compile an run-tested with libata and just compile-tested for ide.

Bruno Prémont

#1 lore raw

PATCH 1/2 ide: Stop disks on reboot for laptop which cuts power

My laptop (Acer Travelmate 660) always cuts the power when rebooting which causes the disk to emergency-park it's head.

Add a dmi check to stop disk as for shutdown on this laptop.

---

drivers/ide/ide-gd.c +16 -1
index 1aebdf1..4b6b71e 100644
@@ -7,6 +7,7 @@
 #include <linux/mutex.h>
 #include <linux/ide.h>
 #include <linux/hdreg.h>
+#include <linux/dmi.h>
 
 #if !defined(CONFIG_DEBUG_BLOCK_EXT_DEVT)
 #define IDE_DISK_MINORS		(1 << PARTN_BITS)
@@ -99,6 +100,19 @@ static void ide_gd_resume(ide_drive_t *drive)
 		(void)drive->disk_ops->get_capacity(drive);
 }
 
+static const struct dmi_system_id ide_coldreboot_table[] = {
+	{
+		/* Acer TravelMate 66x cuts power during reboot */
+		.ident   = "Acer TravelMate 660",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
+		},
+	},
+
+	{ }	/* terminate list */
+};
+
 static void ide_gd_shutdown(ide_drive_t *drive)
 {
 #ifdef	CONFIG_ALPHA
@@ -115,7 +129,8 @@ static void ide_gd_shutdown(ide_drive_t *drive)
 	   the disk to expire its write cache. */
 	if (system_state != SYSTEM_POWER_OFF) {
 #else
-	if (system_state == SYSTEM_RESTART) {
+	if (system_state == SYSTEM_RESTART &&
+		!dmi_check_system(ide_coldreboot_table)) {
 #endif
 		drive->disk_ops->flush(drive);
 		return;
#2 lore raw

Re: [PATCH 1/2] ide: Stop disks on reboot for laptop which cuts power

Quoted 4 lines · Bruno Prémont

My laptop (Acer Travelmate 660) always cuts the power when rebooting which causes the disk to emergency-park it's head.

Add a dmi check to stop disk as for shutdown on this laptop.

Hmm... yeah, I also noticed this behavior on several machines I have here. Most were beta BIOSen.

Maybe it's worth to shutdown drives on reboot on all machines?

Thanks.

Signature · 5 lines
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

Re: [PATCH 1/2] ide: Stop disks on reboot for laptop which cuts power

Quoted 4 lines · On Mon, 20 Apr 2009 16:51:57 Tejun Heo <[email protected]> wrote:
Quoted 3 lines · Bruno Prémont

My laptop (Acer Travelmate 660) always cuts the power when rebooting which causes the disk to emergency-park it's head.

Quoted 8 lines
Quoted 1 line

Add a dmi check to stop disk as for shutdown on this laptop.

Hmm... yeah, I also noticed this behavior on several machines I have here. Most were beta BIOSen.

Maybe it's worth to shutdown drives on reboot on all machines?

Thanks.

I will check how my other machines behave but I don't remember such a power-down behavior.
Except for a spin-down - spin-up cycle a generalization should not cause troubles though. (I vaguely remember seeing different reboot modes in kernel code - as in colder or hotter reboots - these might also change BIOS behavior where the different modes are implemented and thus cause disk stopping to be needed)

Possibly it depends very much how the power is connected, e.g. desktop boxes with ATX power-supply probably never tell the power-supply to cut the power but laptop may behave differently with regard to their built-in DC-DC converters (disks connected to mainboard versus disks directly connected to power supply).

What I was also wondering whether the list of machines to which to apply the quirk should be moved to a common location so it exists only once for ide and scsi/ata instead of once on each side. Having the list exactly once avoids the risk for content to drift between ide and scsi/ata.

Bruno
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [PATCH 1/2] ide: Stop disks on reboot for laptop which cuts power

Hello,

Quoted 5 lines · Bruno Prémont

Possibly it depends very much how the power is connected, e.g. desktop boxes with ATX power-supply probably never tell the power-supply to cut the power but laptop may behave differently with regard to their built-in DC-DC converters (disks connected to mainboard versus disks directly connected to power supply).

I've seen several desktop motherboards which fully power cycle disks on reboot. Dunno where the difference comes from tho. IIRC, some intel boards seem to do things that way.

Quoted 5 lines

What I was also wondering whether the list of machines to which to apply the quirk should be moved to a common location so it exists only once for ide and scsi/ata instead of once on each side. Having the list exactly once avoids the risk for content to drift between ide and scsi/ata.

Hmmm....

Thanks.

Signature · 1 line
tejun
#5 lore raw

Re: [PATCH 1/2] ide: Stop disks on reboot for laptop which cuts power

In reply to Bruno Prémont
Quoted 6 lines · On Saturday 18 April 2009 12:45:58 Bruno Prémont wrote:

My laptop (Acer Travelmate 660) always cuts the power when rebooting which causes the disk to emergency-park it's head.

Add a dmi check to stop disk as for shutdown on this laptop.

applied
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw

PATCH 2/2 sd: Stop disks on reboot for laptop which cuts power

In reply to Bruno Prémont

My laptop (Acer Travelmate 660) always cuts the power when rebooting which causes the disk to emergency-park it's head.

Add a dmi check to stop disk as for shutdown on this laptop.

---

drivers/scsi/sd.c +18 -1
index 3fcb64b..fdad8bc 100644
@@ -50,6 +50,7 @@
 #include <linux/string_helpers.h>
 #include <linux/async.h>
 #include <asm/uaccess.h>
+#include <linux/dmi.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
@@ -2127,6 +2128,20 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start)
 	return res;
 }
 
+static const struct dmi_system_id sd_coldreboot_table[] = {
+	{
+		/* Acer TravelMate 66x cuts power during reboot */
+		.ident   = "Acer TravelMate 660",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
+		},
+	},
+
+	{ }	/* terminate list */
+};
+
+
 /*
  * Send a SYNCHRONIZE CACHE instruction down to the device through
  * the normal SCSI command structure.  Wait for the command to
@@ -2144,7 +2159,9 @@ static void sd_shutdown(struct device *dev)
 		sd_sync_cache(sdkp);
 	}
 
-	if (system_state != SYSTEM_RESTART && sdkp->device->manage_start_stop) {
+	if (sdkp->device->manage_start_stop &&
+	    (system_state != SYSTEM_RESTART ||
+	    dmi_check_system(sd_coldreboot_table))) {
 		sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
 		sd_start_stop_device(sdkp, 0);
 	}