NetBSD Problem Report #37462

From apb@cequrux.com  Sun Dec  2 11:04:25 2007
Return-Path: <apb@cequrux.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 3B8B863B93C
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  2 Dec 2007 11:04:25 +0000 (UTC)
Message-Id: <20071202110009.2E6CF8A49D5@apb-laptoy.apb.alt.za>
Date: Sun,  2 Dec 2007 13:00:09 +0200 (SAST)
From: apb@cequrux.com
To: gnats-bugs@NetBSD.org
Subject: use of com at pcmcia hangs system
X-Send-Pr-Version: 3.95

>Number:         37462
>Category:       kern
>Synopsis:       use of com at pcmcia hangs system
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    ad
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 02 11:05:00 +0000 2007
>Closed-Date:    Sat Jan 05 22:20:02 +0000 2008
>Last-Modified:  Sat Jan 05 22:20:02 +0000 2008
>Originator:     Alan Barrett
>Release:        NetBSD 4.99.37
>Organization:
Not much
>Environment:
NetBSD 4.99.37 i386
Userland built from current as of 2007-11-25 00:00 UTC
kernel built from jmcneill-pm branch as of 2007-11-25 00:00 UTC
>Description:
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.

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.

>How-To-Repeat:
1.  Insert PCMCIA card.  The following messages appear on the console:

pcmcia0: CIS version PC Card Standard 6.1
pcmcia0: CIS info: Novatel Wireless, Merlin UMTS Modem, U630, 
pcmcia0: Manufacturer code 0xa4, product 0x276
pcmcia0: function 0: serial port, ccr addr 400 mask 263
pcmcia0: function 0, config table entry 7: I/O card; irq mask ffff; iomask 3, iospace 3f8-3ff; io8 irqpulse audio
pcmcia0: function 0, config table entry 15: I/O card; irq mask ffff; iomask 3, iospace 2f8-2ff; io8 irqpulse audio
pcmcia0: function 0, config table entry 23: I/O card; irq mask ffff; iomask 3, iospace 3e8-3ef; io8 irqpulse audio
pcmcia0: function 0, config table entry 31: I/O card; irq mask ffff; iomask 3, iospace 2e8-2ef; io8 irqpulse audio
pcmcia0: function 0, config table entry 39: I/O card; irq mask ffff; iomask 3, iospace 0-7; io8 irqpulse audio
pcmcia0: function 1: serial port, ccr addr 420 mask 263
pcmcia0: function 1, config table entry 7: I/O card; irq mask ffff; iomask 3, iospace 2f8-2ff; io8 irqpulse audio
pcmcia0: function 1, config table entry 15: I/O card; irq mask ffff; iomask 3, iospace 3f8-3ff; io8 irqpulse audio
pcmcia0: function 1, config table entry 23: I/O card; irq mask ffff; iomask 3, iospace 2e8-2ef; io8 irqpulse audio
pcmcia0: function 1, config table entry 31: I/O card; irq mask ffff; iomask 3, iospace 3e8-3ef; io8 irqpulse audio
pcmcia0: function 1, config table entry 39: I/O card; irq mask ffff; iomask 3, iospace 0-7; io8 irqpulse audio
com1 at pcmcia0 function 0: <Novatel Wireless, Merlin UMTS Modem, U630, >
com1: ns16550a, working fifo
com1: WARNING: powerhook_establish is deprecated
com1: WARNING: power management not supported
com2 at pcmcia0 function 1: <Novatel Wireless, Merlin UMTS Modem, U630, >
com2: ns16550a, working fifo
com2: WARNING: powerhook_establish is deprecated
com2: WARNING: power management not supported

    I don't know why it attaches as two com ports, but it has always
    done so, and I have always used only the first of the two ports.

2.  sudo cu -s 115200 -l /dev/dty01

    cu prints "Connected", but then the system freezes.  No kernel
    messages apear on the console, alt-control-escape (the magic key
    sequence to enter ddb) doesn't work, alt-control-F<n> (the magic
    key sequence to switch virtual consoles) doesn't work, ~. (the cu
    command to exit) doesn't work.

>Fix:
Unknown.  This used to work a few months ago.  Applying the patch
from revision 1.51 of src/sys/net/ppp_tty.c doesn't help.

>Release-Note:

>Audit-Trail:
From: Takehiko NOZAKI <th-nozaki@netwrk.co.jp>
To: gnats-bugs@NetBSD.org
Cc: apb@cequrux.com
Subject: Re: kern/37462: use of com at pcmcia hangs system
Date: Mon, 31 Dec 2007 19:13:26 +0900

 hi,

 > 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
     http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/ic/com.c.diff?r1=1.262&r2=1.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?");
  #endif
 +		mutex_spin_exit(&sc->sc_lock);
  		(*sc->disable)(sc);
 +		mutex_spin_enter(&sc->sc_lock);
  		sc->enabled = 0;
  	}
  	mutex_spin_exit(&sc->sc_lock);
 @@ -772,13 +774,14 @@
  		mutex_spin_enter(&sc->sc_lock);

  		if (sc->enable) {
 +			mutex_spin_exit(&sc->sc_lock);
  			if ((*sc->enable)(sc)) {
 -				mutex_spin_exit(&sc->sc_lock);
  				splx(s);
  				printf("%s: device enable failed\n",
  				       sc->sc_dev.dv_xname);
  				return (EIO);
  			}
 +			mutex_spin_enter(&sc->sc_lock);
  			sc->enabled = 1;
  			com_config(sc);
  		}

 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 <tnozaki@netbsd.org>

Responsible-Changed-From-To: kern-bug-people->ad
Responsible-Changed-By: ad@netbsd.org
Responsible-Changed-When: Wed, 02 Jan 2008 13:56:32 +0000
Responsible-Changed-Why:
take


State-Changed-From-To: open->feedback
State-Changed-By: ad@netbsd.org
State-Changed-When: Sat, 05 Jan 2008 12:43:35 +0000
State-Changed-Why:
Shoudl be fixed, can you please retry?


From: Andrew Doran <ad@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/37462 CVS commit: src/sys/dev/ic
Date: Sat,  5 Jan 2008 12:44:14 +0000 (UTC)

 Module Name:	src
 Committed By:	ad
 Date:		Sat Jan  5 12:44:14 UTC 2008

 Modified Files:
 	src/sys/dev/ic: com.c

 Log Message:
 Work around com hangs with pcmcia. PR kern/37462.


 To generate a diff of this commit:
 cvs rdiff -r1.268 -r1.269 src/sys/dev/ic/com.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: feedback->closed
State-Changed-By: ad@netbsd.org
State-Changed-When: Sat, 05 Jan 2008 22:20:02 +0000
State-Changed-Why:
Submitter confirms fixed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.