Here's a patch I'd like people getting tons of stray interrupt
    messages to try.  All it does is limit the number and frequency
    of reports so the screen doesn't fill up with spam.

                                                -Matt

Index: kern/kern_intr.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_intr.c,v
retrieving revision 1.48
diff -u -r1.48 kern_intr.c
--- kern/kern_intr.c    30 Apr 2007 16:45:53 -0000      1.48
+++ kern/kern_intr.c    1 May 2007 17:59:07 -0000
@@ -69,6 +69,8 @@
        int             i_fast;
        int             i_slow;
        int             i_state;
+       int             i_errorticks;
+       unsigned long   i_straycount;
 } intr_info_ary[MAX_INTS];
 
 int max_installed_hard_intr;
@@ -81,6 +83,7 @@
 static void emergency_intr_timer_callback(systimer_t, struct intrframe *);
 static void ithread_handler(void *arg);
 static void ithread_emergency(void *arg);
+static void report_stray_interrupt(int intr, struct intr_info *info);
 
 int intr_info_size = sizeof(intr_info_ary) / sizeof(intr_info_ary[0]);
 
@@ -487,8 +490,7 @@
     ++info->i_count;
     if (info->i_state != ISTATE_NOTHREAD) {
        if (info->i_reclist == NULL) {
-           kprintf("sched_ithd: stray interrupt %d on cpu %d\n",
-                   intr, mycpuid);
+           report_stray_interrupt(intr, info);
        } else {
 #ifdef SMP
            if (info->i_thread.td_gd == mycpu) {
@@ -510,11 +512,33 @@
 #endif
        }
     } else {
-       kprintf("sched_ithd: stray interrupt %d on cpu %d\n",
-               intr, mycpuid);
+       report_stray_interrupt(intr, info);
     }
 }
 
+static void
+report_stray_interrupt(int intr, struct intr_info *info)
+{
+       ++info->i_straycount;
+       if (info->i_straycount < 10) {
+               if (info->i_errorticks == ticks)
+                       return;
+               info->i_errorticks = ticks;
+               kprintf("sched_ithd: stray interrupt %d on cpu %d\n",
+                       intr, mycpuid);
+       } else if (info->i_straycount < 100) {
+               if (info->i_errorticks == ticks)
+                       return;
+               info->i_errorticks = ticks;
+               kprintf("sched_ithd: %ld stray interrupts %d on cpu %d\n",
+                       info->i_straycount, intr, mycpuid);
+       } else if (info->i_straycount == 100) {
+               kprintf("sched_ithd: %ld stray interrupts %d on cpu %d - "
+                       "there will be no further reports\n",
+                       info->i_straycount, intr, mycpuid);
+       }
+}
+
 /*
  * This is run from a periodic SYSTIMER (and thus must be MP safe, the BGL
  * might not be held).
@@ -759,6 +783,9 @@
            ++ill_count;
            info->i_running = 0;
 
+           if (*list == NULL)
+               report_stray_interrupt(intr, info);
+
            for (rec = *list; rec; rec = nrec) {
                nrec = rec->next;
                if (rec->serializer) {

Reply via email to