From owner-p4-projects@FreeBSD.ORG Sun Aug 6 16:16:01 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 411C416A4E2; Sun, 6 Aug 2006 16:16:01 +0000 (UTC) X-Original-To: perforce@freebsd.org 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 E116C16A4DA for ; Sun, 6 Aug 2006 16:16:00 +0000 (UTC) (envelope-from piso@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8ECAF43D46 for ; Sun, 6 Aug 2006 16:16:00 +0000 (GMT) (envelope-from piso@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k76GG0OX086658 for ; Sun, 6 Aug 2006 16:16:00 GMT (envelope-from piso@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k76GG0Wv086655 for perforce@freebsd.org; Sun, 6 Aug 2006 16:16:00 GMT (envelope-from piso@freebsd.org) Date: Sun, 6 Aug 2006 16:16:00 GMT Message-Id: <200608061616.k76GG0Wv086655@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to piso@freebsd.org using -f From: Paolo Pisati To: Perforce Change Reviews Cc: Subject: PERFORCE change 103345 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Aug 2006 16:16:01 -0000 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); }