isp(4) - kernel panic on initialization of driver

Ross westr at connection.ca
Tue Sep 2 16:52:08 UTC 2008


AS> I think your doing some great work but I don't think this is the
AS> *right* direction to take.  The bottom line is the ISP should have
AS> interrupts disabled until it completes a full reset and loads the
AS> firmware, period.  You shouldn't have to ignore ASYNC events during a
AS> reset - that doesn't make sense to me....yet....!

I've created a small patch that so far seems to be working (survived
~10+ reboots). From what I can tell, using the ISP_ENABLE_INTS &
ISP_DISABLE_INTS functions won't do anything to stop the problem.

Basically my hypotheses is that the ASYNC command is already sitting
around in the mailbox of the card waiting to be read, so no interrupt
is actually being generated during the time the driver is starting up
- so you can't disable it.

(The card is active with a valid running rom before freebsd gets it's
paws on it, so it's probably already cleanly read it, but hasn't acted
upon it)

The crash is located with the very first mailbox read, where if it
doesn't recognize the mailbox response, it parses it anyways
(in case it's something that needs to be done), and exit out if
there's an error.

But the isp_parse_async() function makes the assumption that isp_state
== ISP_RUNSTATE, so it's safe to do anything. Where in fact is
actually gets called when not in ISP_RUNSTATE (with the assumption
that no problematic async command could be generated at this point).

I'm guessing the true fix would be upon startup to somehow make sure
the mailbox queue is emptied before attempting to query the card
(for the firmware version).  But how to do that is beyond me.

Let me know what you think.

Ross.

-= start
[~/isp]$ diff -u isp.c.orig isp.c
--- isp.c.orig  2008-08-22 16:32:57.000000000 -0400
+++ isp.c       2008-09-02 11:48:18.000000000 -0400
@@ -4557,8 +4557,10 @@
                                isp_prt(isp, ISP_LOGWARN,
                                    "mailbox cmd (0x%x) with no waiters", mbox);
                        }
-               } else if (isp_parse_async(isp, mbox) < 0) {
-                       return;
+               } else if (isp->isp_state == ISP_RUNSTATE) {
+                       if (isp_parse_async(isp, mbox) < 0) {
+                               return;
+                       }
                }
                if ((IS_FC(isp) && mbox != ASYNC_RIO_RESP) ||
                    isp->isp_state != ISP_RUNSTATE) {
-=


-- 
  Ross West                          Tel:   +1 416 967 6767
  Network Manager                    Fax:   +1 416 967 7777
  Network Connection                 Email: westr at connection.ca



More information about the freebsd-scsi mailing list