PATCH, IDE corruption, 2.4.18
Argh, humble apologies. Just noticed that Yahoo didn't like it that my attachment didn't have a suffix and encoded it base64 :((
Here it is as a plain text attachment.
Neil
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
ide-features.c renamed from ide-features.c.orig +8 -2
@@ -281,12 +281,18 @@*/ int ide_config_drive_speed (ide_drive_t *drive,byte speed) { +ide_hwgroup_t *hwgroup =HWGROUP (drive);ide_hwif_t *hwif =HWIF (drive);int i, error =1 ; -byte stat; +byte stat,unit; + +if (hwgroup->busy) { +printk ("Argh: hwgroup is busy in ide_config_drive_speed\n" ); +return error; + }#if defined(CONFIG_BLK_DEV_IDEDMA ) && !defined(CONFIG_DMA_NONPCI ) -byte unit = (drive->select.b.unit &0x01 ); + unit = (drive->select.b.unit &0x01 );outb (inb (hwif->dma_base+2 ) & ~(1 <<(5 +unit)), hwif->dma_base+2 );#endif /* (CONFIG_BLK_DEV_IDEDMA) && !(CONFIG_DMA_NONPCI) */
It is a viable check but it the need for it shows another problem in the code. In the IDEDMA recovery kludges it must be losing the the hwgroup busy state.
Quoted 5 lines · Neil Conway
Argh, humble apologies. Just noticed that Yahoo didn't like it that my attachment didn't have a suffix and encoded it base64 :((
Here it is as a plain text attachment.
Quoted 7 lines
Neil
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
Andre Hedrick
LAD Storage Consulting Group
Quoted 2 lines · Neil Conway
ide-features.c renamed from ide-features.c.orig +1
-1-byte stat; +byte stat,unit;
[snip]
ide-features.c line 295
Quoted 3 lines
#if
defined(CONFIG_BLK_DEV_IDEDMA)&& !defined(CONFIG_DMA_NONPCI)ide-features.c renamed from ide-features.c.orig +1
-1-byte unit = (drive->select.b.unit &0x01 ); + unit = (drive->select.b.unit &0x01 );
Why are you moving the init of "unit" out of that ifdef?
Can you see if this problem is still in 2.5 also?
It is not a problem in 2.5, you have a worse one.
NO DMA TIMEOUT RECOVERY -- woohoo ...........
Quoted 12 lines · Mike Fedyk
Quoted 2 lines · Neil Conway
ide-features.c renamed from ide-features.c.orig +1
-1-byte stat; +byte stat,unit;[snip]
ide-features.c line 295
Quoted 3 lines
#if
defined(CONFIG_BLK_DEV_IDEDMA)&& !defined(CONFIG_DMA_NONPCI)ide-features.c renamed from ide-features.c.orig +1
-1-byte unit = (drive->select.b.unit &0x01 ); + unit = (drive->select.b.unit &0x01 );Why are you moving the init of "unit" out of that ifdef?
Quoted 7 lines
Can you see if this problem is still in 2.5 also?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Andre Hedrick
LAD Storage Consulting Group
Hi...
--- Mike Fedyk <[email protected]> wrote: > On Sat, May 04, 2002 at
Quoted 10 lines · Neil Conway
Quoted 2 lines
ide-features.c renamed from ide-features.c.orig +1
-1-byte stat; +byte stat,unit;[snip]
ide-features.c line 295
Quoted 3 lines
#if
defined(CONFIG_BLK_DEV_IDEDMA)&& !defined(CONFIG_DMA_NONPCI)ide-features.c renamed from ide-features.c.orig +1
-1-byte unit = (drive->select.b.unit &0x01 ); + unit = (drive->select.b.unit &0x01 );Why are you moving the init of "unit" out of that ifdef?
Basically to make it compile. I'm only moving the declaration, and that's only because I need to abort the routine BEFORE the second line of the ifdef switches off DMA on that unit. I did compile a version with the ifdef split into two bits but I decided that was a little messy. (It won't compile if my check goes in before the first line of the ifdef as originally written as it declares a variable and C won't let declarations follow plain code.)
Quoted 1 line
Can you see if this problem is still in 2.5 also?
I haven't got a 2.5.13 tree but I found 2.5.7 on a source browser online and verified that, back then at least, ide-features.c was still basically the same. Of course, the routines in between ide_register_subdriver and ide_config_drive_speed might have been different. If someone can look at the code-path between these two routines in 2.5.13 to see if there is any check on whether or not the hwgroup is busy (or simply whether or not DMA is in progress) that would clear it up. I'll probably download 2.5.13 sometime soon anyway.
cheers
Neil
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
Ah good stuff, an honest-to-god expert with brains for the picking :)
--- Andre Hedrick <[email protected]> wrote: >
Quoted 5 lines
It is a viable check but it the need for it shows another problem in the
code. In the IDEDMA recovery kludges it must be losing the the hwgroup
busy state.
Have I misunderstood then? My understanding was this:ide_config_drive_speed is doing a SELECT_DRIVE, which is quite liable to happen during a DMA transfer to/from the other unit on the hwif, and thus screw up that transfer.
The recovery or not (from the screw-up) is a secondary factor (and it would be nice if such recoveries worked) but the primary fix is surely to make sure we don't gratuitously screw up transfers in the first place.
Or have I just demonstrated my utter ignorance of IDE?
Neil
PS: a secondary issue is that after ide_config_drive_speed buggers up a transfer, the selected drive is NOT the one that ide_intr expects to be selected. I haven't yet got any clue if this is also relevant though.
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
Quoted 15 lines · Neil Conway
Hi...
--- Mike Fedyk <[email protected]> wrote: > On Sat, May 04, 2002 at
Quoted 10 lines · Neil Conway
Quoted 2 lines
ide-features.c renamed from ide-features.c.orig +1
-1-byte stat; +byte stat,unit;[snip]
ide-features.c line 295
Quoted 3 lines
#if
defined(CONFIG_BLK_DEV_IDEDMA)&& !defined(CONFIG_DMA_NONPCI)ide-features.c renamed from ide-features.c.orig +1
-1-byte unit = (drive->select.b.unit &0x01 ); + unit = (drive->select.b.unit &0x01 );Why are you moving the init of "unit" out of that ifdef?
Quoted 8 lines
Basically to make it compile. I'm only moving the declaration, and that's only because I need to abort the routine BEFORE the second line of the ifdef switches off DMA on that unit. I did compile a version with the ifdef split into two bits but I decided that was a little messy. (It won't compile if my check goes in before the first line of the ifdef as originally written as it declares a variable and C won't let declarations follow plain code.)
Right. Duh on my part, sorry.
Quoted 11 lines
Quoted 1 line
Can you see if this problem is still in 2.5 also?
I haven't got a 2.5.13 tree but I found 2.5.7 on a source browser online and verified that, back then at least,
ide-features.cwas still basically the same. Of course, the routines in betweenide_register_subdriverandide_config_drive_speedmight have been different. If someone can look at the code-path between these two routines in 2.5.13 to see if there is any check on whether or not the hwgroup is busy (or simply whether or not DMA is in progress) that would clear it up. I'll probably download 2.5.13 sometime soon anyway.
Andre cleaims that the situation is worse on 2.5.13 or so. I wouldn't hurt to test-run the code though.
Well, downloaded 2.5.13 last night. Executive summary: 2.5.13 IS buggy.
Explanation: some code now differs in the code path concerned, and ide_register_subdriver now only calls ide_dma_check for UDMA drives (previously all DMA drives), but ultimately ide_dma_check still ends up in ide_config_drive_speed, and that's still fuctionally the same as 2.4.
My patch doesn't apply though, due to slight changes to types and macros, but it's not exactly a hard patch to port. Moreover, it's probably better to fix the problem more directly than to port my patch ;-))
Neil
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com