Skip to contentSkip to conversation

SCSI midlayer power management

PATCH In review Nathan Bryant 3 participants 4 messages Aug 10, 2004 – Aug 11, 2004 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SCSI midlayer power management

Hi,

This proposed patch implements enough power-management support within the SCSI midlayer to get ACPI S3 working on my system. Changes as follows:

* Add generic_scsi_{suspend,resume} methods to scsi.c
* Add suspend and resume callbacks to the scsi_driver structure, and implement those callbacks in sd.c
* In sd.c, we call sd_shutdown on suspend, in order to synchronize the write-back cache.
* In sd.c, we call sd_rescan from sd_resume in order to ensure that drives have spun up and avoid passing not ready errors back to the block layer.
* In generic_scsi_suspend, we call scsi_device_quiesce before calling the scsi_driver suspend callback. We resume from quiesce state in reverse order in generic_scsi_resume.

ACPI S1 and S4/swsusp are untested, but I think there should be no regressions with S1. To do S1 properly, we probably need to tell the drive to spin down, and I don't know what the SCSI command is for that... For S4, the call to scsi_device_quiesce might pose a problem for the subsequent state dump to disk. But I'm not sure swsusp ever worked for SCSI.

This might help SATA drives, too, but I seem to remember that the SATA layer doesn't properly emulate the SYNCHRONIZE_CACHE command.

Comments, anybody? Can this be applied upstream? I think it's a step in the right direction.

Applies to scsi-misc-2.6

Nathan

#1 lore raw
Quoted 2 lines · Nathan Bryant

This might help SATA drives, too, but I seem to remember that the SATA layer doesn't properly emulate the SYNCHRONIZE_CACHE command.

That was something Mark Lord reported higher level I suspect - which is that the scsi path is disabled before the sync cache command is sent so the command is always errored before it hits the drive

#2 lore raw
Quoted 12 lines · Alan Cox
Quoted 3 lines · Nathan Bryant

This might help SATA drives, too, but I seem to remember that the SATA layer doesn't properly emulate the SYNCHRONIZE_CACHE command.

That was something Mark Lord reported higher level I suspect - which is that the scsi path is disabled before the sync cache command is sent so the command is always errored before it hits the drive

That applies to shutdown, I have no idea whether it also applies to suspend.

Thanks
Nathan

#3 lore raw
In reply to Alan Cox
Quoted 3 lines · Alan Cox

That was something Mark Lord reported higher level I suspect - which is that the scsi path is disabled before the sync cache command is sent so the command is always errored before it hits the drive

Yes, this one's my fault. I have patches to fix this, I never got around to merging them. Randy was on at me yesterday about this too. I'll dig them out. (The problem is that last sync is sent in SDEV_DEL state, so it gets rejected).

James