Port-macppc archive

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

Re: tstile lockups - side note



On Jun 29,  3:10pm, martin%duskware.de@localhost (Martin Husemann) wrote:
-- Subject: Re: tstile lockups - side note

| On Sat, Jun 29, 2013 at 02:12:53AM +0000, Christos Zoulas wrote:
| > >If you want to reproduce it, just boot any kernel with LOCKDEBUG and
| > >do "cat /dev/audio".  Boom.
| > >
| > 
| > That looks like snapper-specific. What is the lockdebug message? It could
| > be that we need to make the mutex in ki2c.c a spin mutex.
| 
| I can reproduce it and have serial console:
| The lock is initialized here:
| 
| db{0}> x/i 0x000000000047f418
| netbsd:snapper_attach+0x254:    lwz     r3, 0x0(r31)
| 
| last locked is:
| db{0}> x/i 0x0000000000190b44        
| netbsd:audiosetinfo+0x32c:      or      r3, r31, r31

So sc->sc_intr_lock is held and this is a spin mutex at ipl_audio.
lockdebug complains about trying to grab the sc->sc_buslock adaptive
mutex. Here's a kludge.

christos
Index: ki2c.c
===================================================================
RCS file: /cvsroot/src/sys/arch/macppc/dev/ki2c.c,v
retrieving revision 1.18
diff -u -u -r1.18 ki2c.c
--- ki2c.c      26 Jul 2011 08:36:02 -0000      1.18
+++ ki2c.c      29 Jun 2013 20:24:24 -0000
@@ -380,7 +380,8 @@
 {
        struct ki2c_softc *sc = cookie;
 
-       mutex_enter(&sc->sc_buslock);
+       if (flags == 0)
+               mutex_enter(&sc->sc_buslock);
        return 0;
 }
 
@@ -389,7 +390,8 @@
 {
        struct ki2c_softc *sc = cookie;
 
-       mutex_exit(&sc->sc_buslock);
+       if (flags == 0)
+               mutex_exit(&sc->sc_buslock);
 }
 
 int
Index: snapper.c
===================================================================
RCS file: /cvsroot/src/sys/arch/macppc/dev/snapper.c,v
retrieving revision 1.38
diff -u -u -r1.38 snapper.c
--- snapper.c   24 Nov 2011 03:35:57 -0000      1.38
+++ snapper.c   29 Jun 2013 20:24:25 -0000
@@ -1886,10 +1886,11 @@
                        return 0;
                }
        }
-       iic_acquire_bus(sc->sc_i2c, 0);
+       int owned = mutex_owned(sc->sc_intr_lock);
+       iic_acquire_bus(sc->sc_i2c, owned);
        iic_exec(sc->sc_i2c, I2C_OP_WRITE, sc->sc_deqaddr, regblock, size + 1,
            NULL, 0, 0);
-       iic_release_bus(sc->sc_i2c, 0);
+       iic_release_bus(sc->sc_i2c, owned);
        
        return 0;
 }


Home | Main Index | Thread Index | Old Index