Ben Smithurst wrote:

> Greg Lehey wrote:
> 
>> Sorry, I missed the beginning of this.  Could somebody send me the
>> patch?  I'd assume that a relatively simple check would handle the
>> issue, based on what I've seen here.
> 
> I've lost the actual patch, I basically just added
> 
>       if (ir == NULL)
>               return;
> 
> in sched_ithd() before it ever de-references ir.  I've some up with a
> slightly bigger patch which adds stray IRQ logging too, but I haven't
> tested that yet.

Here's the slightly bigger patch, which seems to be working fine so far.

-- 
Ben Smithurst / [EMAIL PROTECTED] / PGP: 0x99392F7D
Index: ithread.c
===================================================================
RCS file: /usr/cvs/src/sys/i386/isa/ithread.c,v
retrieving revision 1.1
diff -u -r1.1 ithread.c
--- ithread.c   2000/09/07 01:32:48     1.1
+++ ithread.c   2000/09/10 12:57:59
@@ -95,6 +95,8 @@
 
 SYSINIT(start_softintr, SI_SUB_SOFTINTR, SI_ORDER_FIRST, start_softintr, NULL)
 
+#define        MAX_STRAY_LOG   5
+
 /*
  * Schedule a heavyweight interrupt process.  This function is called
  * from the interrupt handlers Xintr<num>.
@@ -104,6 +106,7 @@
 {
        int irq = (int) cookie;         /* IRQ we're handling */
        ithd *ir = ithds[irq];          /* and the process that does it */
+       static int straycount[NHWI];
 
        /* This used to be in icu_vector.s */
        /*
@@ -144,6 +147,20 @@
        }
 #endif
                
+       if (ir == NULL) {
+               if (irq < NHWI) {
+                       if (straycount[irq] < MAX_STRAY_LOG) {
+                               printf("stray irq %d\n", irq);
+                               if (++straycount[irq] == MAX_STRAY_LOG)
+                                       printf("got %d stray irq %d's: "
+                                         "not logging anymore\n",
+                                         MAX_STRAY_LOG, irq);
+                       }
+                       return;
+               }
+               panic("sched_ithd: ithds[%d] == NULL", irq);
+       }
+
        /*
         * Set it_need so that if the thread is already running but close
         * to done, it will do another go-round.  Then get the sched lock

Reply via email to