Date: Mon, 3 Jul 2006 09:47:46 GMT From: Paolo Pisati <piso@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 100481 for review Message-ID: <200607030947.k639lk9s065820@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607030947.k639lk9s065820>