Re: pccbb crashes when detaching (unsafe interrupt handler)

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 19 Jul 2004 09:57:30 -0400
On Saturday 17 July 2004 03:33 pm, Bosko Milekic wrote:
> Brian Feldman wrote:
> >>From currentish kern_intr.c:
> >
> >                     if ((ih->ih_flags & IH_DEAD) != 0) {
> >                             mtx_lock(&ithd->it_lock);
> >                             TAILQ_REMOVE(&ithd->it_handlers, ih,
> >                               ih_next);
> >                             wakeup(ih);
> >                             mtx_unlock(&ithd->it_lock);
> >                             goto restart;
> >                     }
> >We add a flag IH_PIN:
> >                     if ((ih->ih_flags & (IH_DEAD | IH_PIN)) != 0) {
> >                             if ((ih->ih_flags & IH_DEAD) == 0) {
> >                                     wakeup(ih);
> >                                     continue;
> >                             }
> >                             mtx_lock(&ithd->it_lock);
> >                             TAILQ_REMOVE(&ithd->it_handlers,
> >                               ih, ih_next);
> >                             wakeup(ih);
> >                             mtx_unlock(&ithd->it_lock);
> >                             goto restart;
> >                     }
>
>     Neither -current nor your version should be holding the ithd lock
>     across the wakeup().

Yes, in general there are (low-priority) changes to reduce the assertions for 
cv and sleep wakeups to not assert that the condition protecting lock is held 
and to change code like this to not hold the lock across the wakeup.

-- 
John Baldwin <jhb_at_FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
Received on Mon Jul 19 2004 - 11:57:31 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:02 UTC