public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
  2006-03-23 12:06 ` Andrew Morton
@ 2006-03-22 23:26   ` Pavel Machek
  2006-03-23 12:16   ` Nigel Cunningham
  1 sibling, 0 replies; 10+ messages in thread
From: Pavel Machek @ 2006-03-22 23:26 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Nigel Cunningham, linux-kernel, Jeff Garzik

Gi!

> > At the moment libata doesn't pass pm_message_t down ata_device_suspend.
> >  This causes drives to be powered down when we just want a freeze,
> >  causing unnecessary wear and tear. This patch gets pm_message_t passed
> >  down so that it can be used to determine whether to power down the
> >  drive.
> 
> Does this explain http://bugzilla.kernel.org/show_bug.cgi?id=6264 ?
> 
> This might be 2.6.16.1 material - how irritating is it?

I'd say patch is okay for mainline, but not worth it for 2.6.16.1 ---
we have lived with similar problem for quite a long time for PATA.


-- 
Thanks, Sharp!

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

* [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
@ 2006-03-23 11:51 Nigel Cunningham
  2006-03-23 12:06 ` Andrew Morton
  2006-03-23 13:09 ` Jens Axboe
  0 siblings, 2 replies; 10+ messages in thread
From: Nigel Cunningham @ 2006-03-23 11:51 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 4320 bytes --]

Hi.

At the moment libata doesn't pass pm_message_t down ata_device_suspend.
This causes drives to be powered down when we just want a freeze,
causing unnecessary wear and tear. This patch gets pm_message_t passed
down so that it can be used to determine whether to power down the
drive.

Prepared against git at the time of writing. Please apply.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

 drivers/scsi/libata-core.c |    5 +++--
 drivers/scsi/libata-scsi.c |    2 +-
 drivers/scsi/scsi_sysfs.c  |    2 +-
 include/linux/libata.h     |    4 ++--
 include/scsi/scsi_host.h   |    2 +-
 5 files changed, 8 insertions(+), 7 deletions(-)
diff -ruNp 9904-libata-freeze.patch-old/drivers/scsi/libata-core.c 9904-libata-freeze.patch-new/drivers/scsi/libata-core.c
--- 9904-libata-freeze.patch-old/drivers/scsi/libata-core.c	2006-03-23 21:49:06.000000000 +1000
+++ 9904-libata-freeze.patch-new/drivers/scsi/libata-core.c	2006-03-23 21:16:55.000000000 +1000
@@ -4506,14 +4506,15 @@ int ata_device_resume(struct ata_port *a
  *	Flush the cache on the drive, if appropriate, then issue a
  *	standbynow command.
  */
-int ata_device_suspend(struct ata_port *ap, struct ata_device *dev)
+int ata_device_suspend(struct ata_port *ap, struct ata_device *dev, pm_message_t state)
 {
 	if (!ata_dev_present(dev))
 		return 0;
 	if (dev->class == ATA_DEV_ATA)
 		ata_flush_cache(ap, dev);
 
-	ata_standby_drive(ap, dev);
+	if (state.event != PM_EVENT_FREEZE)
+		ata_standby_drive(ap, dev);
 	ap->flags |= ATA_FLAG_SUSPENDED;
 	return 0;
 }
diff -ruNp 9904-libata-freeze.patch-old/drivers/scsi/libata-scsi.c 9904-libata-freeze.patch-new/drivers/scsi/libata-scsi.c
--- 9904-libata-freeze.patch-old/drivers/scsi/libata-scsi.c	2006-03-23 21:16:22.000000000 +1000
+++ 9904-libata-freeze.patch-new/drivers/scsi/libata-scsi.c	2006-03-23 21:24:06.000000000 +1000
@@ -419,7 +419,7 @@ int ata_scsi_device_suspend(struct scsi_
 	struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0];
 	struct ata_device *dev = &ap->device[sdev->id];
 
-	return ata_device_suspend(ap, dev);
+	return ata_device_suspend(ap, dev, state);
 }
 
 /**
diff -ruNp 9904-libata-freeze.patch-old/drivers/scsi/scsi_sysfs.c 9904-libata-freeze.patch-new/drivers/scsi/scsi_sysfs.c
--- 9904-libata-freeze.patch-old/drivers/scsi/scsi_sysfs.c	2006-03-23 14:49:53.000000000 +1000
+++ 9904-libata-freeze.patch-new/drivers/scsi/scsi_sysfs.c	2006-03-23 21:08:01.000000000 +1000
@@ -286,7 +286,7 @@ static int scsi_bus_suspend(struct devic
 		return err;
 
 	if (sht->suspend)
-		err = sht->suspend(sdev);
+		err = sht->suspend(sdev, state);
 
 	return err;
 }
diff -ruNp 9904-libata-freeze.patch-old/include/linux/libata.h 9904-libata-freeze.patch-new/include/linux/libata.h
--- 9904-libata-freeze.patch-old/include/linux/libata.h	2006-03-23 14:50:10.000000000 +1000
+++ 9904-libata-freeze.patch-new/include/linux/libata.h	2006-03-23 21:23:31.000000000 +1000
@@ -515,9 +515,9 @@ extern void ata_eh_qc_retry(struct ata_q
 extern int ata_scsi_release(struct Scsi_Host *host);
 extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
 extern int ata_scsi_device_resume(struct scsi_device *);
-extern int ata_scsi_device_suspend(struct scsi_device *);
+extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state);
 extern int ata_device_resume(struct ata_port *, struct ata_device *);
-extern int ata_device_suspend(struct ata_port *, struct ata_device *);
+extern int ata_device_suspend(struct ata_port *, struct ata_device *, pm_message_t state);
 extern int ata_ratelimit(void);
 extern unsigned int ata_busy_sleep(struct ata_port *ap,
 				   unsigned long timeout_pat,
diff -ruNp 9904-libata-freeze.patch-old/include/scsi/scsi_host.h 9904-libata-freeze.patch-new/include/scsi/scsi_host.h
--- 9904-libata-freeze.patch-old/include/scsi/scsi_host.h	2006-03-23 14:50:12.000000000 +1000
+++ 9904-libata-freeze.patch-new/include/scsi/scsi_host.h	2006-03-23 21:08:57.000000000 +1000
@@ -286,7 +286,7 @@ struct scsi_host_template {
 	 * suspend support
 	 */
 	int (*resume)(struct scsi_device *);
-	int (*suspend)(struct scsi_device *);
+	int (*suspend)(struct scsi_device *, pm_message_t state);
 
 	/*
 	 * Name of proc directory

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
  2006-03-23 11:51 [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE Nigel Cunningham
@ 2006-03-23 12:06 ` Andrew Morton
  2006-03-22 23:26   ` Pavel Machek
  2006-03-23 12:16   ` Nigel Cunningham
  2006-03-23 13:09 ` Jens Axboe
  1 sibling, 2 replies; 10+ messages in thread
From: Andrew Morton @ 2006-03-23 12:06 UTC (permalink / raw)
  To: Nigel Cunningham; +Cc: linux-kernel, Jeff Garzik

Nigel Cunningham <ncunningham@cyclades.com> wrote:
>
> At the moment libata doesn't pass pm_message_t down ata_device_suspend.
>  This causes drives to be powered down when we just want a freeze,
>  causing unnecessary wear and tear. This patch gets pm_message_t passed
>  down so that it can be used to determine whether to power down the
>  drive.

Does this explain http://bugzilla.kernel.org/show_bug.cgi?id=6264 ?

This might be 2.6.16.1 material - how irritating is it?

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

* Re: [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
  2006-03-23 12:06 ` Andrew Morton
  2006-03-22 23:26   ` Pavel Machek
@ 2006-03-23 12:16   ` Nigel Cunningham
  1 sibling, 0 replies; 10+ messages in thread
From: Nigel Cunningham @ 2006-03-23 12:16 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Jeff Garzik

[-- Attachment #1: Type: text/plain, Size: 818 bytes --]

Hi.

On Thursday 23 March 2006 22:06, Andrew Morton wrote:
> Nigel Cunningham <ncunningham@cyclades.com> wrote:
> > At the moment libata doesn't pass pm_message_t down ata_device_suspend.
> >  This causes drives to be powered down when we just want a freeze,
> >  causing unnecessary wear and tear. This patch gets pm_message_t passed
> >  down so that it can be used to determine whether to power down the
> >  drive.
>
> Does this explain http://bugzilla.kernel.org/show_bug.cgi?id=6264 ?

Yes, it does.

> This might be 2.6.16.1 material - how irritating is it?

Very. It extends the time to write the image, but as mentioned above, I'm more 
concerned by the fact that (assuming I understand correctly), it's using up 
the limited number of power cycles a drive can handle.

Regards,

Nigel

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
  2006-03-23 11:51 [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE Nigel Cunningham
  2006-03-23 12:06 ` Andrew Morton
@ 2006-03-23 13:09 ` Jens Axboe
  2006-03-23 13:20   ` Nigel Cunningham
  2006-03-23 13:22   ` Nigel Cunningham
  1 sibling, 2 replies; 10+ messages in thread
From: Jens Axboe @ 2006-03-23 13:09 UTC (permalink / raw)
  To: Nigel Cunningham; +Cc: linux-kernel

On Thu, Mar 23 2006, Nigel Cunningham wrote:
> diff -ruNp 9904-libata-freeze.patch-old/drivers/scsi/libata-scsi.c 9904-libata-freeze.patch-new/drivers/scsi/libata-scsi.c
> --- 9904-libata-freeze.patch-old/drivers/scsi/libata-scsi.c	2006-03-23 21:16:22.000000000 +1000
> +++ 9904-libata-freeze.patch-new/drivers/scsi/libata-scsi.c	2006-03-23 21:24:06.000000000 +1000
> @@ -419,7 +419,7 @@ int ata_scsi_device_suspend(struct scsi_
>  	struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0];
>  	struct ata_device *dev = &ap->device[sdev->id];
>  
> -	return ata_device_suspend(ap, dev);
> +	return ata_device_suspend(ap, dev, state);
>  }

Eh this looks odd, you are forgetting to add pm_message_t state as an
extra argument to that function.

Apart from that, patch looks good. It should definitely be included
asap.

-- 
Jens Axboe


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

* Re: [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
  2006-03-23 13:09 ` Jens Axboe
@ 2006-03-23 13:20   ` Nigel Cunningham
  2006-03-23 13:22   ` Nigel Cunningham
  1 sibling, 0 replies; 10+ messages in thread
From: Nigel Cunningham @ 2006-03-23 13:20 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 975 bytes --]

Hi.

On Thursday 23 March 2006 23:09, Jens Axboe wrote:
> On Thu, Mar 23 2006, Nigel Cunningham wrote:
> > diff -ruNp 9904-libata-freeze.patch-old/drivers/scsi/libata-scsi.c
> > 9904-libata-freeze.patch-new/drivers/scsi/libata-scsi.c ---
> > 9904-libata-freeze.patch-old/drivers/scsi/libata-scsi.c	2006-03-23
> > 21:16:22.000000000 +1000 +++
> > 9904-libata-freeze.patch-new/drivers/scsi/libata-scsi.c	2006-03-23
> > 21:24:06.000000000 +1000 @@ -419,7 +419,7 @@ int
> > ata_scsi_device_suspend(struct scsi_
> >  	struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0];
> >  	struct ata_device *dev = &ap->device[sdev->id];
> >
> > -	return ata_device_suspend(ap, dev);
> > +	return ata_device_suspend(ap, dev, state);
> >  }
>
> Eh this looks odd, you are forgetting to add pm_message_t state as an
> extra argument to that function.
>
> Apart from that, patch looks good. It should definitely be included
> asap.

Good catch! Fixed, will resend.

Thanks!

Nigel

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
  2006-03-23 13:09 ` Jens Axboe
  2006-03-23 13:20   ` Nigel Cunningham
@ 2006-03-23 13:22   ` Nigel Cunningham
  2006-03-23 13:52     ` Jeff Garzik
  1 sibling, 1 reply; 10+ messages in thread
From: Nigel Cunningham @ 2006-03-23 13:22 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 4505 bytes --]

Hi.

At the moment libata doesn't pass pm_message_t down ata_device_suspend.
This causes drives to be powered down when we just want a freeze,
causing unnecessary wear and tear. This patch gets pm_message_t passed
down so that it can be used to determine whether to power down the
drive.

Prepared against git at the time of writing. Please apply.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

 drivers/scsi/libata-core.c |    5 +++--
 drivers/scsi/libata-scsi.c |    4 ++--
 drivers/scsi/scsi_sysfs.c  |    2 +-
 include/linux/libata.h     |    4 ++--
 include/scsi/scsi_host.h   |    2 +-
 5 files changed, 9 insertions(+), 8 deletions(-)
diff -ruNp 9904-libata-freeze.patch-old/drivers/scsi/libata-core.c 9904-libata-freeze.patch-new/drivers/scsi/libata-core.c
--- 9904-libata-freeze.patch-old/drivers/scsi/libata-core.c	2006-03-23 23:19:36.000000000 +1000
+++ 9904-libata-freeze.patch-new/drivers/scsi/libata-core.c	2006-03-23 21:53:09.000000000 +1000
@@ -4506,14 +4506,15 @@ int ata_device_resume(struct ata_port *a
  *	Flush the cache on the drive, if appropriate, then issue a
  *	standbynow command.
  */
-int ata_device_suspend(struct ata_port *ap, struct ata_device *dev)
+int ata_device_suspend(struct ata_port *ap, struct ata_device *dev, pm_message_t state)
 {
 	if (!ata_dev_present(dev))
 		return 0;
 	if (dev->class == ATA_DEV_ATA)
 		ata_flush_cache(ap, dev);
 
-	ata_standby_drive(ap, dev);
+	if (state.event != PM_EVENT_FREEZE)
+		ata_standby_drive(ap, dev);
 	ap->flags |= ATA_FLAG_SUSPENDED;
 	return 0;
 }
diff -ruNp 9904-libata-freeze.patch-old/drivers/scsi/libata-scsi.c 9904-libata-freeze.patch-new/drivers/scsi/libata-scsi.c
--- 9904-libata-freeze.patch-old/drivers/scsi/libata-scsi.c	2006-03-23 14:49:52.000000000 +1000
+++ 9904-libata-freeze.patch-new/drivers/scsi/libata-scsi.c	2006-03-23 23:19:23.000000000 +1000
@@ -414,12 +414,12 @@ int ata_scsi_device_resume(struct scsi_d
 	return ata_device_resume(ap, dev);
 }
 
-int ata_scsi_device_suspend(struct scsi_device *sdev)
+int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t state)
 {
 	struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0];
 	struct ata_device *dev = &ap->device[sdev->id];
 
-	return ata_device_suspend(ap, dev);
+	return ata_device_suspend(ap, dev, state);
 }
 
 /**
diff -ruNp 9904-libata-freeze.patch-old/drivers/scsi/scsi_sysfs.c 9904-libata-freeze.patch-new/drivers/scsi/scsi_sysfs.c
--- 9904-libata-freeze.patch-old/drivers/scsi/scsi_sysfs.c	2006-03-23 14:49:53.000000000 +1000
+++ 9904-libata-freeze.patch-new/drivers/scsi/scsi_sysfs.c	2006-03-23 21:53:09.000000000 +1000
@@ -286,7 +286,7 @@ static int scsi_bus_suspend(struct devic
 		return err;
 
 	if (sht->suspend)
-		err = sht->suspend(sdev);
+		err = sht->suspend(sdev, state);
 
 	return err;
 }
diff -ruNp 9904-libata-freeze.patch-old/include/linux/libata.h 9904-libata-freeze.patch-new/include/linux/libata.h
--- 9904-libata-freeze.patch-old/include/linux/libata.h	2006-03-23 14:50:10.000000000 +1000
+++ 9904-libata-freeze.patch-new/include/linux/libata.h	2006-03-23 21:53:09.000000000 +1000
@@ -515,9 +515,9 @@ extern void ata_eh_qc_retry(struct ata_q
 extern int ata_scsi_release(struct Scsi_Host *host);
 extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
 extern int ata_scsi_device_resume(struct scsi_device *);
-extern int ata_scsi_device_suspend(struct scsi_device *);
+extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state);
 extern int ata_device_resume(struct ata_port *, struct ata_device *);
-extern int ata_device_suspend(struct ata_port *, struct ata_device *);
+extern int ata_device_suspend(struct ata_port *, struct ata_device *, pm_message_t state);
 extern int ata_ratelimit(void);
 extern unsigned int ata_busy_sleep(struct ata_port *ap,
 				   unsigned long timeout_pat,
diff -ruNp 9904-libata-freeze.patch-old/include/scsi/scsi_host.h 9904-libata-freeze.patch-new/include/scsi/scsi_host.h
--- 9904-libata-freeze.patch-old/include/scsi/scsi_host.h	2006-03-23 14:50:12.000000000 +1000
+++ 9904-libata-freeze.patch-new/include/scsi/scsi_host.h	2006-03-23 21:53:09.000000000 +1000
@@ -286,7 +286,7 @@ struct scsi_host_template {
 	 * suspend support
 	 */
 	int (*resume)(struct scsi_device *);
-	int (*suspend)(struct scsi_device *);
+	int (*suspend)(struct scsi_device *, pm_message_t state);
 
 	/*
 	 * Name of proc directory

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
  2006-03-23 13:22   ` Nigel Cunningham
@ 2006-03-23 13:52     ` Jeff Garzik
  2006-03-23 21:01       ` Nigel Cunningham
  0 siblings, 1 reply; 10+ messages in thread
From: Jeff Garzik @ 2006-03-23 13:52 UTC (permalink / raw)
  To: Nigel Cunningham; +Cc: Jens Axboe, linux-kernel

Nigel Cunningham wrote:
> Hi.
> 
> At the moment libata doesn't pass pm_message_t down ata_device_suspend.
> This causes drives to be powered down when we just want a freeze,
> causing unnecessary wear and tear. This patch gets pm_message_t passed
> down so that it can be used to determine whether to power down the
> drive.
> 
> Prepared against git at the time of writing. Please apply.
> 
> Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

I'll put this into the queue for review.

As the top of each source file requests, please CC 
linux-ide@vger.kernel.org and myself on libata changes.

	Jeff




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

* Re: [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
  2006-03-23 13:52     ` Jeff Garzik
@ 2006-03-23 21:01       ` Nigel Cunningham
  2006-03-23 22:45         ` Mark Lord
  0 siblings, 1 reply; 10+ messages in thread
From: Nigel Cunningham @ 2006-03-23 21:01 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Jens Axboe, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 704 bytes --]

Hi.

On Thursday 23 March 2006 23:52, Jeff Garzik wrote:
> Nigel Cunningham wrote:
> > Hi.
> >
> > At the moment libata doesn't pass pm_message_t down ata_device_suspend.
> > This causes drives to be powered down when we just want a freeze,
> > causing unnecessary wear and tear. This patch gets pm_message_t passed
> > down so that it can be used to determine whether to power down the
> > drive.
> >
> > Prepared against git at the time of writing. Please apply.
> >
> > Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
>
> I'll put this into the queue for review.
>
> As the top of each source file requests, please CC
> linux-ide@vger.kernel.org and myself on libata changes.

Ok. Thanks.

Nigel

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE.
  2006-03-23 21:01       ` Nigel Cunningham
@ 2006-03-23 22:45         ` Mark Lord
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Lord @ 2006-03-23 22:45 UTC (permalink / raw)
  To: Nigel Cunningham; +Cc: Jeff Garzik, Jens Axboe, linux-kernel

Nigel Cunningham wrote:
> Hi.
> 
> On Thursday 23 March 2006 23:52, Jeff Garzik wrote:
>> Nigel Cunningham wrote:
>>> Hi.
>>>
>>> At the moment libata doesn't pass pm_message_t down ata_device_suspend.
>>> This causes drives to be powered down when we just want a freeze,
>>> causing unnecessary wear and tear. This patch gets pm_message_t passed
>>> down so that it can be used to determine whether to power down the
>>> drive.
>>>
>>> Prepared against git at the time of writing. Please apply.
>>>
>>> Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

Works very well here for me, and long overdue it was!

Thanks, Nigel!

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

end of thread, other threads:[~2006-03-26 22:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-23 11:51 [PATCH] Make libata not powerdown drivers on PM_EVENT_FREEZE Nigel Cunningham
2006-03-23 12:06 ` Andrew Morton
2006-03-22 23:26   ` Pavel Machek
2006-03-23 12:16   ` Nigel Cunningham
2006-03-23 13:09 ` Jens Axboe
2006-03-23 13:20   ` Nigel Cunningham
2006-03-23 13:22   ` Nigel Cunningham
2006-03-23 13:52     ` Jeff Garzik
2006-03-23 21:01       ` Nigel Cunningham
2006-03-23 22:45         ` Mark Lord

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox