Date: Fri, 16 Jul 2004 23:29:58 -0600 (MDT) From: "M. Warner Losh" <imp@bsdimp.com> To: green@freebsd.org Cc: current@freebsd.org Subject: Re: pccbb crashes when detaching (unsafe interrupt handler) Message-ID: <20040716.232958.16681208.imp@bsdimp.com> In-Reply-To: <20040715180854.GZ1626@green.homeunix.org> References: <20040715180854.GZ1626@green.homeunix.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20040715180854.GZ1626@green.homeunix.org> Brian Fundakowski Feldman <green@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040716.232958.16681208.imp>