NetBSD Problem Report #41754

From wiml@hhhh.org  Mon Jul 20 06:46:37 2009
Return-Path: <wiml@hhhh.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id DC29E63B898
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 20 Jul 2009 06:46:37 +0000 (UTC)
Message-Id: <20090720063540.74144406FE@pippin.hhhh.org>
Date: Sun, 19 Jul 2009 23:35:40 -0700 (PDT)
From: Wim Lewis <wiml@hhhh.org>
Reply-To: Wim Lewis <wiml@hhhh.org>
To: gnats-bugs@gnats.NetBSD.org
Subject: Attach/detach of generic USB device causes crash
X-Send-Pr-Version: 3.95

>Number:         41754
>Category:       kern
>Synopsis:       Attach/detach of generic USB device causes crash
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 20 06:50:00 +0000 2009
>Closed-Date:    Sat Dec 31 05:49:55 +0000 2022
>Last-Modified:  Sat Dec 31 05:49:55 +0000 2022
>Originator:     Wim Lewis
>Release:        NetBSD 5.0
>Organization:

>Environment:
System: NetBSD 5.0_STABLE (PIPPIN) #4: Sun Jul 19 13:29:31 PDT 2009
	wiml@pippin.hhhh.org:/mnt/bsd4/home/wiml/usr/src/sys/arch/macppc/compile/PIPPIN
Architecture: powerpc
Machine: macppc
cpu0 at mainbus0: 7447A (Revision 1.2), ID 0 (primary)
uhub0 at usb0: Apple Computer OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
uhub1 at usb1: NEC OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 3 ports with 3 removable, self powered
uhub3 at usb3: NEC EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
uhub3: 5 ports with 5 removable, self powered
>Description:
Detaching a particular USB device (or, more rarely, attaching it) can
cause my machine to crash. Usually it simply becomes completely unresponsive;
sometimes it will spontaneously reboot. In some cases, kernel messages
will still be written to the console, but userland is completely hung.

The machine is a PPC Mac Mini. The device is an AT91SAM7S64 development
board, which does not have any drivers on the NetBSD machine (I am interacting
with it using ugen and libusb). By "detaching" I mean any of: physically
pulling the USB cable; hitting the reset switch on the board (which
should be electrically almost the same as pulling the cable); and changing
the firmware on the board (which would cause it to stop responding to USB
requests without actually signaling a detached state on the bus).

I've had this problem with the following kernels (PIPPIN is a local
configuration with a number of unneccessary devices disabled, and
options DIAGNOSTIC, DEBUG, DDB_ONPANIC, USB_DEBUG, and OHCI_DEBUG
enabled):
  4.0.1 (GENERIC binary distro kernel)
  5.0-RC1 (GENERIC)
  5.0-RC3 (GENERIC binary distro, GENERIC compiled locally, PIPPIN compiled locally)
  5.0_STABLE 20090719 (PIPPIN compiled locally)

I've tried increasing the kernel's verbosity with usbdebug (from pkgsrc)
but haven't found any telling differences between the messages emitted
when the machine does vs. doesn't crash, or between the usb device I'm
having trouble with and other innocuous devices. I'm not sure what to
look for, though.

Other than the USB problem, the machine is quite stable. I've run (e.g.)
CPANSmoke on it for months with no trouble.
>How-To-Repeat:
I can't get this to happen on demand; sometimes it happens the first
time I attach/detach the device, sometimes I can plug and unplug the device
many times without a problem. Other USB devices (keyboard, mouse, flash
drive) have no problems.

It's not necessary to interact with the device from user space at all to
cause the problem (that is, plugging it in, waiting for it to enumerate,
and then unplugging it can cause the crash).

>Fix:

Unknown
>Release-Note:

>Audit-Trail:
From: Wim Lewis <wiml@hhhh.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/41754
Date: Tue, 11 Aug 2009 01:06:00 -0700

 After some more experimentation I've figured out the steps needed to  
 reproduce the crash reliably:

    1. attach the device
    2. use a python+libusb program to download some firmware
    3. halt the device but do not detach it
    4. attempt to access the device again using py+libusb (it will not  
 be found)
    5. detach and reattach the device

 NetBSD (I'm now running 5.0.1) will reliably crash when the device is  
 reattached. If I skip step (4), it will reliably *not* crash. The  
 syscall-level effect of (4) is to open the /dev/usb## devices, close  
 them, reopen them and issue USB_DEVICEINFO ioctls.


State-Changed-From-To: open->feedback
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Tue, 18 Sep 2018 02:38:26 +0000
State-Changed-Why:
this sounds like problems solved by the usb abort fixes.  do you still
have this hardware setup and ability to test?  thanks.


State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 31 Dec 2022 05:49:55 +0000
State-Changed-Why:
four-year feedback timeout; assume that the proposed fixes did in fact
fix the problem.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: gnats-precook-prs,v 1.4 2018/12/21 14:20:20 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.