linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Stop disks on reboot for laptop which cuts power
@ 2009-04-18 10:44 Bruno Prémont
  2009-04-18 10:45 ` [PATCH 1/2] ide: " Bruno Prémont
  2009-04-18 10:47 ` [PATCH 2/2] sd: " Bruno Prémont
  0 siblings, 2 replies; 7+ messages in thread
From: Bruno Prémont @ 2009-04-18 10:44 UTC (permalink / raw)
  To: Linux IDE, Bartlomiej Zolnierkiewicz, Jeff Garzik
  Cc: Linux Kernel, Linux SCSI

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] ide: Stop disks on reboot for laptop which cuts power
  2009-04-18 10:44 [PATCH 0/2] Stop disks on reboot for laptop which cuts power Bruno Prémont
@ 2009-04-18 10:45 ` Bruno Prémont
  2009-04-20  7:51   ` Tejun Heo
  2009-04-22 18:28   ` Bartlomiej Zolnierkiewicz
  2009-04-18 10:47 ` [PATCH 2/2] sd: " Bruno Prémont
  1 sibling, 2 replies; 7+ messages in thread
From: Bruno Prémont @ 2009-04-18 10:45 UTC (permalink / raw)
  To: Linux IDE, Bartlomiej Zolnierkiewicz
  Cc: Jeff Garzik, Linux Kernel, Linux SCSI

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.

Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
---
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c
index 1aebdf1..4b6b71e 100644
--- a/drivers/ide/ide-gd.c
+++ b/drivers/ide/ide-gd.c
@@ -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;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] sd: Stop disks on reboot for laptop which cuts power
  2009-04-18 10:44 [PATCH 0/2] Stop disks on reboot for laptop which cuts power Bruno Prémont
  2009-04-18 10:45 ` [PATCH 1/2] ide: " Bruno Prémont
@ 2009-04-18 10:47 ` Bruno Prémont
  1 sibling, 0 replies; 7+ messages in thread
From: Bruno Prémont @ 2009-04-18 10:47 UTC (permalink / raw)
  To: Jeff Garzik, Linux SCSI
  Cc: Linux IDE, Bartlomiej Zolnierkiewicz, Linux Kernel

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.

Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
---
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 3fcb64b..fdad8bc 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -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);
 	}

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] ide: Stop disks on reboot for laptop which cuts power
  2009-04-18 10:45 ` [PATCH 1/2] ide: " Bruno Prémont
@ 2009-04-20  7:51   ` Tejun Heo
  2009-04-20  8:28     ` Bruno Prémont
  2009-04-22 18:28   ` Bartlomiej Zolnierkiewicz
  1 sibling, 1 reply; 7+ messages in thread
From: Tejun Heo @ 2009-04-20  7:51 UTC (permalink / raw)
  To: Bruno Prémont
  Cc: Linux IDE, Bartlomiej Zolnierkiewicz, Jeff Garzik, Linux Kernel,
	Linux SCSI

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.

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.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] ide: Stop disks on reboot for laptop which cuts power
  2009-04-20  7:51   ` Tejun Heo
@ 2009-04-20  8:28     ` Bruno Prémont
  2009-04-20  8:35       ` Tejun Heo
  0 siblings, 1 reply; 7+ messages in thread
From: Bruno Prémont @ 2009-04-20  8:28 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Linux IDE, Bartlomiej Zolnierkiewicz, Jeff Garzik, Linux Kernel,
	Linux SCSI

On Mon, 20 Apr 2009 16:51:57 Tejun Heo <htejun@gmail.com> wrote:
> 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.
> 
> 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] ide: Stop disks on reboot for laptop which cuts power
  2009-04-20  8:28     ` Bruno Prémont
@ 2009-04-20  8:35       ` Tejun Heo
  0 siblings, 0 replies; 7+ messages in thread
From: Tejun Heo @ 2009-04-20  8:35 UTC (permalink / raw)
  To: Bruno Prémont
  Cc: Linux IDE, Bartlomiej Zolnierkiewicz, Jeff Garzik, Linux Kernel,
	Linux SCSI

Hello,

Bruno Prémont wrote:
> 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.

> 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.

-- 
tejun

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] ide: Stop disks on reboot for laptop which cuts power
  2009-04-18 10:45 ` [PATCH 1/2] ide: " Bruno Prémont
  2009-04-20  7:51   ` Tejun Heo
@ 2009-04-22 18:28   ` Bartlomiej Zolnierkiewicz
  1 sibling, 0 replies; 7+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-04-22 18:28 UTC (permalink / raw)
  To: Bruno Prémont; +Cc: Linux IDE, Jeff Garzik, Linux Kernel, Linux SCSI

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.
> 
> Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-04-22 18:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-18 10:44 [PATCH 0/2] Stop disks on reboot for laptop which cuts power Bruno Prémont
2009-04-18 10:45 ` [PATCH 1/2] ide: " Bruno Prémont
2009-04-20  7:51   ` Tejun Heo
2009-04-20  8:28     ` Bruno Prémont
2009-04-20  8:35       ` Tejun Heo
2009-04-22 18:28   ` Bartlomiej Zolnierkiewicz
2009-04-18 10:47 ` [PATCH 2/2] sd: " Bruno Prémont

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).