tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Fix for PR kern/38273



On Thu, Sep 11, 2008 at 04:32:08PM +0200, Manuel Bouyer wrote:
> On Thu, Sep 11, 2008 at 11:57:03AM +0100, Matthias Scheler wrote:
> > 
> >     Hello,
> > 
> > Juan RP suggested a simple fix for PR kern/38273:
> > 
> >  Index: ld.c
> >  ===================================================================
> >  RCS file: /cvsroot/src/sys/dev/ld.c,v
> >  retrieving revision 1.63
> >  diff -b -u -p -r1.63 ld.c
> >  --- ld.c        9 Sep 2008 12:45:39 -0000       1.63
> >  +++ ld.c        10 Sep 2008 16:06:25 -0000
> >  @@ -99,7 +99,7 @@ ldattach(struct ld_softc *sc)
> >   {
> >          char tbuf[9];
> > 
> >   
> >  -       mutex_init(&sc->sc_mutex, MUTEX_DEFAULT, IPL_VM);
> >  +       mutex_init(&sc->sc_mutex, MUTEX_DEFAULT, IPL_NONE);
> > 
> >   
> >          if ((sc->sc_flags & LDF_ENABLED) == 0) {
> >                  aprint_normal_dev(sc->sc_dv, "disabled\n");
> > 
> > Considering that other pseudo drivers (e.g. raid(4)) use IPL_NONE, too,
> > this seems to be reasonabl to me.
> 
> raid(4) has it own thread; while ld(4) can run in interrupt context.
> So I'm not sure IPL_NONE would be appropriate here.

There is at least one path from interrupt to mutex_enter:

<interrupt> -> ld_ataraid_iodone_raid0 -> lddone -> mutex_enter(&sc->sc_mutex);

So this mutex must remain a spin mutex.

-- 
Juergen Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig 
(Germany)


Home | Main Index | Thread Index | Old Index