From owner-p4-projects@FreeBSD.ORG Thu Jun 15 21:19:55 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 4D45116A481; Thu, 15 Jun 2006 21:19:55 +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 0ED9516A47C; Thu, 15 Jun 2006 21:19:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6719A43D73; Thu, 15 Jun 2006 21:19:46 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.4/8.13.4) with ESMTP id k5FLJiYL050549; Thu, 15 Jun 2006 17:19:45 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Paolo Pisati Date: Thu, 15 Jun 2006 17:01:38 -0400 User-Agent: KMail/1.9.1 References: <200606152051.k5FKpxJu097604@repoman.freebsd.org> In-Reply-To: <200606152051.k5FKpxJu097604@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200606151701.39207.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Thu, 15 Jun 2006 17:19:45 -0400 (EDT) X-Virus-Scanned: ClamAV 0.87.1/1541/Thu Jun 15 15:36:31 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx Cc: Perforce Change Reviews Subject: Re: 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 21:19:55 -0000 On Thursday 15 June 2006 16:51, Paolo Pisati wrote: > 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. If you move all the code to handle fast interrupts to sys/kern/kern_intr.c first, then you only have to do this step once rather than N times. > 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 > -- John Baldwin