* ide-scsi emulation hangs the kernel?
@ 2003-12-09 22:36 Yuri Prushinsky
0 siblings, 0 replies; 4+ messages in thread
From: Yuri Prushinsky @ 2003-12-09 22:36 UTC (permalink / raw)
To: linux-scsi
Hey all! Could anybody please tell me what's wrong with the ide-scsi
emulation in 2.4.21? I have a cd-rw drive as a hdd, it works fine but
the system (redhat9) suddenly freezes at any time with the following
messages:
Dec 8 01:11:14 localhost kernel: scsi : aborting command due to timeout : pid 22251, scsi0, channel 0, id 0, lun 0 Request
Sense 00 00 00 40 00
Dec 8 01:11:14 localhost kernel: hdd: lost interrupt
Dec 8 01:11:14 localhost kernel: ide-scsi: CoD != 0 in idescsi_pc_intr
Dec 8 01:11:14 localhost kernel: hdd: DMA disabled
Dec 8 01:11:14 localhost kernel: hdd: ATAPI reset complete
Dec 8 01:11:14 localhost kernel: hdd: irq timeout: status=0x80 { Busy }
Dec 8 01:11:14 localhost kernel: hdd: ATAPI reset complete
Dec 8 01:11:14 localhost kernel: hdd: irq timeout: status=0x80 { Busy }
Dec 8 01:11:14 localhost kernel: hdd: ATAPI reset complete
--
Best regards,
Yura mailto:prushinsky@hotbox.ru
^ permalink raw reply [flat|nested] 4+ messages in thread* ide-scsi emulation hangs the kernel? @ 2003-12-10 23:36 Pat LaVarre 2003-12-11 14:13 ` Philip R. Auld 2003-12-11 19:31 ` Pat LaVarre 0 siblings, 2 replies; 4+ messages in thread From: Pat LaVarre @ 2003-12-10 23:36 UTC (permalink / raw) To: linux-scsi > Could anybody please tell me what's wrong with > the ide-scsi emulation in 2.4.21? This question I'm too ignorant to answer. Google linux-scsi tells me lk 2.6 deprecates ide-scsi in favour of ide-cd, not that lk 2.4 drops support for ide-scsi. > I have a cd-rw drive as a hdd, it works fine > but the system (redhat9) suddenly freezes at > any time with the following messages: I'm writing because these messages do make some kind of sense to Me, after having studied some of http://www.t13.org/ over the years. Below you can see I conclude: "the host gave up entirely, declaring this device broken". Without more info I cannot know whether we should try to fix the host and/or device and/or disc. Please understand, I know nearly zero of lk, just enough of t13.org ATA/PI to guess what these messages mean without being sure my guesses are correct. --- SCSI, including SCSI over IDE also known as ATAPI, works by the host and the device taking turns to speak. > Dec 8 01:11:14 localhost kernel: scsi : aborting command due to timeout : pid 22251, scsi0, channel 0, id 0, lun 0 Request Sense 00 00 00 40 00 "Timeout" often means the host lost patience while waiting for the device to yield its turn to speak. > Dec 8 01:11:14 localhost kernel: hdd: lost interrupt Linux "hdd" often means the ID 1 "slave" device of the "secondary" IDE bus. Often the way an ATA/PI device yields its turn to speak is to interrupt the host. "Lost interrupt" could be a restatement of the "timeout" idea, that > Dec 8 01:11:14 localhost kernel: ide-scsi: CoD != 0 in idescsi_pc_intr ATA/PI sequences thru four states: x01 Command Out, x00 Data Out, x02 Data In, x03 Status In. "CoD" may refer to that x 01 00 02 03 encoding. > Dec 8 01:11:14 localhost kernel: hdd: DMA disabled The port x1F2 SectorCount/InterruptReason mask x03 +Command/-Data:+In/-Out bits have no meaning unless DMA is disabled (in favour of PIO). The so-called "port x1F2" traditionally appeared as x86 i/o port address x1F2, also x172, etc. > Dec 8 01:11:14 localhost kernel: hdd: ATAPI reset complete > Dec 8 01:11:14 localhost kernel: hdd: irq timeout: status=0x80 { Busy } Automagic reset may be how this host choose to recover from its own loss of patience. In IDE PIO, ports x1F7/3F6 Status/AlternateStatus mask x88 BSY:DRQ simulate a shared memory semaphore, in which the value x00 means host talks, x08 means host copies data, and either of x80 or x88 means the device talks and the host has to wait. Here we have x80 i.e. host waiting, again consistent with the theory that our host lost patience. > Dec 8 01:11:14 localhost kernel: hdd: ATAPI reset complete > Dec 8 01:11:14 localhost kernel: hdd: irq timeout: status=0x80 { Busy } This looks like a retry of a reset - this host is more passionately losing patience. > Dec 8 01:11:14 localhost kernel: hdd: ATAPI reset complete This looks like the host gave up entirely, declaring this device broken. --- Pat LaVarre ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ide-scsi emulation hangs the kernel? 2003-12-10 23:36 Pat LaVarre @ 2003-12-11 14:13 ` Philip R. Auld 2003-12-11 19:31 ` Pat LaVarre 1 sibling, 0 replies; 4+ messages in thread From: Philip R. Auld @ 2003-12-11 14:13 UTC (permalink / raw) To: linux-scsi Hi, Rumor has it that on Wed, Dec 10, 2003 at 04:36:26PM -0700 Pat LaVarre said: > > Could anybody please tell me what's wrong with > > the ide-scsi emulation in 2.4.21? > I didn't see the original email, but have had this problem in the past. I hit this with a TOSHIBA DVD-ROM SD-C2612 and serverworks CSB5 IDE chip. There is no timeout handling in ide-scsi. And once it times out the command gets re-issued with a timeout that can go off immediately. This patch fixes the problem on my system. It's for 2.4.9 but from the sound of it should be applicable to later kernels. Your milage may vary. Cheers, Phil diff -ruN -X ../patches/dontdiff linux-clean/drivers/scsi/ide-scsi.c linux-cblade/drivers/scsi/ide-scsi.c --- linux-clean/drivers/scsi/ide-scsi.c Fri Aug 29 10:15:16 2003 +++ linux-cblade/drivers/scsi/ide-scsi.c Fri Aug 29 10:23:25 2003 @@ -77,6 +77,7 @@ #define PC_DMA_IN_PROGRESS 0 /* 1 while DMA in progress */ #define PC_WRITING 1 /* Data direction */ #define PC_TRANSFORM 2 /* transform SCSI commands */ +#define PC_TIMEDOUT 3 /* command timed out */ /* * SCSI command transformation layer @@ -113,6 +114,11 @@ #define IDESCSI_IREASON_COD 0x1 /* Information transferred is command */ #define IDESCSI_IREASON_IO 0x2 /* The device requests us to read */ +/* + * Timeout less than given scsi cmd timeout to use. + */ +#define IDESCSI_TIMEOUT_DELTA (2 * HZ) + static void idescsi_discard_data (ide_drive_t *drive, unsigned int bcount) { while (bcount--) @@ -279,7 +285,12 @@ pc->scsi_cmd->result = (CHECK_CONDITION << 1) | (DID_OK << 16); if (log) printk ("ide-scsi: %s: check condition for %lu\n", drive->name, pc->scsi_cmd->serial_number); - } else { + } else if (test_bit(PC_TIMEDOUT, &pc->flags)){ + pc->scsi_cmd->result = DID_TIME_OUT << 16; + if (log) + printk ("ide-scsi: %s: timed out for %lu\n", drive->name, pc->scsi_cmd->serial_number); + } + else { pc->scsi_cmd->result = DID_OK << 16; idescsi_transform_pc2 (drive, pc); if (log) { @@ -301,7 +312,21 @@ static inline unsigned long get_timeout(idescsi_pc_t *pc) { - return IDE_MAX(WAIT_CMD, pc->timeout - jiffies); + return IDE_MAX(WAIT_CMD, (signed long) (pc->timeout -jiffies)); +} + +/* timeout handler. Mark command as having timed out. + */ +int idescsi_expiry (ide_drive_t *drive){ + idescsi_scsi_t *scsi = drive->driver_data; + idescsi_pc_t *pc=scsi->pc; + +#if IDESCSI_DEBUG_LOG + printk(KERN_INFO "idescsi_expiry called for %lu at %lu\n", pc->scsi_cmd->serial_number, jiffies); +#endif + set_bit(PC_TIMEDOUT, &pc->flags); + + return 0; } /* @@ -320,6 +345,15 @@ printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n"); #endif /* IDESCSI_DEBUG_LOG */ + if (test_bit(PC_TIMEDOUT, &pc->flags)){ +#if IDESCSI_DEBUG_LOG + printk("idescsi_pc_intr: got timed out packet %lu at %lu\n", pc->scsi_cmd->serial_number, jiffies); +#endif + /* end this request now - scsi should retry it*/ + idescsi_end_request (0, HWGROUP(drive)); + return ide_do_reset (drive); + } + if (test_and_clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) { #if IDESCSI_DEBUG_LOG printk ("ide-scsi: %s: DMA complete\n", drive->name); @@ -363,7 +397,7 @@ pc->actually_transferred += temp; pc->current_position += temp; idescsi_discard_data (drive,bcount - temp); - ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), NULL); + ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); return ide_started; } #if IDESCSI_DEBUG_LOG @@ -387,7 +421,7 @@ pc->actually_transferred+=bcount; /* Update the current position */ pc->current_position+=bcount; - ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), NULL); /* And set the interrupt handler again */ + ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); /* And set the interrupt handler again */ return ide_started; } @@ -407,7 +441,7 @@ printk (KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while issuing a packet command\n"); return ide_do_reset (drive); } - ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), NULL); /* Set the interrupt routine */ + ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); /* Set the interrupt routine */ atapi_output_bytes (drive, scsi->pc->c, 12); /* Send the actual packet */ return ide_started; } @@ -442,7 +476,7 @@ (void) (HWIF(drive)->dmaproc(ide_dma_begin, drive)); } if (test_bit (IDESCSI_DRQ_INTERRUPT, &scsi->flags)) { - ide_set_handler (drive, &idescsi_transfer_pc, get_timeout(pc), NULL); + ide_set_handler (drive, &idescsi_transfer_pc, get_timeout(pc), idescsi_expiry); OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* Issue the packet command */ return ide_started; } else { @@ -776,7 +810,7 @@ pc->request_transfer = pc->buffer_size = cmd->request_bufflen; pc->scsi_cmd = cmd; pc->done = done; - pc->timeout = jiffies + cmd->timeout_per_command; + pc->timeout = jiffies + cmd->timeout_per_command - IDESCSI_TIMEOUT_DELTA; if (should_transform(drive, cmd)) set_bit(PC_TRANSFORM, &pc->flags); -- Philip R. Auld, Ph.D. Egenera, Inc. Principal Software Engineer 165 Forest St. (508) 858-2628 Marlboro, MA 01752 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ide-scsi emulation hangs the kernel? 2003-12-10 23:36 Pat LaVarre 2003-12-11 14:13 ` Philip R. Auld @ 2003-12-11 19:31 ` Pat LaVarre 1 sibling, 0 replies; 4+ messages in thread From: Pat LaVarre @ 2003-12-11 19:31 UTC (permalink / raw) To: linux-scsi > > > Could anybody please tell me what's wrong with > > > the ide-scsi emulation in 2.4.21? > ... > no timeout handling in ide-scsi. And once it > times out the command gets re-issued with a > timeout that can go off immediately. This patch > fixes the problem on my system. It's for 2.4.9 ... Patch! Thank you. > I didn't see the original email, ... http://marc.theaimsgroup.com/?t=107100962500008 begins with: http://marc.theaimsgroup.com/?l=linux-scsi&m=107100959521497 List: linux-scsi Subject: ide-scsi emulation hangs the kernel? From: Yuri Prushinsky <prushinsky () hotbox ! ru> Date: 2003-12-09 22:36:44 Pat LaVarre ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-12-11 19:31 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2003-12-09 22:36 ide-scsi emulation hangs the kernel? Yuri Prushinsky -- strict thread matches above, loose matches on Subject: below -- 2003-12-10 23:36 Pat LaVarre 2003-12-11 14:13 ` Philip R. Auld 2003-12-11 19:31 ` Pat LaVarre
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox