pccbb crashes when detaching (unsafe interrupt handler)
M. Warner Losh
imp at bsdimp.com
Fri Jul 16 22:32:39 PDT 2004
In message: <20040715180854.GZ1626 at green.homeunix.org>
Brian Fundakowski Feldman <green at freebsd.org> writes:
: if (sc->flags & CBB_CARD_OK) {
: + int needgiant = 0;
: +
: + sx_slock(&sc->intrsx);
: STAILQ_FOREACH(ih, &sc->intr_handlers, entries) {
: - if ((ih->flags & INTR_MPSAFE) == 0)
: - mtx_lock(&Giant);
: - (*ih->intr)(ih->arg);
: - if ((ih->flags & INTR_MPSAFE) == 0)
: - mtx_unlock(&Giant);
: + if ((ih->flags & INTR_MPSAFE) == 0) {
: + needgiant = 1;
: + break;
: + }
: + }
: + if (!needgiant) {
: + STAILQ_FOREACH(ih, &sc->intr_handlers, entries)
: + (*ih->intr)(ih->arg);
: + sx_sunlock(&sc->intrsx);
: + return;
: }
: + sx_sunlock(&sc->intrsx);
: + mtx_lock(&Giant);
: + sx_slock(&sc->intrsx);
: + STAILQ_FOREACH(ih, &sc->intr_handlers, entries)
: + (*ih->intr)(ih->arg);
: + sx_sunlock(&sc->intrsx);
: + mtx_unlock(&Giant);
: }
: }
I also don't like this patch because it takes out GIANT for the
duration of ALL handlers, not just the ones that need that. Why is
that necesary?
Warner
More information about the freebsd-current
mailing list