* RE: [PATCH] AHA152x driver hangs on PCMCIA card eject, kernel 2.4.22-pre6
@ 2003-07-15 22:07 Bhavesh P. Davda
0 siblings, 0 replies; 3+ messages in thread
From: Bhavesh P. Davda @ 2003-07-15 22:07 UTC (permalink / raw)
To: linux-kernel; +Cc: fischer, dahinds, Marcelo Tosatti
[-- Attachment #1: Type: text/plain, Size: 1988 bytes --]
Whoops! Sent it without proof-reading. I AM SORRY! Please ignore the
previous patch, here is the correct patch ...
Thanks
- Bhavesh
--
Bhavesh P. Davda E-mail : bhavesh@avaya.com
Avaya Inc. Phone/Fax : (303) 538-4438
Room B3-B03, 1300 West 120th Avenue
Westminster, CO 80234
> -----Original Message-----
> From: Bhavesh P. Davda
> Sent: Tuesday, July 15, 2003 3:57 PM
> To: linux-kernel@vger.kernel.org
> Cc: fischer@norbit.de; dahinds@users.sourceforge.net; Marcelo Tosatti
> Subject: [PATCH] AHA152x driver hangs on PCMCIA card eject, kernel
> 2.4.22-pre6
>
>
> Juergen, David; please review this patch, and recommend that
> Marcelo apply this patch if you think it is okay... Thanks!
>
> Attached is a patch against linux-2.4.22-pre6, to fix a hang
> problem when an Adaptec SlimSCSI (PCMCIA) adapter is ejected from
> a PCMCIA card reader (e.g. yenta/TI1225 based).
>
> The fix involves:
>
> 1. A change to the common aha152x driver to ignore an interrupt
> in the top-half handler if it cannot read valid data from the I/O
> ports (possibly due to a bad host-adapter chip or an ejected
> PCMCIA card). This way, a shared interrupt handler (e.g. yenta)
> can pick up the interrupt if the IRQ is really meant for it. This
> is where the original hang was taking place; the aha152x bottom
> half was getting into an infinite loop, though the SlimSCSI card
> had been ejected, and the actual IRQ was meant for yenta.
>
> 2. A change to the aha152x_cs stub driver to not use the SCSI
> error-handling thread code. The aha152x_cs driver calls
> scsi_unregister_module() as a queued timer task when it gets a
> CS_EVENT_CARD_REMOVAL event, which causes scsi_unregister_host()
> to do a down() on a semaphore, calling schedule(), when executing
> the timer_bh for the timer.
>
> Thanks!
>
> - Bhavesh
> --
> Bhavesh P. Davda E-mail : bhavesh@avaya.com
> Avaya Inc. Phone/Fax : (303) 538-4438
> Room B3-B03, 1300 West 120th Avenue
> Westminster, CO 80234
[-- Attachment #2: linux-2.4.22-aha152x.patch --]
[-- Type: application/octet-stream, Size: 2073 bytes --]
diff -Naur linux-2.4.22-pre6/drivers/scsi/aha152x.c linux-2.4.22-bpd/drivers/scsi/aha152x.c
--- linux-2.4.22-pre6/drivers/scsi/aha152x.c 2003-06-13 08:51:36.000000000 -0600
+++ linux-2.4.22-bpd/drivers/scsi/aha152x.c 2003-07-15 16:05:09.000000000 -0600
@@ -1930,12 +1930,30 @@
static void intr(int irqno, void *dev_id, struct pt_regs *regs)
{
struct Scsi_Host *shpnt = lookup_irq(irqno);
+ unsigned char rev, dmacntrl0;
if (!shpnt) {
printk(KERN_ERR "aha152x: catched interrupt %d for unknown controller.\n", irqno);
return;
}
+ /*
+ * Read a couple of registers that are known to not be all 1's. If
+ * we read all 1's (-1), that means that either:
+ * a. The host adapter chip has gone bad, and we cannot control it,
+ * OR
+ * b. The host adapter is a PCMCIA card that has been ejected
+ * In either case, we cannot do anything with the host adapter at
+ * this point in time. So just ignore the interrupt and return.
+ * In the latter case, the interrupt might actually be meant for
+ * someone else sharing this IRQ, and that driver will handle it
+ */
+ rev = GETPORT(REV);
+ dmacntrl0 = GETPORT(DMACNTRL0);
+ if ((rev == 0xFF) && (dmacntrl0 == 0xFF)) {
+ return;
+ }
+
/* no more interrupts from the controller, while we're busy.
INTEN is restored by the BH handler */
CLRBITS(DMACNTRL0, INTEN);
diff -Naur linux-2.4.22-pre6/drivers/scsi/pcmcia/aha152x_stub.c linux-2.4.22-bpd/drivers/scsi/pcmcia/aha152x_stub.c
--- linux-2.4.22-pre6/drivers/scsi/pcmcia/aha152x_stub.c 2001-12-21 10:41:55.000000000 -0700
+++ linux-2.4.22-bpd/drivers/scsi/pcmcia/aha152x_stub.c 2003-07-15 14:41:20.000000000 -0600
@@ -244,6 +244,11 @@
/* Configure card */
driver_template.module = &__this_module;
+ /*
+ * Don't use the SCSI error handling thread. This causes schedule() to
+ * be called from the timer_bh when the AHA152x card is ejected
+ */
+ driver_template.use_new_eh_code = 0;
link->state |= DEV_CONFIG;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] AHA152x driver hangs on PCMCIA card eject, kernel 2.4.22-pre6
2003-07-15 21:56 Bhavesh P. Davda
@ 2003-07-16 13:16 ` Alan Cox
0 siblings, 0 replies; 3+ messages in thread
From: Alan Cox @ 2003-07-16 13:16 UTC (permalink / raw)
To: Bhavesh P. Davda
Cc: Linux Kernel Mailing List, fischer, dahinds, Marcelo Tosatti
On Maw, 2003-07-15 at 22:56, Bhavesh P. Davda wrote:
> 2. A change to the aha152x_cs stub driver to not use the SCSI error-handling
> thread code. The aha152x_cs driver calls scsi_unregister_module() as a
> queued timer task when it gets a CS_EVENT_CARD_REMOVAL event, which causes
> scsi_unregister_host() to do a down() on a semaphore, calling schedule(),
> when executing the timer_bh for the timer.
Right - scsi_unregister should not be called on a timer event, instead
it needs to kick off a task queue
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] AHA152x driver hangs on PCMCIA card eject, kernel 2.4.22-pre6
@ 2003-07-15 21:56 Bhavesh P. Davda
2003-07-16 13:16 ` Alan Cox
0 siblings, 1 reply; 3+ messages in thread
From: Bhavesh P. Davda @ 2003-07-15 21:56 UTC (permalink / raw)
To: linux-kernel; +Cc: fischer, dahinds, Marcelo Tosatti
[-- Attachment #1: Type: text/plain, Size: 1346 bytes --]
Juergen, David; please review this patch, and recommend that Marcelo apply
this patch if you think it is okay... Thanks!
Attached is a patch against linux-2.4.22-pre6, to fix a hang problem when an
Adaptec SlimSCSI (PCMCIA) adapter is ejected from a PCMCIA card reader (e.g.
yenta/TI1225 based).
The fix involves:
1. A change to the common aha152x driver to ignore an interrupt in the
top-half handler if it cannot read valid data from the I/O ports (possibly
due to a bad host-adapter chip or an ejected PCMCIA card). This way, a
shared interrupt handler (e.g. yenta) can pick up the interrupt if the IRQ
is really meant for it. This is where the original hang was taking place;
the aha152x bottom half was getting into an infinite loop, though the
SlimSCSI card had been ejected, and the actual IRQ was meant for yenta.
2. A change to the aha152x_cs stub driver to not use the SCSI error-handling
thread code. The aha152x_cs driver calls scsi_unregister_module() as a
queued timer task when it gets a CS_EVENT_CARD_REMOVAL event, which causes
scsi_unregister_host() to do a down() on a semaphore, calling schedule(),
when executing the timer_bh for the timer.
Thanks!
- Bhavesh
--
Bhavesh P. Davda E-mail : bhavesh@avaya.com
Avaya Inc. Phone/Fax : (303) 538-4438
Room B3-B03, 1300 West 120th Avenue
Westminster, CO 80234
[-- Attachment #2: linux-2.4.22-aha152x.patch --]
[-- Type: application/octet-stream, Size: 1814 bytes --]
diff -Naur linux-2.4.22-pre6/drivers/scsi/aha152x.c linux-2.4.22-bpd/drivers/scsi/aha152x.c
--- linux-2.4.22-pre6/drivers/scsi/aha152x.c 2003-06-13 08:51:36.000000000 -0600
+++ linux-2.4.22-bpd/drivers/scsi/aha152x.c 2003-07-15 14:38:27.000000000 -0600
@@ -1936,6 +1936,23 @@
return;
}
+ /*
+ * Read a couple of registers that are known to not be all 1's. If
+ * we read all 1's (-1), that means that either:
+ * a. The host adapter chip has gone bad, and we cannot control it,
+ * OR
+ * b. The host adapter is a PCMCIA card that has been ejected
+ * In either case, we cannot do anything with the host adapter at
+ * this point in time. So just ignore the interrupt and return.
+ * In the latter case, the interrupt might actually be meant for
+ * someone else sharing this IRQ, and that driver will handle it
+ */
+ rev = GETPORT(REV);
+ dmacntrl0 = GETPORT(DMACNTRL0);
+ if ((rev == 0xFF) && (dmacntrl0 == 0xFF)) {
+ return;
+ }
+
/* no more interrupts from the controller, while we're busy.
INTEN is restored by the BH handler */
CLRBITS(DMACNTRL0, INTEN);
diff -Naur linux-2.4.22-pre6/drivers/scsi/pcmcia/aha152x_stub.c linux-2.4.22-bpd/drivers/scsi/pcmcia/aha152x_stub.c
--- linux-2.4.22-pre6/drivers/scsi/pcmcia/aha152x_stub.c 2001-12-21 10:41:55.000000000 -0700
+++ linux-2.4.22-bpd/drivers/scsi/pcmcia/aha152x_stub.c 2003-07-15 14:41:20.000000000 -0600
@@ -244,6 +244,11 @@
/* Configure card */
driver_template.module = &__this_module;
+ /*
+ * Don't use the SCSI error handling thread. This causes schedule() to
+ * be called from the timer_bh when the AHA152x card is ejected
+ */
+ driver_template.use_new_eh_code = 0;
link->state |= DEV_CONFIG;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-07-16 13:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-15 22:07 [PATCH] AHA152x driver hangs on PCMCIA card eject, kernel 2.4.22-pre6 Bhavesh P. Davda
-- strict thread matches above, loose matches on Subject: below --
2003-07-15 21:56 Bhavesh P. Davda
2003-07-16 13:16 ` Alan Cox
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).