--- /home/shino/work/freebsd/src/sys/kern/kern_intr.c Thu Sep 9 19:03:19 2004 +++ /home/shino/work/packetmerge/sys/kern/kern_intr.c Sat Oct 30 11:53:59 2004 @@ -485,14 +485,23 @@ ithread_loop(void *arg) struct intrhand *ih; /* and our interrupt handler chain */ struct thread *td; struct proc *p; +#ifndef HACK2 int count, warming, warned; +#else + int count, curr_ticks, warned; +#endif td = curthread; p = td->td_proc; ithd = (struct ithd *)arg; /* point to myself */ KASSERT(ithd->it_td == td && td->td_ithd == ithd, ("%s: ithread and proc linkage out of sync", __func__)); +#ifndef HACK2 warming = 10 * intr_storm_threshold; +#else + count = 0; + curr_ticks = ticks; +#endif warned = 0; /* @@ -514,7 +523,9 @@ ithread_loop(void *arg) CTR4(KTR_INTR, "%s: pid %d: (%s) need=%d", __func__, p->p_pid, p->p_comm, ithd->it_need); +#ifndef HACK2 count = 0; +#endif while (ithd->it_need) { /* * Service interrupts. If another interrupt @@ -548,6 +559,7 @@ restart: if ((ih->ih_flags & IH_MPSAFE) == 0) mtx_unlock(&Giant); } +#ifndef HACK2 if (ithd->it_enable != NULL) { ithd->it_enable(ithd->it_vector); @@ -567,6 +579,16 @@ restart: } } +#else + if(intr_storm_threshold <= 0) + goto enable_intr; + + if(curr_ticks != ticks) { + count = 0; + curr_ticks = ticks; + goto enable_intr; + } +#endif /* HACK2 */ /* * If we detect an interrupt storm, sleep until * the next hardclock tick. We sleep at the @@ -595,9 +617,21 @@ restart: * away unless the interrupt repeats * less often the hardclock interrupt. */ +#ifndef HACK2 count = INT_MAX - 1; } +#else +#ifndef HACK3 + curr_ticks = ticks; +#endif /* HACK3 */ + } else +#endif /* HACK2 */ count++; +#ifdef HACK2 +enable_intr: + if (ithd->it_enable != NULL) + ithd->it_enable(ithd->it_vector); +#endif /* HACK2 */ } WITNESS_WARN(WARN_PANIC, NULL, "suspending ithread"); mtx_assert(&Giant, MA_NOTOWNED);