linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libata-core: Don't have screaming fits over DF/ERR combinations
@ 2007-10-15 18:23 Alan Cox
  2007-10-15 19:53 ` Sergei Shtylyov
  2007-10-25  6:04 ` Jeff Garzik
  0 siblings, 2 replies; 7+ messages in thread
From: Alan Cox @ 2007-10-15 18:23 UTC (permalink / raw)
  To: jgarzik, linux-ide, akpm

Some hardware seems to get this wrong in a non-harmful way, and there are
some devices that seem to do it deliberately for various reasons.

Just take it as a device error not a catastrophic state machine
explosion. 

Signed-off-by: Alan Cox <alan@redhat.com>

diff -u --exclude-from /usr/src/exclude --new-file --recursive linux.vanilla-2.6.23-mm1/drivers/ata/libata-core.c linux-2.6.23-mm1/drivers/ata/libata-core.c
--- linux.vanilla-2.6.23-mm1/drivers/ata/libata-core.c	2007-10-15 15:03:26.000000000 +0100
+++ linux-2.6.23-mm1/drivers/ata/libata-core.c	2007-10-15 15:13:49.000000000 +0100
@@ -5258,7 +5319,15 @@
 		if (unlikely(status & (ATA_ERR | ATA_DF))) {
 			ata_port_printk(ap, KERN_WARNING, "DRQ=1 with device "
 					"error, dev_stat 0x%X\n", status);
-			qc->err_mask |= AC_ERR_HSM;
+			/* Some devices muck this up. Some follow an ATA
+			   non-standard that permits the damaged sector to
+			   be retrieved at this point. The ATA spec says
+			   we should jump up and down on DRQ + ERR, reality
+			   says we should be a little more relaxed.
+
+			   Rather than an HSM error, take it as a device
+			   error */
+			qc->err_mask |= AC_ERR_DEV;
 			ap->hsm_task_state = HSM_ST_ERR;
 			goto fsm_start;
 		}

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

* Re: [PATCH] libata-core: Don't have screaming fits over DF/ERR combinations
  2007-10-15 18:23 [PATCH] libata-core: Don't have screaming fits over DF/ERR combinations Alan Cox
@ 2007-10-15 19:53 ` Sergei Shtylyov
  2007-10-15 20:02   ` Jeff Garzik
  2007-10-25  6:04 ` Jeff Garzik
  1 sibling, 1 reply; 7+ messages in thread
From: Sergei Shtylyov @ 2007-10-15 19:53 UTC (permalink / raw)
  To: Alan Cox; +Cc: jgarzik, linux-ide, akpm

Alan Cox wrote:

> Some hardware seems to get this wrong in a non-harmful way, and there are
> some devices that seem to do it deliberately for various reasons.

> Just take it as a device error not a catastrophic state machine
> explosion. 

> Signed-off-by: Alan Cox <alan@redhat.com>
> 
> diff -u --exclude-from /usr/src/exclude --new-file --recursive linux.vanilla-2.6.23-mm1/drivers/ata/libata-core.c linux-2.6.23-mm1/drivers/ata/libata-core.c
> --- linux.vanilla-2.6.23-mm1/drivers/ata/libata-core.c	2007-10-15 15:03:26.000000000 +0100
> +++ linux-2.6.23-mm1/drivers/ata/libata-core.c	2007-10-15 15:13:49.000000000 +0100
> @@ -5258,7 +5319,15 @@
>  		if (unlikely(status & (ATA_ERR | ATA_DF))) {
>  			ata_port_printk(ap, KERN_WARNING, "DRQ=1 with device "
>  					"error, dev_stat 0x%X\n", status);
> -			qc->err_mask |= AC_ERR_HSM;
> +			/* Some devices muck this up. Some follow an ATA
> +			   non-standard that permits the damaged sector to
> +			   be retrieved at this point. The ATA spec says
> +			   we should jump up and down on DRQ + ERR, reality

    I've always thought that setting both DRQ and ERR is perfectly valid 
(well, maybe it's become invalid since ATAPI-4 where all these state 
transition flow charts have made its first appearance, to be quickly replaced 
by the state diagrams :-) -- I'm too lazy to check now... :-)

> +			   says we should be a little more relaxed.
> +
> +			   Rather than an HSM error, take it as a device
> +			   error */

    I'm not sure it's an error in the first place.

> +			qc->err_mask |= AC_ERR_DEV;
>  			ap->hsm_task_state = HSM_ST_ERR;
>  			goto fsm_start;
>  		}

MBR, Sergei

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

* Re: [PATCH] libata-core: Don't have screaming fits over DF/ERR combinations
  2007-10-15 19:53 ` Sergei Shtylyov
@ 2007-10-15 20:02   ` Jeff Garzik
  2007-10-15 20:05     ` Sergei Shtylyov
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2007-10-15 20:02 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Alan Cox, linux-ide, akpm

Sergei Shtylyov wrote:
> Alan Cox wrote:
> 
>> Some hardware seems to get this wrong in a non-harmful way, and there are
>> some devices that seem to do it deliberately for various reasons.
> 
>> Just take it as a device error not a catastrophic state machine
>> explosion. 
> 
>> Signed-off-by: Alan Cox <alan@redhat.com>
>>
>> diff -u --exclude-from /usr/src/exclude --new-file --recursive 
>> linux.vanilla-2.6.23-mm1/drivers/ata/libata-core.c 
>> linux-2.6.23-mm1/drivers/ata/libata-core.c
>> --- linux.vanilla-2.6.23-mm1/drivers/ata/libata-core.c    2007-10-15 
>> 15:03:26.000000000 +0100
>> +++ linux-2.6.23-mm1/drivers/ata/libata-core.c    2007-10-15 
>> 15:13:49.000000000 +0100
>> @@ -5258,7 +5319,15 @@
>>          if (unlikely(status & (ATA_ERR | ATA_DF))) {
>>              ata_port_printk(ap, KERN_WARNING, "DRQ=1 with device "
>>                      "error, dev_stat 0x%X\n", status);
>> -            qc->err_mask |= AC_ERR_HSM;
>> +            /* Some devices muck this up. Some follow an ATA
>> +               non-standard that permits the damaged sector to
>> +               be retrieved at this point. The ATA spec says
>> +               we should jump up and down on DRQ + ERR, reality
> 
>    I've always thought that setting both DRQ and ERR is perfectly valid 
> (well, maybe it's become invalid since ATAPI-4 where all these state 
> transition flow charts have made its first appearance, to be quickly 
> replaced by the state diagrams :-) -- I'm too lazy to check now... :-)

DRQ+ERR is valid, and SRST (or hard reset) is defined as the method of 
kicking the device out of that state.

	Jeff




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

* Re: [PATCH] libata-core: Don't have screaming fits over DF/ERR combinations
  2007-10-15 20:02   ` Jeff Garzik
@ 2007-10-15 20:05     ` Sergei Shtylyov
  2007-10-15 20:09       ` Jeff Garzik
  0 siblings, 1 reply; 7+ messages in thread
From: Sergei Shtylyov @ 2007-10-15 20:05 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Alan Cox, linux-ide, akpm

Jeff Garzik wrote:

>>> Some hardware seems to get this wrong in a non-harmful way, and there 
>>> are
>>> some devices that seem to do it deliberately for various reasons.

>>> Just take it as a device error not a catastrophic state machine
>>> explosion. 

>>> Signed-off-by: Alan Cox <alan@redhat.com>

>>> diff -u --exclude-from /usr/src/exclude --new-file --recursive 
>>> linux.vanilla-2.6.23-mm1/drivers/ata/libata-core.c 
>>> linux-2.6.23-mm1/drivers/ata/libata-core.c
>>> --- linux.vanilla-2.6.23-mm1/drivers/ata/libata-core.c    2007-10-15 
>>> 15:03:26.000000000 +0100
>>> +++ linux-2.6.23-mm1/drivers/ata/libata-core.c    2007-10-15 
>>> 15:13:49.000000000 +0100
>>> @@ -5258,7 +5319,15 @@
>>>          if (unlikely(status & (ATA_ERR | ATA_DF))) {
>>>              ata_port_printk(ap, KERN_WARNING, "DRQ=1 with device "
>>>                      "error, dev_stat 0x%X\n", status);
>>> -            qc->err_mask |= AC_ERR_HSM;
>>> +            /* Some devices muck this up. Some follow an ATA
>>> +               non-standard that permits the damaged sector to
>>> +               be retrieved at this point. The ATA spec says
>>> +               we should jump up and down on DRQ + ERR, reality

>>    I've always thought that setting both DRQ and ERR is perfectly 
>> valid (well, maybe it's become invalid since ATAPI-4 where all these 
>> state transition flow charts have made its first appearance, to be 
>> quickly replaced by the state diagrams :-) -- I'm too lazy to check 
>> now... :-)

> DRQ+ERR is valid, and SRST (or hard reset) is defined as the method of 
> kicking the device out of that state.

    Well, in the times of old, reading a sector (or group of them for multiple 
mode) was valid for that purpose, wasn't it?

>     Jeff

MBR, Sergei

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

* Re: [PATCH] libata-core: Don't have screaming fits over DF/ERR combinations
  2007-10-15 20:05     ` Sergei Shtylyov
@ 2007-10-15 20:09       ` Jeff Garzik
  2007-10-15 20:58         ` Alan Cox
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2007-10-15 20:09 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Alan Cox, linux-ide, akpm

Sergei Shtylyov wrote:
> Jeff Garzik wrote:
> 
>>>> Some hardware seems to get this wrong in a non-harmful way, and 
>>>> there are
>>>> some devices that seem to do it deliberately for various reasons.
> 
>>>> Just take it as a device error not a catastrophic state machine
>>>> explosion. 
> 
>>>> Signed-off-by: Alan Cox <alan@redhat.com>
> 
>>>> diff -u --exclude-from /usr/src/exclude --new-file --recursive 
>>>> linux.vanilla-2.6.23-mm1/drivers/ata/libata-core.c 
>>>> linux-2.6.23-mm1/drivers/ata/libata-core.c
>>>> --- linux.vanilla-2.6.23-mm1/drivers/ata/libata-core.c    2007-10-15 
>>>> 15:03:26.000000000 +0100
>>>> +++ linux-2.6.23-mm1/drivers/ata/libata-core.c    2007-10-15 
>>>> 15:13:49.000000000 +0100
>>>> @@ -5258,7 +5319,15 @@
>>>>          if (unlikely(status & (ATA_ERR | ATA_DF))) {
>>>>              ata_port_printk(ap, KERN_WARNING, "DRQ=1 with device "
>>>>                      "error, dev_stat 0x%X\n", status);
>>>> -            qc->err_mask |= AC_ERR_HSM;
>>>> +            /* Some devices muck this up. Some follow an ATA
>>>> +               non-standard that permits the damaged sector to
>>>> +               be retrieved at this point. The ATA spec says
>>>> +               we should jump up and down on DRQ + ERR, reality
> 
>>>    I've always thought that setting both DRQ and ERR is perfectly 
>>> valid (well, maybe it's become invalid since ATAPI-4 where all these 
>>> state transition flow charts have made its first appearance, to be 
>>> quickly replaced by the state diagrams :-) -- I'm too lazy to check 
>>> now... :-)
> 
>> DRQ+ERR is valid, and SRST (or hard reset) is defined as the method of 
>> kicking the device out of that state.
> 
>    Well, in the times of old, reading a sector (or group of them for 
> multiple mode) was valid for that purpose, wasn't it?

Yes, hence the recent FIFO drain patches.

But that doesn't make sense for SATA devices, where the FIFO is really 
emulated, and it works on older PATA devices.

	Jeff




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

* Re: [PATCH] libata-core: Don't have screaming fits over DF/ERR combinations
  2007-10-15 20:09       ` Jeff Garzik
@ 2007-10-15 20:58         ` Alan Cox
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Cox @ 2007-10-15 20:58 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Sergei Shtylyov, linux-ide, akpm

> Yes, hence the recent FIFO drain patches.
> 
> But that doesn't make sense for SATA devices, where the FIFO is really 
> emulated, and it works on older PATA devices.

The FIFO is emulated on PATA. Basically speaking the device prefetches
data and buffers the irq arrival until the right moment. Hence the need
to drain it on some chips. Others reset themselves in this case and post
reset a data read on some promise chips hangs the bus solid

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

* Re: [PATCH] libata-core: Don't have screaming fits over DF/ERR combinations
  2007-10-15 18:23 [PATCH] libata-core: Don't have screaming fits over DF/ERR combinations Alan Cox
  2007-10-15 19:53 ` Sergei Shtylyov
@ 2007-10-25  6:04 ` Jeff Garzik
  1 sibling, 0 replies; 7+ messages in thread
From: Jeff Garzik @ 2007-10-25  6:04 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-ide, akpm

Alan Cox wrote:
> Some hardware seems to get this wrong in a non-harmful way, and there are
> some devices that seem to do it deliberately for various reasons.
> 
> Just take it as a device error not a catastrophic state machine
> explosion. 
> 
> Signed-off-by: Alan Cox <alan@redhat.com>

applied to #for-testing branch, let me know when you think its suitable 
for upstream



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

end of thread, other threads:[~2007-10-25  6:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-15 18:23 [PATCH] libata-core: Don't have screaming fits over DF/ERR combinations Alan Cox
2007-10-15 19:53 ` Sergei Shtylyov
2007-10-15 20:02   ` Jeff Garzik
2007-10-15 20:05     ` Sergei Shtylyov
2007-10-15 20:09       ` Jeff Garzik
2007-10-15 20:58         ` Alan Cox
2007-10-25  6:04 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).