Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Aug 2006 16:16:00 GMT
From:      Paolo Pisati <piso@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 103345 for review
Message-ID:  <200608061616.k76GG0Wv086655@repoman.freebsd.org>

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

Change 103345 by piso@piso_newluxor on 2006/08/06 16:15:31

	Add a comment when stray detection kicks in, and make
	some more code MI: adding a parameter to struct intr_event and
	an argument to intr_even_create will do the rest.
	
	Last commit before my summer break, see you @ 18/8 :)

Affected files ...

.. //depot/projects/soc2006/intr_filter/i386/i386/intr_machdep.c#11 edit

Differences ...

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

@@ -78,6 +78,13 @@
 static void	intrcnt_updatename(struct intsrc *is);
 static void	intrcnt_register(struct intsrc *is);
 
+#if 0
+struct stray_stuff ss = {
+	.check_pending = isrc->is_pic->pic_source_pending(),
+	.enable_src = isrc->is_pic->pic_enable_source()
+};
+#endif
+
 /*
  * Register a new interrupt source with the global interrupt system.
  * The global interrupts need to be disabled when this function is
@@ -183,18 +190,29 @@
 }
 
 static void
-stray_detection(void *arg __unused) 
+stray_detection(void *_arg) 
 {
 	struct intsrc *isrc;
 	struct intr_event *ie;
+	void *(*walk_src)(void) = _arg;
 	int thread;
 
+/* 
+ * XXX adding a parameter to struct intr_event, will make this MI, but
+ * to do that it's necessary to break intr_event_create and add an arg like:
+ *
+ * 	int (*is_pending)(void *);
+ *
+ * in that case, walk_src will return a "struct intr_event *", and...
+ */
+
 	/* analyze all the interrupt sources... */
-	while ((isrc = walk_intr_src()) != NULL) {
+	while ((isrc = walk_src()) != NULL) {
 		ie = isrc->is_event;
 		/* is this interrupt marked as being throttled? */
 		if (ie != NULL && ie->ie_count == INT_MAX) {
 			/* and is the interrupt still pending? */
+			/* XXX ... here we'll call "ie->is_pending(ie->ie_source)" */
 			if (isrc->is_pic->pic_source_pending(isrc)) {
 				/* 
 				 * yes, it's still pending: call filters...
@@ -207,7 +225,7 @@
 					 */
 					backoff++; // XXX we need thresholds...
 					callout_reset(&callout_handle, hz*backoff, 
-						      &stray_detection, NULL);
+						      &stray_detection, _arg);
 					continue;
 				}
 			}
@@ -216,7 +234,7 @@
 			 * pending anymore: unmask it
 			 */
 			ie->ie_count = 0;
-			isrc->is_pic->pic_enable_source(isrc);
+			ie->ie_enable(ie->ie_source);
 		}
 	}
 }
@@ -280,13 +298,13 @@
 	else
 		isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
 	critical_exit();
-
 	
 	/* Interrupt storm logic */
 	if (thread & FILTER_STRAY) {
+		printf("Interrupt stray detected on \"%s\"; throttling interrupt source\n", ie->ie_name);
 		ie->ie_count = INT_MAX;    
 		mtx_lock_spin(&intr_table_lock);
-		callout_reset(&callout_handle, hz, &stray_detection, NULL);
+		callout_reset(&callout_handle, hz, &stray_detection, &walk_intr_src);
 		mtx_unlock_spin(&intr_table_lock);
 	}
 



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