PERFORCE change 99318 for review
John Baldwin
jhb at freebsd.org
Thu Jun 15 21:19:55 UTC 2006
On Thursday 15 June 2006 16:51, Paolo Pisati wrote:
> http://perforce.freebsd.org/chv.cgi?CH=99318
>
> Change 99318 by piso at 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
More information about the p4-projects
mailing list