PERFORCE change 65191 for review

John Baldwin jhb at FreeBSD.org
Mon Nov 15 11:20:20 PST 2004


http://perforce.freebsd.org/chv.cgi?CH=65191

Change 65191 by jhb at 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);


More information about the p4-projects mailing list