Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Jul 2004 09:57:30 -0400
From:      John Baldwin <jhb@FreeBSD.org>
To:        Bosko Milekic <bmilekic@FreeBSD.org>
Cc:        "M. Warner Losh" <imp@bsdimp.com>
Subject:   Re: pccbb crashes when detaching (unsafe interrupt handler)
Message-ID:  <200407190957.30459.jhb@FreeBSD.org>
In-Reply-To: <20040717193351.GA83772@freefall.freebsd.org>
References:  <20040717193351.GA83772@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407190957.30459.jhb>