From owner-p4-projects@FreeBSD.ORG Thu Jun 15 20:52:00 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 728DA16A479; Thu, 15 Jun 2006 20:52:00 +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 4DAE916A41A for ; Thu, 15 Jun 2006 20:52: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 0111343D45 for ; Thu, 15 Jun 2006 20:52: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 k5FKpxgQ097607 for ; Thu, 15 Jun 2006 20:51:59 GMT (envelope-from piso@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5FKpxJu097604 for perforce@freebsd.org; Thu, 15 Jun 2006 20:51:59 GMT (envelope-from piso@freebsd.org) Date: Thu, 15 Jun 2006 20:51:59 GMT Message-Id: <200606152051.k5FKpxJu097604@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 99318 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: Thu, 15 Jun 2006 20:52:00 -0000 http://perforce.freebsd.org/chv.cgi?CH=99318 Change 99318 by piso@piso_newluxor on 2006/06/15 20:51:44 Make i386 aware of filters, checking the return code: -FILTER_STRAY: interrupt was not for us, ignore it -FILTER_HANDLED: interrupt completely served -FILTER_SCHEDULE_THREAD: there's more work to do, stamp this handler and schedule the ithread hanlder to run Legacy INTR_FAST were all changed to return FILTER_HANDLED or FILTER_STRAY, while legacy ithread handlers should work with no problem. Affected files ... .. //depot/projects/soc2006/intr_filter/i386/i386/intr_machdep.c#2 edit .. //depot/projects/soc2006/intr_filter/kern/kern_intr.c#2 edit Differences ... ==== //depot/projects/soc2006/intr_filter/i386/i386/intr_machdep.c#2 (text+ko) ==== @@ -171,7 +171,8 @@ struct thread *td; struct intr_event *ie; struct intr_handler *ih; - int error, vector, thread; + int error, vector, thread, ret; + void *arg; td = curthread; @@ -210,27 +211,45 @@ return; } - /* - * Execute fast interrupt handlers directly. - * To support clock handlers, if a handler registers - * with a NULL argument, then we pass it a pointer to - * a trapframe as its argument. - */ td->td_intr_nesting_level++; - thread = 0; + thread = 0; critical_enter(); TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) { - if (!(ih->ih_flags & IH_FAST)) { + /* + * Execute fast interrupt handlers directly. + * To support clock handlers, if a handler registers + * with a NULL argument, then we pass it a pointer to + * a trapframe as its argument. + */ + arg = ((ih->ih_argument == NULL) ? frame : ih->ih_argument); + + CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__, + 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 */ thread = 1; continue; } - CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__, - ih->ih_handler, ih->ih_argument == NULL ? frame : - ih->ih_argument, ih->ih_name); - if (ih->ih_argument == NULL) - ih->ih_handler(frame); - else - ih->ih_handler(ih->ih_argument); + + /* try with the next handler... */ + if (ret == FILTER_STRAY) + continue; + + /* interrupt served, get out of here... */ + if (ret == FILTER_HANDLED) { + thread = 0; + break; + } + + /* mark handler for later execution */ + if (ret == FILTER_SCHEDULE_THREAD) { + ih->ih_need = 1; + thread = 1; + } } /* ==== //depot/projects/soc2006/intr_filter/kern/kern_intr.c#2 (text+ko) ==== @@ -636,6 +636,8 @@ 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