Re: 6-CURRENT unbelievably slow?

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 15 Nov 2004 14:24:49 -0500
On Thursday 11 November 2004 05:37 pm, Kris Kennaway wrote:
> On Thu, Nov 11, 2004 at 01:39:09PM +0100, Alexander_at_Leidinger.net wrote:
> > Zitat von Joe Marcus Clarke <marcus_at_freebsd.org>:
> > > I noticed the interrupt storm detection line in dmesg.  In previous
> > > builds, this worked, but it doesn't seem to be taking effect anymore.
> >
> > AFAIK the interrupt storm detection was removed (at least partially).
>
> s/removed/fixed so it doesn't give so many false positives/
>
> (at least partially) ;-)
>
> Talk to jhb..

Please try this patch out and let me know if it does any better:

--- //depot/vendor/freebsd/src/sys/kern/kern_intr.c	2004/11/05 19:15:40
+++ //depot/projects/smpng/sys/kern/kern_intr.c	2004/11/15 19:20:11
_at__at_ -485,7 +485,7 _at__at_
 	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;
_at__at_ -494,6 +494,7 _at__at_
 	    ("%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
_at__at_ -549,10 +550,26 _at__at_
 			}
 
 			/*
-			 * 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(
_at__at_ -560,7 +577,7 _at__at_
 					    p->p_comm);
 					warned = 1;
 				}
-				tsleep(&count, td->td_priority, "istorm", 1);
+				storming = 1;
 				count = 0;
 			} else
 				count++;
_at__at_ -580,6 +597,7 _at__at_
 		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);

-- 
John Baldwin <jhb_at_FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
Received on Mon Nov 15 2004 - 18:45:13 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:22 UTC