From owner-p4-projects@FreeBSD.ORG Mon Nov 15 19:20:19 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7E18516A4D1; Mon, 15 Nov 2004 19:20:19 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5522716A4CE for ; Mon, 15 Nov 2004 19:20:19 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2A31843D1D for ; Mon, 15 Nov 2004 19:20:19 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id iAFJKJx9001857 for ; Mon, 15 Nov 2004 19:20:19 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id iAFJKIJd001854 for perforce@freebsd.org; Mon, 15 Nov 2004 19:20:18 GMT (envelope-from jhb@freebsd.org) Date: Mon, 15 Nov 2004 19:20:18 GMT Message-Id: <200411151920.iAFJKIJd001854@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Subject: PERFORCE change 65191 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Nov 2004 19:20:20 -0000 http://perforce.freebsd.org/chv.cgi?CH=65191 Change 65191 by jhb@jhb_slimer on 2004/11/15 19:20:11 Tweak interrupt storming some. Once we detect an interrupt storm, go into storming mode for at least one second or until it stops interrupting each time we enable the interrupt source. While in storming mode, we only allow one interrupt per clock tick. Before, we would allow storm_threshold interrupts per clock tick which wasn't that great. Affected files ... .. //depot/projects/smpng/sys/kern/kern_intr.c#59 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_intr.c#59 (text+ko) ==== @@ -485,7 +485,7 @@ struct intrhand *ih; /* and our interrupt handler chain */ struct thread *td; struct proc *p; - int count, warned; + int count, warned, storming; td = curthread; p = td->td_proc; @@ -494,6 +494,7 @@ ("%s: ithread and proc linkage out of sync", __func__)); count = 0; warned = 0; + storming = 0; /* * As long as we have interrupts outstanding, go through the @@ -549,10 +550,26 @@ } /* - * If we detect an interrupt storm, pause with the - * source masked until the next hardclock tick. + * Interrupt storm handling: + * + * If this interrupt source is currently storming, + * then throttle it to only fire the handler once + * per clock tick. Each second we go out of storming + * mode to see if the storm has subsided. + * + * If this interrupt source is not currently + * storming, but the number of back to back + * interrupts exceeds the storm threshold, then + * enter storming mode. */ - if (intr_storm_threshold != 0 && + if (storming) { + tsleep(&count, td->td_priority, "istorm", 1); + if (count > hz) { + storming = 0; + count = 0; + } else + count++; + } else if (intr_storm_threshold != 0 && count >= intr_storm_threshold) { if (!warned) { printf( @@ -560,7 +577,7 @@ p->p_comm); warned = 1; } - tsleep(&count, td->td_priority, "istorm", 1); + storming = 1; count = 0; } else count++; @@ -580,6 +597,7 @@ if (!ithd->it_need) { TD_SET_IWAIT(td); count = 0; + storming = 0; 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);