Port-powerpc archive

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

Re: panic mutex



KIYOHARA Takashi wrote:

> mtxm_owner (or mtxp_a) is initialized in mutex_init().  However, it
> becomes dirty when seting the address to sc->sc_lock.
> [...]
> Can I resolve this problem?

Yes. There seems to be a bug in joy_isa_attach():

static void
joy_isa_attach(device_t parent, device_t self, void *aux)
{
        struct joy_softc *sc = device_private(self);
        struct joy_isa_softc *isc = device_private(self);
[...]
       sc->sc_lock = &isc->sc_lock;
        joyattach(sc);
}

sc and isc share the same address. This cannot be right.

This is the reason why assigning sc->sc_lock changes something in isc. From
the offset of sc_lock you are likely to hit the kmutex in isc.

I would suggest to fix the joy_isa_softc structure. For example by making
struct joy_softc a part of it:

struct joy_isa_softc {
        struct joy_softc        sc;
        kmutex_t                sc_lock;
};

Then use isc->sc instead of sc.

-- 
Frank Wille



Home | Main Index | Thread Index | Old Index