From owner-p4-projects@FreeBSD.ORG Tue Nov 2 16:46:15 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 27A251065672; Tue, 2 Nov 2010 16:46:15 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFB91106564A for ; Tue, 2 Nov 2010 16:46:14 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id B29918FC1D for ; Tue, 2 Nov 2010 16:46:14 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id oA2GkEqJ069392 for ; Tue, 2 Nov 2010 16:46:14 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id oA2GkEfm069389 for perforce@freebsd.org; Tue, 2 Nov 2010 16:46:14 GMT (envelope-from jhb@freebsd.org) Date: Tue, 2 Nov 2010 16:46:14 GMT Message-Id: <201011021646.oA2GkEfm069389@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 185332 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2010 16:46:15 -0000 http://p4web.freebsd.org/@@185332?ac=10 Change 185332 by jhb@jhb_jhbbsd on 2010/11/02 16:45:24 Revert, Jeff did this differently. Affected files ... .. //depot/projects/smpng/sys/kern/kern_intr.c#106 edit .. //depot/projects/smpng/sys/sys/interrupt.h#32 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_intr.c#106 (text+ko) ==== @@ -720,57 +720,6 @@ } /* - * If an interrupt handler is currently running, wait for it to finish - * executing. - */ -void -intr_handler_drain(void *cookie) -{ - struct intr_handler *ih; - struct intr_event *ie; - struct intr_thread *it; - - ih = (struct intr_handler *)cookie; - if (ih == NULL || cold) - return; - ie = ih->ih_event; - KASSERT(ie != NULL, - ("interrupt handler \"%s\" has a NULL interrupt event", - ih->ih_name)); - - /* XXX: Punt on handlers that only have a filter for now. */ - if (ih->ih_handler == NULL) - return; - -#ifdef INTR_FILTER - if (ih->ih_thread) - it = ih->ih_thread; - else -#endif - it = ie->ie_thread; - - mtx_lock(&ie->ie_lock); - thread_lock(it->it_thread); - - /* If the thread is idle, then the interrupt handler is not running. */ - if (!TD_AWAITING_INTR(it->it_thread)) { - ih->ih_flags |= IH_DRAINING; - - /* - * Ensure the thread will process the handler list - * again if it has already passed this handler. - */ - it->it_need = 1; - thread_unlock(it->it_thread); - - while (ih->ih_flags & IH_DRAINING) - msleep(ih, &ie->ie_lock, 0, "idrain", 0); - } else - thread_unlock(it->it_thread); - mtx_unlock(&ie->ie_lock); -} - -/* * Return the ie_source field from the intr_event an intr_handler is * associated with. */ @@ -1203,7 +1152,7 @@ if (ih->ih_flags & IH_DEAD) { mtx_lock(&ie->ie_lock); TAILQ_REMOVE(&ie->ie_handlers, ih, ih_next); - ih->ih_flags &= ~(IH_DEAD | IH_DRAINING); + ih->ih_flags &= ~IH_DEAD; wakeup(ih); mtx_unlock(&ie->ie_lock); return; @@ -1219,13 +1168,6 @@ ih->ih_handler(ih->ih_argument); if (!(ih->ih_flags & IH_MPSAFE)) mtx_unlock(&Giant); - - if (ih->ih_flags & IH_DRAINING) { - mtx_lock(&ie->ie_lock); - ih->ih_flags &= ~IH_DRAINING; - wakeup(ih); - mtx_unlock(&ie->ie_lock); - } } #endif @@ -1246,7 +1188,7 @@ if (ih->ih_flags & IH_DEAD) { mtx_lock(&ie->ie_lock); TAILQ_REMOVE(&ie->ie_handlers, ih, ih_next); - ih->ih_flags &= ~(IH_DEAD | IH_DRAINING); + ih->ih_flags &= ~IH_DEAD; wakeup(ih); mtx_unlock(&ie->ie_lock); continue; @@ -1278,13 +1220,6 @@ ih->ih_handler(ih->ih_argument); if (!(ih->ih_flags & IH_MPSAFE)) mtx_unlock(&Giant); - - if (ih->ih_flags & IH_DRAINING) { - mtx_lock(&ie->ie_lock); - ih->ih_flags &= ~IH_DRAINING; - wakeup(ih); - mtx_unlock(&ie->ie_lock); - } } } @@ -1749,7 +1684,7 @@ db_printsym((uintptr_t)ih->ih_handler, DB_STGY_PROC); db_printf("(%p)", ih->ih_argument); if (ih->ih_need || - (ih->ih_flags & (IH_EXCLUSIVE | IH_ENTROPY | IH_DEAD | IH_DRAINING | + (ih->ih_flags & (IH_EXCLUSIVE | IH_ENTROPY | IH_DEAD | IH_MPSAFE)) != 0) { db_printf(" {"); comma = 0; @@ -1771,12 +1706,6 @@ db_printf("DEAD"); comma = 1; } - if (ih->ih_flags & IH_DRAINING) { - if (comma) - db_printf(", "); - db_printf("DRAINING"); - comma = 1; - } if (ih->ih_flags & IH_MPSAFE) { if (comma) db_printf(", "); ==== //depot/projects/smpng/sys/sys/interrupt.h#32 (text+ko) ==== @@ -59,7 +59,6 @@ #define IH_EXCLUSIVE 0x00000002 /* Exclusive interrupt. */ #define IH_ENTROPY 0x00000004 /* Device is a good entropy source. */ #define IH_DEAD 0x00000008 /* Handler should be removed. */ -#define IH_DRAINING 0x00000010 /* Has waiting drainer. */ #define IH_MPSAFE 0x80000000 /* Handler does not need Giant. */ /* @@ -176,7 +175,6 @@ int intr_event_handle(struct intr_event *ie, struct trapframe *frame); int intr_event_remove_handler(void *cookie); int intr_getaffinity(int irq, void *mask); -void intr_handler_drain(void *cookie); void *intr_handler_source(void *cookie); int intr_setaffinity(int irq, void *mask); int swi_add(struct intr_event **eventp, const char *name,