NetBSD Problem Report #51524

From wiz@yt.nih.at  Sun Oct  2 20:42:19 2016
Return-Path: <wiz@yt.nih.at>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id E986D7A227
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  2 Oct 2016 20:42:19 +0000 (UTC)
Message-Id: <20161002204208.A17202AC0E5@yt.nih.at>
Date: Sun,  2 Oct 2016 22:42:08 +0200 (CEST)
From: Thomas Klausner <wiz@NetBSD.org>
Reply-To: Thomas Klausner <wiz@NetBSD.org>
To: gnats-bugs@NetBSD.org
Subject: USB vs. serial problems
X-Send-Pr-Version: 3.95

>Number:         51524
>Category:       kern
>Synopsis:       USB vs. serial problems
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    skrll
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 02 20:45:00 +0000 2016
>Closed-Date:    Mon Oct 10 07:11:15 +0000 2016
>Last-Modified:  Mon Oct 10 07:11:15 +0000 2016
>Originator:     Thomas Klausner
>Release:        NetBSD 7.99.39
>Organization:
Curiosity is the very basis of education and if you tell me that 
curiosity killed the cat, I say only that the cat died nobly.
- Arnold Edinborough
>Environment:


Architecture: x86_64
Machine: amd64
>Description:
I wanted to look at the serial console of a second machine, so I
plugged in a USB serial dongle into my NetBSD (7.99.38/amd64):

ehci0 at pci0 dev 26 function 0: vendor 8086 product 1d2d (rev. 0x06)
ehci0: interrupting at ioapic0 pin 23
ehci0: BIOS has given up ownership
ehci0: EHCI version 1.0
usb0 at ehci0: USB revision 2.0
uhub2 at usb0: vendor 8086 EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
uhub2: 2 ports with 2 removable, self powered
uhub5 at uhub2 port 1: vendor 8087 product 0024, class 9/0, rev 2.00/0.00, addr 2
uhub5: single transaction translator
uhub5: 6 ports with 6 removable, self powered
uftdi0 at uhub5 port 4
uftdi0: FTDI FT232R USB UART, rev 2.00/6.00, addr 4
ucom0 at uftdi0 portno 1

I set up 'minicom -s' to use /dev/dtyU0 and connected.  The screen
stayed empty, and the process was unkillable. I also tried 'cu -l
/dev/dtyU0' which had the same result.  (Even though there should
have been something visible on the serial line.)

At the same time, the USB keyboard and USB mouse stopped working,
without anything visible in dmesg.

I wanted other processes to finish before rebooting, so I waited.

4 hours later I saw the following in the kernel log:
ehci_sync_hc: cv_timedwait() = 35

4 hours later I tried rebooting, but had to press the reset button,
'shutdown -r' didn't work.


A couple days later I tried the same in single user mode to get
debugging output.
I had better luck, with 115200 baud I got some test patterns from the
device on the other end of the serial cable. I started and killed
cu a couple of times (3, perhaps 4?) and then the machine hung completely.
No reaction to USB keyboard nor PS/2 keyboard.

A couple other people reported having seen the same symptoms (see
current-users thread "USB serial problems" starting at
https://mail-index.netbsd.org/current-users/2016/09/21/msg030178.html
(and private emails).
>How-To-Repeat:
See above.
>Fix:
Please.

>Release-Note:

>Audit-Trail:
From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc: coypu@sdf.org
Subject: Re: kern/51524: USB vs. serial problems
Date: Sun, 2 Oct 2016 17:10:39 -0500 (CDT)

 On Sun, 2 Oct 2016 20:45:00 +0000 (UTC), Thomas Klausner <wiz@NetBSD.org>
 wrote:

 > 4 hours later I saw the following in the kernel log:
 >ehci_sync_hc: cv_timedwait() = 35

 Curious.  This exact same error has been observed with USB network
 devices, specifically, urtw(4) on evbmips-mips64el (Lemote Yeeloong,
 LOONGSON kernel).  See the partial thread "Shutdown hangs if umass(4)
 media still mounted" here:

   http://mail-index.netbsd.org/current-users/2016/09/30/msg030222.html

 The same message originally appeared with umass(4) media mounted at
 shutdown, but that has not been seen for a while.  If umass(4) media
 are in use when a urtw(4) interface is associated with an access point,
 the message will appear and the system will be hung.

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]mylinuxisp[flyspeck]com    OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51524 CVS commit: src/sys/dev/usb
Date: Mon, 3 Oct 2016 00:32:37 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Mon Oct  3 00:32:37 UTC 2016

 Modified Files:
 	src/sys/dev/usb: ehci.c

 Log Message:
 Improve diagnostic print seen in PR 51524.


 To generate a diff of this commit:
 cvs rdiff -u -r1.253 -r1.254 src/sys/dev/usb/ehci.c

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

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/51524: USB vs. serial problems
Date: Mon, 3 Oct 2016 00:38:51 +0000

 On Sun, Oct 02, 2016 at 10:15:00PM +0000, John D. Baker wrote:
  >  > 4 hours later I saw the following in the kernel log:
  >  >ehci_sync_hc: cv_timedwait() = 35
  >  
  >  Curious.  This exact same error has been observed with USB network
  >  devices [...]

 I just changed it so it will print

    ehci_sync_hc: timed out

 which is no more helpful but less mysterious.

 It seems that ehci_sync_hc pokes the ehci and tells it to send an
 interrupt when it's done (with something-or-other) and then waits; the
 print means that the interrupt didn't happen after one second.

 I notice though that ehci_device_intr_abort() says this:

    /*
     * XXX - abort_xfer uses ehci_sync_hc, which syncs via the advance
     *       async doorbell. That's dependent on the async list, wheras
     *       intr xfers are periodic, should not use this?
     */
    ehci_abort_xfer(xfer, USBD_CANCELLED);

 and I wonder if that's part of the problem...

 -- 
 David A. Holland
 dholland@netbsd.org

Responsible-Changed-From-To: kern-bug-people->skrll
Responsible-Changed-By: skrll@NetBSD.org
Responsible-Changed-When: Mon, 03 Oct 2016 06:56:18 +0000
Responsible-Changed-Why:
Take


From: Tom Ivar Helbekkmo <tih@hamartun.priv.no>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/51524
Date: Mon, 03 Oct 2016 17:35:44 +0200

 I observe the same problem under 7.99.39.  It's been like this at least
 since 7.99.36, on both i386 and amd64, but was working well under 7.99.7
 on i386, at least.

 I believe the manifestation of the problem on my amd64 system shows a
 pattern: the USB subsystem will get hung up the second time the USB
 serial device is opened, requiring a hardware forced reboot to recover.
 I may be mistaken; it's behaved this way three or four times in a row
 during testing with 7.99.39, but this still could be a coincidence.

 I test using a small application I wrote to decode data coming in from
 the Tellstick, but opening the port with kermit has the same result.

 The relevant kernel output for the device:

 ehci0 at pci0 dev 26 function 0: vendor 8086 product 3b3c (rev. 0x06)
 ehci0: interrupting at ioapic0 pin 16
 ehci0: EHCI version 1.0
 usb0 at ehci0: USB revision 2.0
 uhub0 at usb0: vendor 8086 EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
 uhub0: 2 ports with 2 removable, self powered
 uhub2 at uhub0 port 1: vendor 8087 product 0020, class 9/0, rev
 2.00/0.00, addr 2
 uhub2: single transaction translator
 uhub2: 6 ports with 6 removable, self powered
 uftdi0 at uhub2 port 4
 uftdi0: Telldus TellStick Duo, rev 2.00/6.00, addr 10
 ucom0 at uftdi0 portno 1

From: coypu@SDF.ORG
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/51524
Date: Mon, 3 Oct 2016 16:12:59 +0000

 >  I observe the same problem under 7.99.39.  It's been like this at least
 >  since 7.99.36, on both i386 and amd64, but was working well under 7.99.7
 >  on i386, at least.
 >  

 I'm gambling on it being the enabling of xhci, but a git bisect should be pretty
 quick for finding the exact offending commit.

From: Tom Ivar Helbekkmo <tih@hamartun.priv.no>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/51524
Date: Mon, 03 Oct 2016 18:20:20 +0200

 I believe this problem has been fixed by skrll, in rev 1.114 of
 sys/dev/usb/ucom.c.

State-Changed-From-To: open->feedback
State-Changed-By: skrll@NetBSD.org
State-Changed-When: Tue, 04 Oct 2016 06:50:53 +0000
State-Changed-Why:
Did sys/dev/usb/ucom.c:1.114 fix the problem for you?


State-Changed-From-To: feedback->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Mon, 10 Oct 2016 07:11:15 +0000
State-Changed-Why:
Seems to work fine now, thank you very much!


>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.