Am Montag, 26. September 2016 schrieb David Gwynne :

>
> > On 26 Sep 2016, at 13:36, Ted Unangst <t...@tedunangst.com
> <javascript:;>> wrote:
> >
> > David Gwynne wrote:
> >> +            mtx_enter(&timeout_mutex);
> >> +            while (!CIRCQ_EMPTY(&timeout_proc)) {
> >> +                    to = timeout_from_circq(CIRCQ_
> FIRST(&timeout_proc));
> >> +                    CIRCQ_REMOVE(&to->to_list);
> >       leave();
> >> +                    timeout_run(to);
> >       enter();
> >> +            }
> >> +            mtx_leave(&timeout_mutex);
> >
> > you need to drop the mutex when running the timeout. with those changes,
> looks
> > pretty good.
>
> timeout_run drops the mutex.



There is another bug, the thread runs outside of IPL_SOFTCLOCK, the
interrupt handler already runs at IPL_SOFTCLOCK so it did not need to raise
it, but the thread does.

The mutex is not enough as it will drop before running the handler, this
can cause intr timeouts to interrupt proc timeouts.

I suggest raising it on the thread startup and leaving it always up. That's
why my diff had added IPL support for tasks btw.

Reply via email to