Subject: Re: kern/37462: use of com at pcmcia hangs system
To: None <,,>
From: Takehiko NOZAKI <>
List: netbsd-bugs
Date: 12/31/2007 10:20:03
The following reply was made to PR kern/37462; it has been noted by GNATS.

From: Takehiko NOZAKI <>
Subject: Re: kern/37462: use of com at pcmcia hangs system
Date: Mon, 31 Dec 2007 19:13:26 +0900

 > When I attempt to use a GSM UMTS modem, the system hangs so hard that I
 > can't even enter ddb.  The modem is a PCMCIA card that attaches as com
 > at pcmcia.
 my ThinkPad s30 + NetIndex AX530IN pcmcia modem card have same problem too.
 > I first noticed the problem using pppd, but I can replicate the problem
 > using cu.  I get the same problem with the jmcneill-pm branch as with a
 > kernel from HEAD.
 > This used to work a few months ago.
 this problem introduced by merging vmlocking branch:
     src/sys/dev/ic/com.c r1.262 -> r1.263
 it uses mutex_spin_enter(9) instead of simple_lock(9).
 but this change is not good for tsleep(9) in src/sys/dev/pci/pccbb.c line 1370.
 (mutex_spin_enter -> tsleep -> mi_switch -> cpu_switchto -> hangup)
 i don't know how to solve this problem, but here is a workaround.
 apply following patch and recompile your kernel.
 Index: com.c
 RCS file: /cvsroot/src/sys/dev/ic/com.c,v
 retrieving revision 1.268
 diff -u -r1.268 com.c
 --- com.c	14 Dec 2007 03:36:54 -0000	1.268
 +++ com.c	30 Dec 2007 18:49:46 -0000
 @@ -724,7 +724,9 @@
  		if (!sc->enabled)
  			panic("com_shutdown: not enabled?");
 +		mutex_spin_exit(&sc->sc_lock);
 +		mutex_spin_enter(&sc->sc_lock);
  		sc->enabled = 0;
 @@ -772,13 +774,14 @@
  		if (sc->enable) {
 +			mutex_spin_exit(&sc->sc_lock);
  			if ((*sc->enable)(sc)) {
 -				mutex_spin_exit(&sc->sc_lock);
  				printf("%s: device enable failed\n",
  				return (EIO);
 +			mutex_spin_enter(&sc->sc_lock);
  			sc->enabled = 1;
 this make ppp work again as far as my environment.
 ...but i don't know this is ok for multi-processor, other bus/architecture.
 very truly yours.
 Takehiko NOZAKI <>