From owner-p4-projects@FreeBSD.ORG Mon Jul 3 09:48:42 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 05A4316A47E; Mon, 3 Jul 2006 09:48:42 +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 D5BBB16A47B for ; Mon, 3 Jul 2006 09:48:41 +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 474D743E4C for ; Mon, 3 Jul 2006 09:47:51 +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 k639lkeO065824 for ; Mon, 3 Jul 2006 09:47:46 GMT (envelope-from piso@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k639lk9s065820 for perforce@freebsd.org; Mon, 3 Jul 2006 09:47:46 GMT (envelope-from piso@freebsd.org) Date: Mon, 3 Jul 2006 09:47:46 GMT Message-Id: <200607030947.k639lk9s065820@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 100481 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: Mon, 03 Jul 2006 09:48:42 -0000 http://perforce.freebsd.org/chv.cgi?CH=100481 Change 100481 by piso@piso_newluxor on 2006/07/03 09:47:15 Execute filters in intr_filter_loop(). In case the filter returns FILTER_SCHEDULE_THREAD, stamp the interrupt handler (ih_need=1) so we can easily find/execute it later in intr_execute_handlers(). Affected files ... .. //depot/projects/soc2006/intr_filter/kern/kern_intr.c#5 edit Differences ... ==== //depot/projects/soc2006/intr_filter/kern/kern_intr.c#5 (text+ko) ==== @@ -637,13 +637,11 @@ continue; } - // XXX - with filters, we will execute only - // handlers marked in ih_need too... /* - * For software interrupt threads, we only execute - * handlers that have their need flag set. Hardware - * interrupt threads always invoke all of their handlers. - */ + * For software interrupt threads, we only execute + * handlers that have their need flag set. Hardware + * interrupt threads always invoke all of their handlers. + */ if (ie->ie_flags & IE_SOFT) { if (!ih->ih_need) continue; @@ -653,8 +651,16 @@ /* Fast handlers are handled in primary interrupt context. */ if (ih->ih_flags & IH_FAST) - continue; + continue; + /* Execute handlers of filters that need it. */ + if (ih->ih_filter != NULL) { + if (!ih->ih_need) + continue; + else + atomic_store_rel_int(&ih->ih_need, 0); + } + /* Execute this handler. */ CTR6(KTR_INTR, "%s: pid %d exec %p(%p) for %s flg=%x", __func__, p->p_pid, (void *)ih->ih_handler, ih->ih_argument, @@ -782,6 +788,7 @@ int ret, ret2 = 0; TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) { + ih->ih_need = 0; /* * Execute fast interrupt handlers directly. * To support clock handlers, if a handler registers @@ -793,11 +800,10 @@ CTR5(KTR_INTR, "%s: exec %p/%p(%p) for %s", __func__, ih->ih_filter, ih->ih_handler, arg, ih->ih_name); - if (ih->ih_flags & IH_FAST) { - // XXX - actually should call ih_filter()... - ret = ((driver_filter_t *)ih->ih_handler)(arg); - } else { - /* old ithread handler */ + if (ih->ih_filter != NULL) + ret = ih->ih_filter(arg); + else { + /* legacy ithread handler */ ret2 = 1; continue; } @@ -806,11 +812,9 @@ if (ret == FILTER_STRAY) continue; - /* interrupt served, get out of here... */ - if (ret == FILTER_HANDLED) { - ret2 = 0; - break; - } + /* interrupt served in filter */ + if (ret == FILTER_HANDLED) + continue; /* mark handler for later execution */ if (ret == FILTER_SCHEDULE_THREAD) {