>Synopsis:      adb kill-server panics (ehci_device_clear_toggle: queue active)
>Category:      kernel
>Environment:
        System      : OpenBSD 5.7
        Details     : OpenBSD 5.7-current (GENERIC) #916: Sun Jun 14 11:11:32 
MDT 2015
                         
[email protected]:/usr/src/sys/arch/i386/compile/GENERIC

        Architecture: OpenBSD.i386
        Machine     : i386
>Description:
After connecting an Android device (tablet, Android 4.2.2) to a USB
2.0 port and starting the adb daemon ("adb start-server", devel/adb
port), issuing the command "adb kill-server" from the shell panics:

    ehci_device_clear_toggle: queue active

Sketch of the traceback:
    Debugger()
    panic()
    ehci_device_clear_toggle()
    usbd_clear_endpoint_stall()
    ugen_do_read()
    ugenread()
    spec_read()
    VOP_READ()
    vn_read()
    dofilereadv()
    sys_read()
    syscall()

The call to usbd_clear_endpoint_stall() is on line 561 of
sys/dev/usb/ugen.c.  The error returned from usbd_transfer() was 18
(USBD_INTERRUPTED, found by instrumenting the code with an additional
printf).

A possible clue: building a kernel with the UGEN_DEBUG option turned
on causes the panic to happen not as often - however, if you adb
start-server; ... ; adb kill-server enough times it will eventually
panic.  Without UGEN_DEBUG turned on the panic happens almost
immediately the very first time you "adb kill-server"

N.B.: the adb daemon always dumps core when it exits, regardless
of the panic.  This appears to be a separate issue with libusb,
will file under separate cover.

>How-To-Repeat:
# turn on USB debugging on android device
# connect android device to USB port
# (dmesg spew from connecting android device below)
# now:
$ adb start-server
$ adb kill-server     # panic

>Fix:
Ultra-pragmatic hack-around: Turning on UGEN_DEBUG buys you a little
time (or at least me with this setup), but eventually it will panic.

dmesg:
OpenBSD 5.7-current (GENERIC) #916: Sun Jun 14 11:11:32 MDT 2015
    [email protected]:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel(R) Pentium(R) M processor 1700MHz ("GenuineIntel" 686-class) 1.70 
GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,TM,PBE,EST,TM2,PERF
real mem  = 2146320384 (2046MB)
avail mem = 2098950144 (2001MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 11/18/04, BIOS32 rev. 0 @ 0xfd750, SMBIOS rev. 2.33 @ 
0xe0010 (57 entries)
bios0: vendor IBM version "1QET78WW (2.15 )" date 11/18/2004
bios0: IBM 26724UU
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SSDT ECDT TCPA BOOT
acpi0: wakeup devices LID_(S3) SLPB(S3) UART(S3) PCI0(S3) PCI1(S4) DOCK(S4) 
USB0(S3) USB1(S3) USB2(S3) AC9M(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiec0 at acpi0
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (AGP_)
acpiprt2 at acpi0: bus 2 (PCI1)
acpiprt3 at acpi0: bus -1 (DOCK)
acpicpu0 at acpi0
C1: unknown FFH vendor 8: !C3(250@85 io@0x1015), C2(500@1 io@0x1014), PSS
acpipwrres0 at acpi0: PUBS, resource for USB0, USB1, USB7
acpitz0 at acpi0: critical temperature is 91 degC
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
acpibat0 at acpi0: BAT0 model "IBM-COMPATIBLE" serial 40006 type LION oem 
"SANYO"
acpibat1 at acpi0: BAT1 not present
acpibat2 at acpi0: BAT2 not present
acpiac0 at acpi0: AC unit online
acpithinkpad0 at acpi0
acpidock0 at acpi0: GDCK not docked (0)
bios0: ROM list: 0xc0000/0x10000 0xd0000/0x1000 0xd1000/0x1000 0xdc000/0x4000! 
0xe0000/0x10000
cpu0 at mainbus0: (uniprocessor)
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: Enhanced SpeedStep 1699 MHz: speeds: 1700, 1400, 1200, 1000, 800, 600 MHz
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "Intel 82855PM Host" rev 0x03
intelagp0 at pchb0
agp0 at intelagp0: aperture at 0xd0000000, size 0x10000000
ppb0 at pci0 dev 1 function 0 "Intel 82855PM AGP" rev 0x03
pci1 at ppb0 bus 1
radeondrm0 at pci1 dev 0 function 0 "ATI Radeon Mobility M6" rev 0x00
drm0 at radeondrm0
radeondrm0: irq 11
uhci0 at pci0 dev 29 function 0 "Intel 82801DB USB" rev 0x01: irq 11
uhci1 at pci0 dev 29 function 1 "Intel 82801DB USB" rev 0x01: irq 11
uhci2 at pci0 dev 29 function 2 "Intel 82801DB USB" rev 0x01: irq 11
ehci0 at pci0 dev 29 function 7 "Intel 82801DB USB" rev 0x01: irq 11
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
ppb1 at pci0 dev 30 function 0 "Intel 82801BAM Hub-to-PCI" rev 0x81
pci2 at ppb1 bus 2
2:0:0: mem address conflict 0xb0000000/0x1000
2:0:1: mem address conflict 0xb1000000/0x1000
cbb0 at pci2 dev 0 function 0 "Ricoh 5C476 CardBus" rev 0xaa: irq 11
cbb1 at pci2 dev 0 function 1 "Ricoh 5C476 CardBus" rev 0xaa: irq 11
"Ricoh 5C552 Firewire" rev 0x02 at pci2 dev 0 function 2 not configured
em0 at pci2 dev 1 function 0 "Intel 82540EP" rev 0x03: irq 11, address 
00:11:25:84:3a:ce
ath0 at pci2 dev 2 function 0 "Atheros AR5212" rev 0x01: irq 11
ath0: AR5213A 5.9 phy 4.3 rf2112a 4.6 eeprom 4.8, WOR4W, address 
00:0e:9b:99:0a:4a
cardslot0 at cbb0 slot 0 flags 0
cardbus0 at cardslot0: bus 3 device 0 cacheline 0x0, lattimer 0xb0
pcmcia0 at cardslot0
cardslot1 at cbb1 slot 1 flags 0
cardbus1 at cardslot1: bus 6 device 0 cacheline 0x0, lattimer 0xb0
pcmcia1 at cardslot1
ichpcib0 at pci0 dev 31 function 0 "Intel 82801DBM LPC" rev 0x01
pciide0 at pci0 dev 31 function 1 "Intel 82801DBM IDE" rev 0x01: DMA, channel 0 
configured to compatibility, channel 1 configured to compatibility
wd0 at pciide0 channel 0 drive 0: <HTS721010G9AT00>
wd0: 16-sector PIO, LBA48, 95396MB, 195371568 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
pciide0: channel 1 disabled (no drives)
ichiic0 at pci0 dev 31 function 3 "Intel 82801DB SMBus" rev 0x01: irq 11
iic0 at ichiic0
spdmem0 at iic0 addr 0x50: 1GB DDR SDRAM non-parity PC2700CL2.5
spdmem1 at iic0 addr 0x51: 1GB DDR SDRAM non-parity PC2700CL2.5
auich0 at pci0 dev 31 function 5 "Intel 82801DB AC97" rev 0x01: irq 11, ICH4 
AC97
ac97: codec id 0x41445374 (Analog Devices AD1981B)
ac97: codec features headphone, 20 bit DAC, No 3D Stereo
audio0 at auich0
"Intel 82801DB Modem" rev 0x01 at pci0 dev 31 function 6 not configured
usb1 at uhci0: USB revision 1.0
uhub1 at usb1 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb2 at uhci1: USB revision 1.0
uhub2 at usb2 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb3 at uhci2: USB revision 1.0
uhub3 at usb3 "Intel UHCI root hub" rev 1.00/1.00 addr 1
isa0 at ichpcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
lpt2 at isa0 port 0x3bc/4: polled
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
root on wd0a (e1bee1b77801e5a3.a) swap on wd0b dump on wd0b
WARNING: / was not properly unmounted
radeondrm0: 1024x768
wsdisplay0 at radeondrm0 mux 1: console (std, vt100 emulation), using wskbd0
wsdisplay0: screen 1-5 added (std, vt100 emulation)
softraid0: sd0 was not shutdown properly
softraid0: sd0 was not shutdown properly
sd0 at scsibus2 targ 1 lun 0: <OPENBSD, SR CRYPTO, 005> SCSI2 0/direct fixed
sd0: 1023MB, 512 bytes/sector, 2096624 sectors
softraid0: sd1 was not shutdown properly
softraid0: sd1 was not shutdown properly
sd1 at scsibus2 targ 2 lun 0: <OPENBSD, SR CRYPTO, 005> SCSI2 0/direct fixed
sd1: 9999MB, 512 bytes/sector, 20479472 sectors
umass0 at uhub0 port 3 configuration 1 interface 0 "vendor 0x18d1 Android" rev 
2.00/2.33 addr 2
umass0: using SCSI over Bulk-Only
scsibus3 at umass0: 2 targets, initiator 0
sd2 at scsibus3 targ 1 lun 0: <USB 2.0, USB Flash Driver, 0100> SCSI2 0/direct 
removable
sd3 at scsibus3 targ 1 lun 1: <USB 2.0, USB Flash Driver, 0100> SCSI2 0/direct 
removable
ugen0 at uhub0 port 3 configuration 1 "USB Developer Android" rev 2.00/2.33 
addr 2

usbdevs:
Controller /dev/usb0:
addr 1: high speed, self powered, config 1, EHCI root hub(0x0000), 
Intel(0x8086), rev 1.00
 port 1 powered
 port 2 powered
 port 3 addr 2: high speed, self powered, config 1, Android(0x0003), USB 
Developer(0x18d1), rev 2.33, iSerialNumber 20080411
 port 4 powered
 port 5 powered
 port 6 powered
Controller /dev/usb1:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), 
Intel(0x8086), rev 1.00
 port 1 powered
 port 2 powered
Controller /dev/usb2:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), 
Intel(0x8086), rev 1.00
 port 1 powered
 port 2 powered
Controller /dev/usb3:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), 
Intel(0x8086), rev 1.00
 port 1 powered
 port 2 powered

Reply via email to