Patchwork [ide] : Increase WAIT_DRQ to support slow CF cards

login
register
mail settings
Submitter David Miller
Date Dec. 3, 2009, 5:57 a.m.
Message ID <20091202.215738.12118816.davem@davemloft.net>
Download mbox | patch
Permalink /patch/40131/
State Accepted
Delegated to: David Miller
Headers show

Comments

David Miller - Dec. 3, 2009, 5:57 a.m.
From: Mark Lord <liml@rtr.ca>
Date: Sat, 31 Oct 2009 09:56:26 -0400

> Robert Hancock wrote:
> ..
>> This has come up before:
>> http://marc.info/?l=linux-ide&m=123064513313466&w=2
>> I think this timeout should not even exist. libata has no such timeout
>> (only the overall command completion timeout), and I can't find any
>> reference in current ATA specs to the device being required to raise
>> DRQ in any particular amount of time.
> ..
> 
> The reason for the original (20ms, then 50ms) timeout was this text
> from the ATA1 specification, long since outdated:
> 
>   -  Upon receipt of a Class 3 command, the drive sets BSY within 400 nsec,
>      sets  up the sector buffer for a write operation, sets DRQ within 20
>      msec, and clears BSY within 400 nsec of setting DRQ.

Ok, I'd like to resolve this as follows.  We had stated "at least
500msec for SSD drives" so I doubled it.

This should be a pretty safe change.  The only major side effect is
that if the device really does hang before setting DRQ it will take
a full second before we notice it.

Any major objections?

ide: Increase WAIT_DRQ to accomodate some CF cards and SSD drives.

Based upon a patch by Philippe De Muyter, and feedback from Mark
Lord and Robert Hancock.

As noted by Mark Lord, the outdated ATA1 spec specifies a 20msec
timeout for setting DRQ but lots of common devices overshoot this.

Signed-off-by: David S. Miller <davem@davemloft.net>

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Philippe De Muyter - Dec. 3, 2009, 8:55 a.m.
On Wed, Dec 02, 2009 at 09:57:38PM -0800, David Miller wrote:
> ide: Increase WAIT_DRQ to accomodate some CF cards and SSD drives.
> 
> Based upon a patch by Philippe De Muyter, and feedback from Mark
> Lord and Robert Hancock.
> 
> As noted by Mark Lord, the outdated ATA1 spec specifies a 20msec
> timeout for setting DRQ but lots of common devices overshoot this.
> 
> Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Philippe De Muyter <phdm@macqel.be>
> 
> diff --git a/include/linux/ide.h b/include/linux/ide.h
> index e4135d6..0ec6129 100644
> --- a/include/linux/ide.h
> +++ b/include/linux/ide.h
> @@ -125,8 +125,8 @@ struct ide_io_ports {
>   * Timeouts for various operations:
>   */
>  enum {
> -	/* spec allows up to 20ms */
> -	WAIT_DRQ	= HZ / 10,	/* 100ms */
> +	/* spec allows up to 20ms, but CF cards and SSD drives need more */
> +	WAIT_DRQ	= 1 * HZ,	/* 1s */
>  	/* some laptops are very slow */
>  	WAIT_READY	= 5 * HZ,	/* 5s */
>  	/* should be less than 3ms (?), if all ATAPI CD is closed at boot */
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/include/linux/ide.h b/include/linux/ide.h
index e4135d6..0ec6129 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -125,8 +125,8 @@  struct ide_io_ports {
  * Timeouts for various operations:
  */
 enum {
-	/* spec allows up to 20ms */
-	WAIT_DRQ	= HZ / 10,	/* 100ms */
+	/* spec allows up to 20ms, but CF cards and SSD drives need more */
+	WAIT_DRQ	= 1 * HZ,	/* 1s */
 	/* some laptops are very slow */
 	WAIT_READY	= 5 * HZ,	/* 5s */
 	/* should be less than 3ms (?), if all ATAPI CD is closed at boot */