public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: PATCH, IDE corruption, 2.4.18
@ 2002-05-05 15:49 Bartlomiej Zolnierkiewicz
  2002-05-05 15:04 ` Martin Dalecki
  2002-05-05 20:44 ` Neil Conway
  0 siblings, 2 replies; 14+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2002-05-05 15:49 UTC (permalink / raw)
  To: Neil Conway; +Cc: linux-kernel


> 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.

You've got been mistaken by unfortunate name (Martin changed
name dmaproc() to udma() in 2.5.12).
Code calls ide_dma_check for chipsets which registerered udma()
handler (formerly dmaproc()), I think the same 2.4 does.

btw. udma() name is really misleading,
     it should be read (u)dma() not udma() :)

--
bkz


^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: PATCH, IDE corruption, 2.4.18
@ 2002-05-04 12:15 Neil Conway
  2002-05-04 22:58 ` Andre Hedrick
  2002-05-05  0:22 ` Mike Fedyk
  0 siblings, 2 replies; 14+ messages in thread
From: Neil Conway @ 2002-05-04 12:15 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 355 bytes --]

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

[-- Attachment #2: ide_patch030502.txt --]
[-- Type: text/plain, Size: 706 bytes --]

--- ide-features.c.orig	Fri Feb  9 19:40:02 2001
+++ ide-features.c	Fri May  3 20:21:58 2002
@@ -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) */
 

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: PATCH, IDE corruption, 2.4.18
@ 2002-05-03 20:39 Neil Conway
  0 siblings, 0 replies; 14+ messages in thread
From: Neil Conway @ 2002-05-03 20:39 UTC (permalink / raw)
  To: linux-kernel

Darn, forgot to mention: this only bites if the CD
drive supports DMA.

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

^ permalink raw reply	[flat|nested] 14+ messages in thread
* PATCH, IDE corruption, 2.4.18
@ 2002-05-03 20:36 Neil Conway
  0 siblings, 0 replies; 14+ messages in thread
From: Neil Conway @ 2002-05-03 20:36 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1762 bytes --]

Well, I say patch, but it's really a band-aid.

[Caveats: before reading further, understand that I'm
not by any means an IDE expert; I have just figured
out how to prevent disk corruption on my PC.  I may
have completely missed the point.]

While debugging some "0x58" status errors (which I
believed to have lead to disk corruption) I discovered
that ide_config_drive_speed() uses SELECT_DRIVE
without checking to see if there are disk transfers in
progress (by definition these have to be DMA
transfers).  Unless I've misread the ATA specs, this
is a Very Bad Thing.

This means that when modules which call
ide_register_subdriver() are loaded (so far I think
it's just ide-cd and ide-scsi) any disk transfers in
progress on the other half of the cable are stuffed.

This is very easy to reproduce: just do a "dd
if=/dev/hda of=/dev/null" and a few of "rmmod
ide-cd;modprobe ide-cd" (where there must be a CD on
hdb, or hdc and hdd but you get the idea).  On my box,
this is about 80% successful each module-load at
causing the "0x58" status error.  Repeated usage
trashes inodes (don't know why) and even causes
lockups (don't know why either).  This suggests that
the error-recovery doesn't work very well...

Anyway, here's the band aid as promised.  A timeout,
or a queued request would be better, but I'm not sure
of how best to do either, so at least now the real
experts can fix it properly...

cheers
Neil
PS: don't know (but doubt it) if this is what caused
the 0x58 problems in 2.2 etc.
PPS: I'm off-list at present, so please CC me if you
want me to notice responses.


__________________________________________________
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

[-- Attachment #2: ide_patch030502 --]
[-- Type: application/x-unknown, Size: 706 bytes --]

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

end of thread, other threads:[~2002-05-06  0:23 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-05 15:49 PATCH, IDE corruption, 2.4.18 Bartlomiej Zolnierkiewicz
2002-05-05 15:04 ` Martin Dalecki
2002-05-05 20:44 ` Neil Conway
2002-05-06  0:23   ` Mike Fedyk
  -- strict thread matches above, loose matches on Subject: below --
2002-05-04 12:15 Neil Conway
2002-05-04 22:58 ` Andre Hedrick
2002-05-05  2:10   ` Neil Conway
2002-05-05  0:22 ` Mike Fedyk
2002-05-05  0:47   ` Andre Hedrick
2002-05-05  1:54   ` Neil Conway
2002-05-05  7:36     ` Mike Fedyk
2002-05-05  9:44       ` Neil Conway
2002-05-03 20:39 Neil Conway
2002-05-03 20:36 Neil Conway

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox