Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Mar 2007 16:23:15 GMT
From:      Paolo Pisati <piso@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 115528 for review
Message-ID:  <200703081623.l28GNFG2065787@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=115528

Change 115528 by piso@piso_newluxor on 2007/03/08 16:22:25

	As we didn't reach a consensus about interrupt stray handling:
	
	o axe MI interrupt stray code and leave a noisy printf instead
	o axe the MD stray interrupt code for i386 and amd64

Affected files ...

.. //depot/projects/soc2006/intr_filter/amd64/amd64/intr_machdep.c#25 edit
.. //depot/projects/soc2006/intr_filter/i386/i386/intr_machdep.c#32 edit
.. //depot/projects/soc2006/intr_filter/kern/kern_intr.c#35 edit

Differences ...

==== //depot/projects/soc2006/intr_filter/amd64/amd64/intr_machdep.c#25 (text+ko) ====

@@ -75,11 +75,8 @@
 static struct mtx intr_table_lock;
 static STAILQ_HEAD(, pic) pics;
 
-extern struct callout stray_callout_handle;
-
 static void intr_eoi_src(void *arg);
 static void intr_disab_eoi_src(void *arg);
-void intr_callout_reset(void);
 static void intr_event_stray(void *cookie);
 
 #ifdef SMP
@@ -222,33 +219,7 @@
 	return (isrc->is_pic->pic_config_intr(isrc, trig, pol));
 }
 
-/* Stray detection MD code */
-static struct intr_event *
-walk_intr_src(void)
-{
-	struct intsrc *isrc;
-	static int i = 0;
-
-	while (i < NUM_IO_INTS) {
-		mtx_lock_spin(&intr_table_lock);
-		isrc = interrupt_sources[i++];
-		mtx_unlock_spin(&intr_table_lock);	
-		if (isrc != NULL && isrc->is_event != NULL)
-			return (isrc->is_event);
-	}
-	i = 0;
-	return (NULL);
-}
-
 void
-intr_callout_reset(void)
-{
-
-	callout_reset(&stray_callout_handle, hz, &stray_detection, 
-	    &walk_intr_src);
-}
-
-void
 intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame)
 {
 	struct thread *td;
@@ -398,7 +369,6 @@
 	intrcnt_index = 1;
 	STAILQ_INIT(&pics);
 	mtx_init(&intr_table_lock, "intr table", NULL, MTX_SPIN);
-	callout_init(&stray_callout_handle, 1);
 }
 SYSINIT(intr_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_init, NULL)
 

==== //depot/projects/soc2006/intr_filter/i386/i386/intr_machdep.c#32 (text+ko) ====

@@ -66,11 +66,8 @@
 static struct mtx intr_table_lock;
 static STAILQ_HEAD(, pic) pics;
 
-extern struct callout stray_callout_handle;
-
 static void intr_eoi_src(void *arg);
 static void intr_disab_eoi_src(void *arg);
-void intr_callout_reset(void);
 static void intr_event_stray(void *cookie);
 
 #ifdef SMP
@@ -213,22 +210,6 @@
 	return (isrc->is_pic->pic_config_intr(isrc, trig, pol));
 }
 
-/* Stray detection MD code */
-static struct intr_event *
-walk_intrs_src(void)
-{
-	struct intsrc *isrc;
-	static int i = 0;
-
-	while (i < NUM_IO_INTS) {
-		isrc = interrupt_sources[i++];
-		if (isrc != NULL && isrc->is_event != NULL)
-			return (isrc->is_event);
-	}
-	i = 0;
-	return (NULL);
-}
-
 void
 intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame)
 {
@@ -281,14 +262,6 @@
 		    isrc->is_pic->pic_vector(isrc));
 }
 
-void
-intr_callout_reset(void)
-{
-
-	callout_reset(&stray_callout_handle, hz, 
-	    &stray_detection, &walk_intrs_src);
-}
-
 static void
 intr_eoi_src(void *arg)
 {
@@ -384,8 +357,6 @@
 	intrcnt_index = 1;
 	STAILQ_INIT(&pics);
 	mtx_init(&intr_table_lock, "intr table", NULL, MTX_SPIN);
-	callout_init(&stray_callout_handle, 1);
-	// XXX - we don't drain the callout...
 }
 SYSINIT(intr_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_init, NULL)
 

==== //depot/projects/soc2006/intr_filter/kern/kern_intr.c#35 (text+ko) ====

@@ -58,10 +58,6 @@
 #include <ddb/db_sym.h>
 #endif
 
-/* Stray detection */
-struct callout stray_callout_handle;
-static int backoff = 1;
-
 /* MD function */
 extern void intr_callout_reset(void);
 
@@ -927,46 +923,6 @@
 	return (FILTER_STRAY);
 }
 
-/* Stray storm detection */
-void
-stray_detection(void *_arg) 
-{
-	struct intr_thread *ithd = NULL;
-	struct intr_event *ie;
-	void *(*walk_src)(void) = _arg;
-	int thread;
-
-	/* analyze all the interrupt sources... */
-	while ((ie = walk_src()) != NULL) {
-		/* is this interrupt marked as being throttled? */
-		if (ie != NULL && ie->ie_count == INT_MAX) {
-			/* and is the interrupt still pending? */
-			if (ie->ie_pending(ie->ie_source)) {
-				/* 
-				 * yes, it's still pending: call filters...
-				 */
-				thread = intr_filter_loop(ie, NULL /* XXX frame */, &ithd);
-				if (thread & FILTER_STRAY) {
-					/* 
-					 * no filter claimed the intr, 
-					 * backoff with a longer timeout 
-					 */
-					backoff++; // XXX we need thresholds...
-					callout_reset(&stray_callout_handle, hz*backoff, 
-						      &stray_detection, _arg);
-					continue;
-				}
-			}
-			/*
-			 * a filter claimed the intr, or the intr was not
-			 * pending anymore: unmask it
-			 */
-			ie->ie_count = 0;
-			ie->ie_enable(ie->ie_source);
-		}
-	}
-}
-
 /*
  * Main interrupt handling body.
  *
@@ -1012,15 +968,9 @@
 	
 	/* Interrupt storm logic */
 	if (thread & FILTER_STRAY) {
-		if (ie->ie_enable == NULL || ie->ie_pending == NULL)
-			printf("Interrupt stray detection not present:"
-			       "check ie_enable and ie_pending\n");
-		else {
-			printf("Interrupt stray detected on \"%s\";"
-			       "throttling interrupt source\n", ie->ie_name);
-			ie->ie_count = INT_MAX;    
-			intr_callout_reset();
-		}
+		ie->ie_count++;
+		if (ie->ie_count < intr_storm_threshold)
+			printf("Interrupt stray detection not present\n");
 	}
 
 	/* Schedule an ithread if needed. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200703081623.l28GNFG2065787>