From owner-p4-projects@FreeBSD.ORG Mon Jun 19 13:51:14 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 59BE216A482; Mon, 19 Jun 2006 13:51:14 +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 191F816A484 for ; Mon, 19 Jun 2006 13:51:14 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from wx-out-0102.google.com (wx-out-0102.google.com [66.249.82.202]) by mx1.FreeBSD.org (Postfix) with ESMTP id CF4CC43D45 for ; Mon, 19 Jun 2006 13:51:12 +0000 (GMT) (envelope-from asmrookie@gmail.com) Received: by wx-out-0102.google.com with SMTP id i31so810682wxd for ; Mon, 19 Jun 2006 06:51:12 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=JkEI/b/YOluSqBK5DysIFwTdOOxpyDqGXp9/maMmICCS0ZpiYjhT2scrF6gNbuLgysu0u8yfTwVxVl6dMCWqL8LlF7pkx2wliTXBM5sA0WRnTxuoUi4MTvJC/Kg0yYlBAv97upmdSRFRDcAfxdoVdJtCzOA2nmK4RnBkVwBy85g= Received: by 10.70.74.14 with SMTP id w14mr8590080wxa; Mon, 19 Jun 2006 06:51:12 -0700 (PDT) Received: by 10.70.11.15 with HTTP; Mon, 19 Jun 2006 06:51:12 -0700 (PDT) Message-ID: <3bbf2fe10606190651i2135e03fr3572504208a31fa2@mail.gmail.com> Date: Mon, 19 Jun 2006 15:51:12 +0200 From: "Attilio Rao" Sender: asmrookie@gmail.com To: "Paolo Pisati" , perforce@freebsd.org In-Reply-To: <200606191326.k5JDQSKI069433@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200606191326.k5JDQSKI069433@repoman.freebsd.org> X-Google-Sender-Auth: dc9ec380a149e5c1 Cc: Subject: Re: PERFORCE change 99599 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, 19 Jun 2006 13:51:14 -0000 2006/6/19, Paolo Pisati : > http://perforce.freebsd.org/chv.cgi?CH=99599 > > Change 99599 by piso@piso_newluxor on 2006/06/19 13:26:07 > > Turn interrupt filtering execution MD code into MI code: > now i've to convert all the remaining archs. > > Affected files ... > > .. //depot/projects/soc2006/intr_filter/i386/i386/intr_machdep.c#3 edit > .. //depot/projects/soc2006/intr_filter/kern/kern_intr.c#3 edit > .. //depot/projects/soc2006/intr_filter/sys/interrupt.h#2 edit > > Differences ... > > ==== //depot/projects/soc2006/intr_filter/i386/i386/intr_machdep.c#3 (text+ko) ==== > > @@ -170,9 +170,7 @@ > { > struct thread *td; > struct intr_event *ie; > - struct intr_handler *ih; > - int error, vector, thread, ret; > - void *arg; > + int error, vector, thread; > > td = curthread; > > @@ -214,44 +212,7 @@ > td->td_intr_nesting_level++; > thread = 0; > critical_enter(); > - TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) { > - /* > - * 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; > - } > - > - /* 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; > - } > - } > - > + thread = intr_filter_loop(ie, frame); > /* > * If there are any threaded handlers that need to run, > * mask the source as well as sending it an EOI. Otherwise, > > ==== //depot/projects/soc2006/intr_filter/kern/kern_intr.c#3 (text+ko) ==== > > @@ -764,6 +764,64 @@ > } > } > > +/* > + * Main loop for interrupt filter. > + * > + * Some architectures (i386, amd64 and arm) require the optional frame > + * parameter, and use it as the main argument for fast handler execution > + * when ih_argument == NULL. > + * > + * Return: 0 (everything done) or 1 (schedule ithread) > + */ > + > +int > +intr_filter_loop(struct intr_event *ie, struct trapframe *frame) { > + struct intr_handler *ih; > + void *arg; > + int ret, ret2 = 0; > + > + TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) { > + /* > + * 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 */ > + ret2 = 1; > + continue; > + } > + > + /* try with the next handler... */ > + if (ret == FILTER_STRAY) > + continue; Maybe you would like to initialize ret before compare since the case of (ih->ih_flags & IH_FAST) == 0 is not completely consistent, I think. And, please, keep in mind that style(9) suggests avoiding variables initialization in their declarations. Attilio -- Peace can only be achieved by understanding - A. Einstein