Skip to contentSkip to conversation

libata resume fix

PATCH In review Jeff Garzik 7 participants 10 messages May 28, 2006 – May 31, 2006

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

PATCH 1/1 libata resume fix

Please pull from 'upstream-fixes' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git

to receive the following updates:

 drivers/scsi/libata-core.c |    1 +
 1 file changed, 1 insertion(+)

Mark Lord:
the latest consensus libata resume fix

drivers/scsi/libata-core.c +1 -0
index fa476e7..b046ffa 100644
@@ -4297,6 +4297,7 @@ static int ata_start_drive(struct ata_po
 int ata_device_resume(struct ata_port *ap, struct ata_device *dev)
 {
 	if (ap->flags & ATA_FLAG_SUSPENDED) {
+		ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 200000);
 		ap->flags &= ~ATA_FLAG_SUSPENDED;
 		ata_set_mode(ap);
 	}
#1 lore raw
Quoted 10 lines · Jeff Garzik

Please pull from 'upstream-fixes' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git

to receive the following updates:

 drivers/scsi/libata-core.c |    1 +
 1 file changed, 1 insertion(+)

Mark Lord:
the latest consensus libata resume fix

If your devices are coming from poweron-reset then you will have to wait up to 31 seconds :( And yes, I _did_ have such a device at one point.

Ben.

Quoted 16 lines
drivers/scsi/libata-core.c +1 -1
index fa476e7..b046ffa 100644
@@ -4297,6 +4297,7 @@ static int ata_start_drive(struct ata_po
 int ata_device_resume(struct ata_port *ap, struct ata_device *dev)
 {
 	if (ap->flags & ATA_FLAG_SUSPENDED) {
+		ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 200000);
 		ap->flags &= ~ATA_FLAG_SUSPENDED;
 		ata_set_mode(ap);
 	}
-

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

#2 lore raw
Quoted 6 lines · Benjamin Herrenschmidt
Quoted 5 lines · Jeff Garzik

Please pull from 'upstream-fixes' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git

to receive the following updates:

Quoted 8 lines
Quoted 5 lines
 drivers/scsi/libata-core.c |    1 +
 1 file changed, 1 insertion(+)

Mark Lord:
the latest consensus libata resume fix

If your devices are coming from poweron-reset then you will have to wait up to 31 seconds :( And yes, I _did_ have such a device at one point.

Not in a suspend/resume capable notebook, though.

I don't know of *any* notebook drives that take longer than perhaps five seconds to spin-up and accept commands. Such a slow drive wouldn't really be tolerated by end-users, which is why they don't exist.

But I suppose people will want to suspend/resume bigger machines too, in which case a 10000rpm Raptor might need 15 seconds or so.

We could bump up the existing timeout, I suppose.

Perhaps Jeff could comment on any potential harm in libata for going all the way to 3100000 with the timeout?

Cheers

#3 lore raw
Quoted 7 lines · Mark Lord

Not in a suspend/resume capable notebook, though.

I don't know of *any* notebook drives that take longer than perhaps five seconds to spin-up and accept commands. Such a slow drive wouldn't really be tolerated by end-users, which is why they don't exist.

Indeed. In fact, I'd be surprised to see it in a desktop too.

At least at one point, in order to get a M$ hw qualification (whatever it's called - but every single hw manufacturer wants it, because some vendors won't use your hardware if you don't have it), a laptop needed to boot up in less than 30 seconds or something.

And that wasn't the disk spin-up time. That was the time until the Windows desktop was visible.

Desktops could do a bit longer, and I think servers didn't have any time limits, but the point is that selling a disk that takes a long time to start working is actually not that easy.

The market that has accepted slow bootup times is historically the server market (don't ask me why - you'd think that with five-nines uptime guarantees you'd want fast bootup), and so you'll find large SCSI disks in particular with long spin-up times. In the laptop and desktop space I'd be very surprised to see anythign longer than a few seconds.

Linus

#4 lore raw
Quoted 16 lines · Linus Torvalds
Quoted 8 lines · Mark Lord

Not in a suspend/resume capable notebook, though.

I don't know of *any* notebook drives that take longer than perhaps five seconds to spin-up and accept commands. Such a slow drive wouldn't really be tolerated by end-users, which is why they don't exist.

Indeed. In fact, I'd be surprised to see it in a desktop too.

At least at one point, in order to get a M$ hw qualification (whatever it's called - but every single hw manufacturer wants it, because some vendors won't use your hardware if you don't have it), a laptop needed to boot up in less than 30 seconds or something.

Quoted 9 lines

And that wasn't the disk spin-up time. That was the time until the Windows desktop was visible.

Desktops could do a bit longer, and I think servers didn't have any time limits, but the point is that selling a disk that takes a long time to start working is actually not that easy.

The market that has accepted slow bootup times is historically the server market (don't ask me why - you'd think that with five-nines uptime guarantees you'd want fast bootup), and so you'll find large SCSI disks in particular with long spin-up times. In the laptop and desktop space I'd be very surprised to see anythign longer than a few seconds.

Linus

With many data centera applications, delayed spin up of SCSI (and increasingly S-ATA) drives is a feature meant to avoid blowing a circuit when you spin up too many drives at once ;-)

Ric

#5 lore raw
In reply to Linus Torvalds
Quoted 11 lines · Linus Torvalds
Quoted 7 lines · Mark Lord

Not in a suspend/resume capable notebook, though.

I don't know of *any* notebook drives that take longer than perhaps five seconds to spin-up and accept commands. Such a slow drive wouldn't really be tolerated by end-users, which is why they don't exist.

Indeed. In fact, I'd be surprised to see it in a desktop too.

Seen some drives at one point (I think those were maxtor) that take _exactly_ 30 seconds to stop asserting BUSY after a HW reset.

Quoted 7 lines

At least at one point, in order to get a M$ hw qualification (whatever it's called - but every single hw manufacturer wants it, because some vendors won't use your hardware if you don't have it), a laptop needed to boot up in less than 30 seconds or something.

And that wasn't the disk spin-up time. That was the time until the Windows desktop was visible.

Doesn't window spin drives asynchronously ? The main problem I've seen in practice (appart from the above maxtor drives) are ATAPI CD/DVD drives. There are whole generations of those that will happily drive your bus to some crazy state (even when only slave and not selected) for a long time while they spin up and try to identify the disk in them on a hard reset (and if they have trouble identifying the disk, like a scratched disk, that can take a loooong time).

Quoted 9 lines

Desktops could do a bit longer, and I think servers didn't have any time limits, but the point is that selling a disk that takes a long time to start working is actually not that easy.

The market that has accepted slow bootup times is historically the server market (don't ask me why - you'd think that with five-nines uptime guarantees you'd want fast bootup), and so you'll find large SCSI disks in particular with long spin-up times. In the laptop and desktop space I'd be very surprised to see anythign longer than a few seconds.

It's only a timeout. If you drives are fast, it will come up fast... if you drives are slow, it will come up slow, and if your drives are broken, you'll wait at most 31 seconds. Seems ok to me... It would be nicer in the long run if libata could resume asynchronously (by keeping the request queue blocked until full resume and polling the BUSY from a thread or a timer), but I don't think we should lower the timeout.

Ben.

#6 lore raw
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 7 lines

At least at one point, in order to get a M$ hw qualification (whatever it's called - but every single hw manufacturer wants it, because some vendors won't use your hardware if you don't have it), a laptop needed to boot up in less than 30 seconds or something.

And that wasn't the disk spin-up time. That was the time until the Windows desktop was visible.

Quoted 7 lines

Doesn't window spin drives asynchronously ? The main problem I've seen in practice (appart from the above maxtor drives) are ATAPI CD/DVD drives. There are whole generations of those that will happily drive your bus to some crazy state (even when only slave and not selected) for a long time while they spin up and try to identify the disk in them on a hard reset (and if they have trouble identifying the disk, like a scratched disk, that can take a loooong time).

FWIW, I've seen the very same thing. Resume/power-up with a cd/dvd that has a media loaded can take _ages_ to get ready.

Quoted 10 lines
Quoted 9 lines

Desktops could do a bit longer, and I think servers didn't have any time limits, but the point is that selling a disk that takes a long time to start working is actually not that easy.

The market that has accepted slow bootup times is historically the server market (don't ask me why - you'd think that with five-nines uptime guarantees you'd want fast bootup), and so you'll find large SCSI disks in particular with long spin-up times. In the laptop and desktop space I'd be very surprised to see anythign longer than a few seconds.

Quoted 6 lines

It's only a timeout. If you drives are fast, it will come up fast... if you drives are slow, it will come up slow, and if your drives are broken, you'll wait at most 31 seconds. Seems ok to me... It would be nicer in the long run if libata could resume asynchronously (by keeping the request queue blocked until full resume and polling the BUSY from a thread or a timer), but I don't think we should lower the timeout.

In reality it probably doesn't matter much, since everything will be stalled until the queue is unfrozen anyways. Unless of course you have several slow-to-resume devices so you would at least get some overlap. But it would be nicer from a design view point.

Signature · 1 line
Jens Axboe
#7 lore raw
Quoted 5 lines

In reality it probably doesn't matter much, since everything will be stalled until the queue is unfrozen anyways. Unless of course you have several slow-to-resume devices so you would at least get some overlap. But it would be nicer from a design view point.

In practice, it would be nice because most of X would restore while you wait, it generally doesn't need the disk to do so unless you are heavy on swap (or used suspend-to-disk :), that's one example among others...

At least letting other drivers restore in parallel, will improve things, even if actual running of userland programs might still be stalled until the disk kicks back in. But the whole experience of waking up the machine will be improved from a black text screen waiting for the drive to spin up ... :)

Ben.

#8 lore raw
In reply to Linus Torvalds
Quoted 11 lines · Linus Torvalds
Quoted 6 lines · Mark Lord

Not in a suspend/resume capable notebook, though.

I don't know of *any* notebook drives that take longer than perhaps five seconds to spin-up and accept commands. Such a slow drive wouldn't really be tolerated by end-users, which is why they don't exist.

Indeed. In fact, I'd be surprised to see it in a desktop too.

Quoted 7 lines

At least at one point, in order to get a M$ hw qualification (whatever it's called - but every single hw manufacturer wants it, because some vendors won't use your hardware if you don't have it), a laptop needed to boot up in less than 30 seconds or something.

And that wasn't the disk spin-up time. That was the time until the Windows desktop was visible.

Desktops could do a bit longer, and I think servers didn't have any time limits, but the point is that selling a disk that takes a long time to start working is actually not that easy.

The market that has accepted slow bootup times is historically the server market (don't ask me why - you'd think that with five-nines uptime guarantees you'd want fast bootup), and so you'll find large SCSI disks in particular with long spin-up times. In the laptop and desktop space I'd be very surprised to see anythign longer than a few seconds.

The trade-off is that if I have a 15k rpm SCSI drive, it would take a lot of design changes to make it spin up quickly, and improve a function which is usually done on a server once every MTBF when replacing the failed unit.

I think the majority of very large or very fast drives are in systems which don't (deliberately) power cycles often, in rooms where heat is an issue. And to spin up quickly take a larger power supply... 30 sec is fine with most users.

Couldn't find a spin-up time for the new Seagate 750GB drive, but the seek sure is fast!

Signature · 5 lines
Bill Davidsen <[email protected]>
  Obscure bug of 2004: BASH BUFFER OVERFLOW - if bash is being run by a
normal user and is setuid root, with the "vi" line edit mode selected,
and the character set is "big5," an off-by-one errors occurs during
wildcard (glob) expansion.
#9 lore raw
In reply to Mark Lord
Quoted 10 lines · Mark Lord
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 8 lines · Jeff Garzik

Please pull from 'upstream-fixes' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git

to receive the following updates:

 drivers/scsi/libata-core.c |    1 +
 1 file changed, 1 insertion(+)
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Mark Lord:
the latest consensus libata resume fix

If your devices are coming from poweron-reset then you will have to wait up to 31 seconds :( And yes, I _did_ have such a device at one point.

Not in a suspend/resume capable notebook, though.

Maybe, but 2 seconds is just "abitrary". I know some ATAPI devices (in notebooks) that will drive the bus (and thus pollute whatever you try to do) for way more than 2 seconds if they are reset with a CD in the drive.

Quoted 4 lines

I don't know of *any* notebook drives that take longer than perhaps five seconds to spin-up and accept commands. Such a slow drive wouldn't really be tolerated by end-users, which is why they don't exist.

They do, especially ATAPI.

Quoted 7 lines

But I suppose people will want to suspend/resume bigger machines too, in which case a 10000rpm Raptor might need 15 seconds or so.

We could bump up the existing timeout, I suppose.

Perhaps Jeff could comment on any potential harm in libata for going all the way to 3100000 with the timeout?