Date: Wed, 27 Oct 2004 17:41:42 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 63834 for review Message-ID: <200410271741.i9RHfgIw005552@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=63834 Change 63834 by jhb@jhb_slimer on 2004/10/27 17:41:06 Put bde's hacks to istorm under #ifdef HACK and bring back the simpler code by default. Affected files ... .. //depot/projects/smpng/sys/kern/kern_intr.c#53 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_intr.c#53 (text+ko) ==== @@ -485,14 +485,22 @@ struct intrhand *ih; /* and our interrupt handler chain */ struct thread *td; struct proc *p; +#ifdef HACK int count, warming, warned; +#else + int count, 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__)); +#ifdef HACK warming = 10 * intr_storm_threshold; +#else + count = 0; +#endif warned = 0; /* @@ -514,7 +522,9 @@ CTR4(KTR_INTR, "%s: pid %d: (%s) need=%d", __func__, p->p_pid, p->p_comm, ithd->it_need); +#ifdef HACK count = 0; +#endif while (ithd->it_need) { /* * Service interrupts. If another interrupt @@ -548,9 +558,29 @@ if ((ih->ih_flags & IH_MPSAFE) == 0) mtx_unlock(&Giant); } + +#ifndef HACK + /* + * If we detect an interrupt storm, pause with the + * source masked until the next hardclock tick. + */ + if (intr_storm_threshold != 0 && + count >= intr_storm_threshold) { + if (!warned) { + printf( + "Interrupt storm detected on \"%s\"; throttling interrupt source\n", + p->p_comm); + warned = 1; + } + tsleep(&count, td->td_priority, "istorm", 1); + count = 0; + } else + count++; +#endif + if (ithd->it_enable != NULL) { ithd->it_enable(ithd->it_vector); - +#ifdef HACK /* * Storm detection needs a delay here * to see slightly delayed interrupts @@ -565,8 +595,10 @@ DELAY(1); --warming; } +#endif } +#ifdef HACK /* * If we detect an interrupt storm, sleep until * the next hardclock tick. We sleep at the @@ -574,7 +606,8 @@ * to ensure that we see slightly delayed * interrupts. */ - if (count >= intr_storm_threshold) { + if (intr_storm_threshold != 0 && + count >= intr_storm_threshold) { if (!warned) { printf( "Interrupt storm detected on \"%s\"; throttling interrupt source\n", @@ -598,6 +631,7 @@ count = INT_MAX - 1; } count++; +#endif } WITNESS_WARN(WARN_PANIC, NULL, "suspending ithread"); mtx_assert(&Giant, MA_NOTOWNED); @@ -610,6 +644,9 @@ mtx_lock_spin(&sched_lock); if (!ithd->it_need) { TD_SET_IWAIT(td); +#ifndef HACK + count = 0; +#endif CTR2(KTR_INTR, "%s: pid %d: done", __func__, p->p_pid); mi_switch(SW_VOL, NULL); CTR2(KTR_INTR, "%s: pid %d: resumed", __func__, p->p_pid);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200410271741.i9RHfgIw005552>