, Andrew Doran <ad@NetBSD.org>
From: Chris Ross <cross+netbsd@distal.com>
List: port-sparc64
Date: 12/22/2007 00:39:45
--Apple-Mail-3-951453702
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed
On Dec 21, 2007, at 10:27, Chris Ross wrote:
> On Dec 21, 2007, at 07:54, Matt Fleming wrote:
>> On Fri, Dec 21, 2007 at 12:36:49PM +0000, Robert Swindells wrote:
>>>> bt
>>> lockdebug_abort(...)
>>> mutex_vector_enter(...)
>>> zstty_softint(...) at zstty_softint+0x10
>>
>> The tty_lock mutex was already entered in zsopen() and
>> zstty_softint()
>> tries to enter it again.
>>
>> Is it just safe to remove the calls to mutex_spin_{enter/exit} in
>> zstty_softint(), since tty_lock is held throughout anyway and I can't
>> see any other code that calls zstty_softint?
>
> Whether or not that is safe, it doesn't solve the problem in its
> entirety.
> db> bt
> lockdebug_abort(...) at netbsd:lockdebug_abort+0x54
> mutex_vector_enter(...) at netbsd:mutex_vector_enter+0x158
> nullmodem(...) at netbsd:nullmodem+0x8
> zstty_softint(...) at netbsd:zstty_softint+0x380
> zsparam(...) at netbsd:zsparam+0x218
> zsopen(...) at netbsd:zsopen+0x200
So, I looked into this a little more. There are mutex_spin_enter()
and mutex_spin_exit() calls in sys/kern/tty.c in both nullmodem() and
ttymodem(). Either or both of those will cause the same:
Mutex error: mutex_vector_enter: locking against myself
crash if the calls are only removed from zstty_softint(). I
experimented with taking those out as well, despite presuming that
was the "wrong thing to do," and the machine comes up to multi-user,
but crashes with an unlocked mutex as soon as I try to log in.
The following change to sys/dev/ic/z8530tty.c causes the machine
to come up multi-user, and I can ssh in and do things. But, I was
just guessing at something to try, and would want someone who knows
much more about the recent vmlocking branch merges to give an
opinion. Andrew?
- Chris
--Apple-Mail-3-951453702
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
x-unix-mode=0644;
name=z8530tty.diff
Content-Disposition: attachment;
filename=z8530tty.diff
Index: sys/dev/ic/z8530tty.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/z8530tty.c,v
retrieving revision 1.117
diff -u -r1.117 z8530tty.c
--- sys/dev/ic/z8530tty.c 19 Nov 2007 18:51:48 -0000 1.117
+++ sys/dev/ic/z8530tty.c 22 Dec 2007 05:38:58 -0000
@@ -1886,7 +1886,9 @@
/*
* Inform the tty layer that carrier detect changed.
*/
+ mutex_spin_exit(&tty_lock);
(void) (*tp->t_linesw->l_modem)(tp, ISSET(rr0, ZSRR0_DCD));
+ mutex_spin_enter(&tty_lock);
}
if (ISSET(delta, cs->cs_rr0_cts)) {
@@ -1919,8 +1921,6 @@
struct zstty_softc *zst = cs->cs_private;
struct tty *tp = zst->zst_tty;
- mutex_spin_enter(&tty_lock);
-
if (zst->zst_rx_ready) {
zst->zst_rx_ready = 0;
zstty_rxsoft(zst, tp);
@@ -1935,8 +1935,6 @@
zst->zst_tx_done = 0;
zstty_txsoft(zst, tp);
}
-
- mutex_spin_exit(&tty_lock);
}
struct zsops zsops_tty = {
--Apple-Mail-3-951453702--