Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-10 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/10/2014 12:23 AM, Douglas Gilbert wrote: > It is a command in the "Sense Data Reporting feature set" which is > optional for ATA devices and "P" as in "Prohibited" for ATAPI > devices. See the Feature set summary table. Oops, you're right. > You

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-09 Thread Douglas Gilbert
On 14-01-09 02:20 PM, Phillip Susi wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/9/2014 1:29 PM, Douglas Gilbert wrote: When REQUEST SENSE had its original semantics, TEST UNIT READY was the only game in town for monitoring power management. From my reading of spc4r36n.pdf section

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-09 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/9/2014 1:29 PM, Douglas Gilbert wrote: > When REQUEST SENSE had its original semantics, TEST UNIT READY was > the only game in town for monitoring power management. From my > reading of spc4r36n.pdf section 5.1.2 "Important commands for all > SCS

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-09 Thread Douglas Gilbert
On 14-01-07 10:40 AM, Phillip Susi wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/7/2014 10:20 AM, Alan Stern wrote: This raises two questions: Should the host's resume be allowed to complete while the host is still in error recovery? Wouldn't it be better to wait until the recover

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-09 Thread Alan Stern
On Thu, 9 Jan 2014, Phillip Susi wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 1/9/2014 11:14 AM, Alan Stern wrote: > > That's true, but it isn't a problem. We know that requests with > > REQ_PM are sent only at certain, controlled times. In particular, > > the only time such

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-09 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/9/2014 11:14 AM, Alan Stern wrote: > That's true, but it isn't a problem. We know that requests with > REQ_PM are sent only at certain, controlled times. In particular, > the only time such a request would be sent while the disk is > RPM_SUSPEND

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-09 Thread Alan Stern
On Thu, 9 Jan 2014, Phillip Susi wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 1/9/2014 10:40 AM, Alan Stern wrote: > > We should change the code in the block layer. blk_pm_peek_request > > should allow requests with REQ_PM set to go through, no matter > > what the rpm_status

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-09 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/9/2014 10:40 AM, Alan Stern wrote: > We should change the code in the block layer. blk_pm_peek_request > should allow requests with REQ_PM set to go through, no matter > what the rpm_status is. Then the disk driver could query the disk > (to se

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-09 Thread Alan Stern
On Thu, 9 Jan 2014, Aaron Lu wrote: > > It's a knotty situation. The only way to find out whether the disk is > > spinning is to ask it, which requires doing I/O, which requires > > spinning up the disk. Maybe we need to add a mechanism to the block > > layer's runtime PM implementation for addr

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-09 Thread Rafael J. Wysocki
On Thursday, January 09, 2014 01:17:12 PM Rafael J. Wysocki wrote: > On Thursday, January 09, 2014 09:29:59 AM Aaron Lu wrote: > > On 01/09/2014 05:21 AM, Alan Stern wrote: > > > On Wed, 8 Jan 2014, Phillip Susi wrote: > > >> You issue a REQUEST SENSE command and that returns status indicating > >

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-09 Thread Rafael J. Wysocki
On Thursday, January 09, 2014 09:29:59 AM Aaron Lu wrote: > On 01/09/2014 05:21 AM, Alan Stern wrote: > > On Wed, 8 Jan 2014, Phillip Susi wrote: > >> You issue a REQUEST SENSE command and that returns status indicating > >> whether the drive is stopped, or in standby. See my patches. One of > >

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-08 Thread Aaron Lu
On 01/09/2014 05:21 AM, Alan Stern wrote: > On Wed, 8 Jan 2014, Phillip Susi wrote: >> You issue a REQUEST SENSE command and that returns status indicating >> whether the drive is stopped, or in standby. See my patches. One of > > I never saw your patches. Where were they posted? > > If you is

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-08 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/8/2014 4:21 PM, Alan Stern wrote: > I never saw your patches. Where were they posted? Higher up in this thread on linux-ide and linux-scsi. Subject was Let sleeping disks lie. > If you issue the REQUEST SENSE command in the usual way (going >

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-08 Thread Alan Stern
On Wed, 8 Jan 2014, Phillip Susi wrote: > > In essence, you want your disk's state to move directly from > > unpowered (system asleep) to runtime-suspended with no intermediate > > active -- but only if the disk doesn't spin up all by itself. > > > > One problem: How can the kernel tell whether t

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-08 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/8/2014 12:46 PM, Alan Stern wrote: > I/O _was_ done. To spin up the disk requires sending it a START > command. That's I/O. Yes, currently, but that's exactly what I'm trying to get rid of. > In essence, you want your disk's state to move dir

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-08 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/8/2014 2:00 AM, Aaron Lu wrote: > Then I would say we just keep the pm_request_resume call in their > system resume callback. For drives that have that cool feature > turned on, it will be in runtime active state while it's actually > in standby m

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-08 Thread Alan Stern
On Wed, 8 Jan 2014, Alan Stern wrote: > In essence, you want your disk's state to move directly from unpowered > (system asleep) to runtime-suspended with no intermediate active -- but > only if the disk doesn't spin up all by itself. > In the end, it sounds like what you want can be done fairly

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-08 Thread Alan Stern
On Tue, 7 Jan 2014, Phillip Susi wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA512 > > On 01/07/2014 02:18 PM, Alan Stern wrote: > > I don't know how you manually spin down your disk, but one > > reasonable way to do it is to set the autosuspend timeout to 0. If > > you use this approac

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Aaron Lu
On 01/08/2014 01:24 PM, Phillip Susi wrote: > On 01/07/2014 09:36 PM, Aaron Lu wrote: >> Oh, of course, my stupid :-) Then I suddenly think my patches can >> kind of work - let's say we have done the hdparm setting thing >> before suspend and the disk will be spun up in standby mode next >> time it

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 01/07/2014 09:36 PM, Aaron Lu wrote: > I think the host controller can decide not to power all its ports, > only when a specific reg in the port's memory range is set, it will > give power to that port and thus spin up the drive. Makes sense? The

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Aaron Lu
On 01/08/2014 10:19 AM, Phillip Susi wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA512 > > On 01/07/2014 09:11 PM, Aaron Lu wrote: >> I thought that feature is used to control if a disk should be spun >> up once powered from the host side. > > That *is* what it sounds like, only ATA disk

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 01/07/2014 09:11 PM, Aaron Lu wrote: > I thought that feature is used to control if a disk should be spun > up once powered from the host side. That *is* what it sounds like, only ATA disks either spin up as soon as power is applied, or wait for

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Aaron Lu
On 01/08/2014 09:53 AM, Phillip Susi wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA512 > > On 01/07/2014 08:32 PM, Aaron Lu wrote: >> The ATA and SCSI devices are all resumed in my patches, notice >> there is a single pm_request_resume call in both ATA and SCSI's >> system resume callback

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 01/07/2014 08:32 PM, Aaron Lu wrote: > The ATA and SCSI devices are all resumed in my patches, notice > there is a single pm_request_resume call in both ATA and SCSI's > system resume callback, so the runtime status and the disk's state > is synce

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Aaron Lu
On 01/08/2014 09:16 AM, Phillip Susi wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA512 > > On 01/07/2014 08:03 PM, Aaron Lu wrote: >> You mean you want to leave the disk runtime suspended after a >> system resume and in the meantime make sure the disk is indeed not >> spun up? > > Yep.

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 01/07/2014 08:03 PM, Aaron Lu wrote: > You mean you want to leave the disk runtime suspended after a > system resume and in the meantime make sure the disk is indeed not > spun up? Yep. If it is spun up, then the runtime status should be updated

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Aaron Lu
On 01/07/2014 10:50 PM, Phillip Susi wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 1/7/2014 2:49 AM, Aaron Lu wrote: >> We can modify the device's system resume callback. To better >> illustrate the idea, I just made two patches to do this and I did >> some quick tests and didn't

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 01/07/2014 02:18 PM, Alan Stern wrote: > I don't know how you manually spin down your disk, but one > reasonable way to do it is to set the autosuspend timeout to 0. If > you use this approach and apply my patch, the disk should remain > spun dow

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Alan Stern
On Tue, 7 Jan 2014, Phillip Susi wrote: > On 1/7/2014 1:05 PM, Alan Stern wrote: > > I disagree with your argument. If you aren't using autosuspend at > > all then you don't mind having your disks spin all the time. > > Therefore you don't mind if the disks spin up during system > > resume. > >

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/7/2014 1:05 PM, Alan Stern wrote: > I disagree with your argument. If you aren't using autosuspend at > all then you don't mind having your disks spin all the time. > Therefore you don't mind if the disks spin up during system > resume. I prefer

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Alan Stern
On Tue, 7 Jan 2014, Phillip Susi wrote: > On 1/7/2014 11:08 AM, Alan Stern wrote: > > Okay, that's a different matter. There's a much simpler way to > > accomplish this. The patch below will avoid spinning up drives > > that were already in runtime suspend when the system sleep started. > > (I

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/7/2014 11:08 AM, Alan Stern wrote: > Okay, that's a different matter. There's a much simpler way to > accomplish this. The patch below will avoid spinning up drives > that were already in runtime suspend when the system sleep started. > (If a

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Alan Stern
On Tue, 7 Jan 2014, Phillip Susi wrote: > On 1/7/2014 10:25 AM, Alan Stern wrote: > > This doesn't seem like a good idea. The way to speed up resumes is > > to allow sd's resume routine to return while the disk is still > > spinning up (i.e., make the spin-up asynchronous). There already > > hav

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Alan Stern
On Tue, 7 Jan 2014, Phillip Susi wrote: > On 1/7/2014 10:20 AM, Alan Stern wrote: > > This raises two questions: > > > > Should the host's resume be allowed to complete while the host is > > still in error recovery? Wouldn't it be better to wait until the > > recovery is finished? > > Ahh, righ

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/7/2014 10:25 AM, Alan Stern wrote: > This doesn't seem like a good idea. The way to speed up resumes is > to allow sd's resume routine to return while the disk is still > spinning up (i.e., make the spin-up asynchronous). There already > have be

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/7/2014 10:20 AM, Alan Stern wrote: > This raises two questions: > > Should the host's resume be allowed to complete while the host is > still in error recovery? Wouldn't it be better to wait until the > recovery is finished? Ahh, right, my othe

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Alan Stern
On Tue, 7 Jan 2014, Aaron Lu wrote: > From: Aaron Lu > Date: Tue, 7 Jan 2014 15:02:13 +0800 > Subject: [PATCH 1/2] SCSI: pm: make use of runtime PM for SCSI device > > To make system resume fast, modify SCSI PM callbacks so that if > CONFIG_PM_RUNTIME is set, during a system suspend transition,

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Alan Stern
On Mon, 6 Jan 2014, Phillip Susi wrote: > On 01/06/2014 10:38 AM, Alan Stern wrote: > > Indeed. I can't see any place where the SCSI or block layers > > would stop the queue of a device when it gets runtime suspended. > > Maybe some other layer is doing this. > > So I've stepped through it in qe

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-07 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/7/2014 2:49 AM, Aaron Lu wrote: > We can modify the device's system resume callback. To better > illustrate the idea, I just made two patches to do this and I did > some quick tests and didn't find anything wrong. That misses one key aspect I was

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-06 Thread Aaron Lu
On 01/06/2014 10:40 PM, Phillip Susi wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 1/6/2014 4:15 AM, Aaron Lu wrote: >> My guess why it doesn't work for you is that, when you call >> blk_pre_runtime_suspend in sd_resume_work, there are requests left >> in the queue so that call

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-06 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 01/06/2014 10:38 AM, Alan Stern wrote: > Indeed. I can't see any place where the SCSI or block layers > would stop the queue of a device when it gets runtime suspended. > Maybe some other layer is doing this. So I've stepped through it in qemu a

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-06 Thread Alan Stern
On Mon, 6 Jan 2014, Phillip Susi wrote: > The issue is that the REQ_PM flagged REQUEST SENSE command issued > during the system_resume is never dispatched. I patched scsi_execute > to make the request type REQ_TYPE_PM_RESUME and that got the request > dispatched. Note that REQ_TYPE_PM_RESUME is

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-06 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/6/2014 4:15 AM, Aaron Lu wrote: > My guess why it doesn't work for you is that, when you call > blk_pre_runtime_suspend in sd_resume_work, there are requests left > in the queue so that call will simply fail, it's not meant to be > used that way.

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-06 Thread Aaron Lu
On 01/06/2014 03:36 PM, Sujit Reddy Thumma wrote: > On 1/6/2014 7:44 AM, Phillip Susi wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA512 >> >> On 12/16/2013 06:30 PM, Phillip Susi wrote: >>> For some reason, the system hangs on resume if I issue the REQUEST >>> SENSE command after blk_pre

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-05 Thread Sujit Reddy Thumma
On 1/6/2014 7:44 AM, Phillip Susi wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 12/16/2013 06:30 PM, Phillip Susi wrote: For some reason, the system hangs on resume if I issue the REQUEST SENSE command after blk_pre_runtime_suspend. My understanding is that the REQ_PM flag should m

Re: REQ_PM vs REQ_TYPE_PM_RESUME

2014-01-05 Thread Phillip Susi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 12/16/2013 06:30 PM, Phillip Susi wrote: > For some reason, the system hangs on resume if I issue the REQUEST > SENSE command after blk_pre_runtime_suspend. My understanding is > that the REQ_PM flag should make the command process even though >