Subject: locking bug in com.c?
To: None <tech-kern@NetBSD.org>
From: Martin Husemann <martin@duskware.de>
List: tech-kern
Date: 08/14/2007 01:11:46
--pWyiEgJYm5f9v55/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi folks,
I have no idea why it seems to work for others (or so I've been told) - I'd
expect it to blow up on any machine with serial console on a com device.
For me it blows up with a LOCKDEBUG assertion:
simple_lock: lock held
lock: 0xc0037d88, currently at: ../../../../dev/ic/com.c:366
last locked: ../../../../dev/ic/com.c:796
last unlocked: ../../../../dev/ic/com.c:373
pid -964633480 not found
Stopped in pid 2.1 (init) at netbsd:cpu_Debugger+0x4: jr ra
bdslot: nop
db> bt
cpu_Debugger+4 (f801,b1100000,0,104) ra 801d5db4 sz 0
_simple_lock+274 (f801,b1100000,0,104) ra 8011a758 sz 48
com_config+c8 (f801,b1100000,0,104) ra 8011bb7c sz 40
comopen+238 (f801,3,0,104) ra 8025ae90 sz 112
The fix seems obvious - but others told me it works for them, so I might
be missing something.
Martin
--pWyiEgJYm5f9v55/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="com.patch"
Index: com.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/com.c,v
retrieving revision 1.261
diff -c -u -p -r1.261 com.c
--- com.c 14 Jul 2007 21:02:37 -0000 1.261
+++ com.c 13 Aug 2007 23:04:08 -0000
@@ -363,14 +363,12 @@ com_enable_debugport(struct com_softc *s
/* Turn on line break interrupt, set carrier. */
s = splserial();
- COM_LOCK(sc);
sc->sc_ier = IER_ERXRDY;
if (sc->sc_type == COM_TYPE_PXA2x0)
sc->sc_ier |= IER_EUART | IER_ERXTOUT;
CSR_WRITE_1(&sc->sc_regs, COM_REG_IER, sc->sc_ier);
SET(sc->sc_mcr, MCR_DTR | MCR_RTS);
CSR_WRITE_1(&sc->sc_regs, COM_REG_MCR, sc->sc_mcr);
- COM_UNLOCK(sc);
splx(s);
}
--pWyiEgJYm5f9v55/--