PROBLEM: ehci-hcd storage device resets during I/O with kernels 2.6.12.1(vanilla)

From: Jiří Fogl
Date: Sun Jun 26 2005 - 09:47:41 EST


PROBLEM:
========
ehci-hcd storage device resets during I/O with 2.6.12.1 (vanilla)



DESCRIPTION:
============
I encountered problems with memory devices (flashdisks, memory-card readers) connected to USB 2.0 PCI card. After connecting the device to the USB port it is found by system properly and assigned to /dev/sd? files. I can mount them and read from/write to them, but after a while the device is reset and reading/writing stops and error message appears (Can't read file xxx). Duration of this while differs for every attempt.
After trying hardware (removing other PCI cards, moving USB PCI card to other PCI slots, disabling motherboard's built-in USB) and software (mostly experiments with loading and unloading relating modules) changes I found the problem is in ehci-hcd module. After unloading it the memory device works without reset, but only like USB 1.1 device.

Changelog of kernel 2.6.12 says there is a patch for EHCI ([PATCH] spin longer for ehci port reset completion by David Brownell), so I compiled and used it (exactly i used 2.6.12.1 from kernel.org):
Device is properly recognized after connecting to the USB port; I mount it and start reading data from it. After a random-long while the transfer stops, but after next while it runs again. In result the reading is much slower than with UHCI. After few measuring attempts the copying of about 120 MB from the device the process hanged up - there are messages about resetting the device, but copying process didn't end by error (I used drag and drop copying with KDE's Konqueror and the progress is 82% last two hours).

Beside this I also use CDMA modem (Gtran GPC-6420 - this model is AFAIK specific for Czech republic) connected to USB (uses cdc-acm module) and there are no issues with it, no matter if it is connected to 2.0 PCI card or to integrated 1.1 USB port or disconnected at all.



KEYWORDS:
=========
USB, ehci-hcd, memory device



KERNEL VERSION:
===============
Linux version 2.6.12.1 (root@masterlord) (gcc version 3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)) #1 Sun Jun 26 02:00:03 CEST 2005



HARDWARE DETAILS:
=================
Processor: AMD Athlon XP 1600+
Mainboard: ECS K7VTA3 (VIA KT333 &8233A chipset) with integrated USB 1.1 controller
USB 2.0 additional card: Edimax EU-CV4N (documentation claims no need of drivers with kernel 2.5.2+; details about this card at http://www.edimax.nl/html/english/products/EU-CV4N.htm)
HDD and CD-burner are IDE, there are no SCSI devices in this computer.
Inno3D Tornado VGA (nVIDIA GeForce 4 - MX 440, 64 MB, TV-out)
There is also Microcom SP2612R Gbit LAN Card, but there was no difference if it was or wasn't installed.
HW info provided by system attached below in LISTINGS section.



SOFTWARE DETAILS:
=================
OS: Mandrake 10.1 official (download version) - test performed with distribution's kernel 2.6.8-6mdk and new kernel 2.6.12.1 from kernel.org.
Details about environment below in LISTINGS section.



LISTINGS:
=========

ver_linux:
If some fields are empty or look unusual you may have an old version.
Compare to the current minimal requirements in Documentation/Changes.

Linux masterlord 2.6.12.1 #1 Sun Jun 26 02:00:03 CEST 2005 i686 AMD Athlon(tm) XP 1600+ unknown GNU/Linux

Gnu C 3.4.1
Gnu make 3.80
binutils 2.15.90.0.3
util-linux 2.12a
mount 2.12a
module-init-tools 3.0
e2fsprogs 1.35
reiserfsprogs line
reiser4progs line
PPP 2.4.2
nfs-utils 1.0.6
Linux C Library 2.3.3
Dynamic linker (ldd) 2.3.3
Procps 3.2.3
Net-tools 1.60
Kbd [přepínač...]
Console-tools 0.2.3
Sh-utils 5.2.1
udev 030
Modules Loaded nls_iso8859_1 nls_cp437 vfat fat sd_mod usb_storage scsi_mod bsd_comp ppp_async crc_ccitt ppp_generic slhc parport_pc parport nfsd exportfs lockd sunrpc md5 ipv6 snd_pcm_oss snd_mixer_oss snd_via82xx snd_ac97_codec snd_pcm snd_timer snd_page_alloc snd_mpu401_uart snd_rawmidi snd_seq_device snd soundcore af_packet floppy ipt_MASQUERADE iptable_nat ip_conntrack ipt_LOG iptable_filter ip_tables cdc_acm r8169 ide_cd cdrom loop ext3 jbd via_agp agpgart ehci_hcd uhci_hcd usbcore evdev


/proc/cpuinfo:
processor : 0
vendor_id : AuthenticAMD
cpu family : 6
model : 6
model name : AMD Athlon(tm) XP 1600+
stepping : 2
cpu MHz : 1400.618
cache size : 256 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx fxsr sse syscall mmxext 3dnowext 3dnow
bogomips : 2768.89


/proc/modules:
nls_iso8859_1 3840 1 - Live 0xd886e000
nls_cp437 5440 1 - Live 0xd8ca8000
vfat 10816 1 - Live 0xd8b39000
fat 46300 1 vfat, Live 0xd8cb0000
sd_mod 14736 1 - Live 0xd8cab000
usb_storage 71552 1 - Live 0xd8cbd000
scsi_mod 122632 2 sd_mod,usb_storage, Live 0xd8d0c000
bsd_comp 5248 0 - Live 0xd8ca2000
ppp_async 9024 1 - Live 0xd8c5f000
crc_ccitt 1728 1 ppp_async, Live 0xd8afe000
ppp_generic 21972 6 bsd_comp,ppp_async, Live 0xd8c38000
slhc 6080 1 ppp_generic, Live 0xd8c35000
parport_pc 32132 0 - Live 0xd8c20000
parport 32840 1 parport_pc, Live 0xd8c2b000
nfsd 211968 8 - Live 0xd8cd7000
exportfs 5312 1 nfsd, Live 0xd8c1d000
lockd 60648 2 nfsd, Live 0xd8c00000
sunrpc 126148 2 nfsd,lockd, Live 0xd8c3f000
md5 3776 1 - Live 0xd8af7000
ipv6 243648 13 - Live 0xd8c65000
snd_pcm_oss 48672 0 - Live 0xd8c10000
snd_mixer_oss 17088 2 snd_pcm_oss, Live 0xd8bfa000
snd_via82xx 23200 4 - Live 0xd8b96000
snd_ac97_codec 78648 1 snd_via82xx, Live 0xd8bd4000
snd_pcm 84040 5 snd_pcm_oss,snd_via82xx,snd_ac97_codec, Live 0xd8bbe000
snd_timer 22020 1 snd_pcm, Live 0xd8b9e000
snd_page_alloc 7428 2 snd_via82xx,snd_pcm, Live 0xd8b6c000
snd_mpu401_uart 6336 1 snd_via82xx, Live 0xd8b69000
snd_rawmidi 21280 1 snd_mpu401_uart, Live 0xd8b71000
snd_seq_device 6860 1 snd_rawmidi, Live 0xd8b66000
snd 46308 13 snd_pcm_oss,snd_mixer_oss,snd_via82xx,snd_ac97_codec,snd_pcm,snd_timer,snd_mpu401_uart,snd_rawmidi,snd_seq_device, Live 0xd8b89000
soundcore 7648 2 snd, Live 0xd8b3d000
af_packet 17224 0 - Live 0xd8b40000
floppy 53716 0 - Live 0xd8b7a000
ipt_MASQUERADE 2560 1 - Live 0xd8af9000
iptable_nat 19612 2 ipt_MASQUERADE, Live 0xd8b28000
ip_conntrack 38456 2 ipt_MASQUERADE,iptable_nat, Live 0xd8b2e000
ipt_LOG 6400 2 - Live 0xd8afb000
iptable_filter 2176 1 - Live 0xd8869000
ip_tables 20352 4 ipt_MASQUERADE,iptable_nat,ipt_LOG,iptable_filter, Live 0xd887a000
cdc_acm 10016 2 - Live 0xd880d000
r8169 22092 0 - Live 0xd8af0000
ide_cd 36804 0 - Live 0xd8870000
cdrom 36704 1 ide_cd, Live 0xd8851000
loop 13960 0 - Live 0xd8819000
ext3 123720 3 - Live 0xd8b46000
jbd 54872 1 ext3, Live 0xd8ae1000
via_agp 7680 1 - Live 0xd8816000
agpgart 29192 1 via_agp, Live 0xd885b000
ehci_hcd 29512 0 - Live 0xd8827000
uhci_hcd 29328 0 - Live 0xd881e000
usbcore 110140 5 usb_storage,cdc_acm,ehci_hcd,uhci_hcd, Live 0xd8835000
evdev 7424 0 - Live 0xd8811000


/proc/ioports:
0000-001f : dma1
0020-0021 : pic1
0040-0043 : timer0
0050-0053 : timer1
0060-006f : keyboard
0070-0077 : rtc
0080-008f : dma page reg
00a0-00a1 : pic2
00c0-00df : dma2
00f0-00ff : fpu
0170-0177 : ide1
01f0-01f7 : ide0
02f8-02ff : serial
0376-0376 : ide1
0378-037a : parport0
03c0-03df : vesafb
03f6-03f6 : ide0
03f8-03ff : serial
0cf8-0cff : PCI conf1
d000-d0ff : 0000:00:09.0
d000-d0ff : r8169
d400-d41f : 0000:00:0b.0
d400-d41f : uhci_hcd
d800-d81f : 0000:00:0b.1
d800-d81f : uhci_hcd
dc00-dc0f : 0000:00:11.1
dc00-dc07 : ide0
dc08-dc0f : ide1
e000-e01f : 0000:00:11.2
e000-e01f : uhci_hcd
e400-e41f : 0000:00:11.3
e400-e41f : uhci_hcd
e800-e8ff : 0000:00:11.5
e800-e8ff : VIA8233A


/proc/iomem:
00000000-0009fbff : System RAM
0009fc00-0009ffff : reserved
000a0000-000bffff : Video RAM area
000c0000-000cfbff : Video ROM
000f0000-000fffff : System ROM
00100000-17feffff : System RAM
00100000-002c9a88 : Kernel code
002c9a89-0034a33f : Kernel data
17ff0000-17ff2fff : ACPI Non-volatile Storage
17ff3000-17ffffff : ACPI Tables
d0000000-d7ffffff : 0000:00:00.0
d8000000-e7ffffff : PCI Bus #01
d8000000-dfffffff : 0000:01:00.0
d8000000-dbffffff : vesafb
e0000000-e007ffff : 0000:01:00.0
e8000000-e9ffffff : PCI Bus #01
e8000000-e8ffffff : 0000:01:00.0
eb000000-eb0000ff : 0000:00:09.0
eb000000-eb0000ff : r8169
eb001000-eb0010ff : 0000:00:0b.2
eb001000-eb0010ff : ehci_hcd
ffff0000-ffffffff : reserved


lspci -vvv:
00:00.0 Host bridge: VIA Technologies, Inc. VT8366/A/7 [Apollo KT266/A/333]
Subsystem: Elitegroup Computer Systems: Unknown device 0996
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort+ >SERR- <PERR-
Latency: 0
Region 0: Memory at d0000000 (32-bit, prefetchable) [size=128M]
Capabilities: [a0] AGP version 2.0
Status: RQ=32 Iso- ArqSz=0 Cal=0 SBA+ ITACoh- GART64- HTrans- 64bit- FW- AGP3- Rate=x1,x2,x4
Command: RQ=1 ArqSz=0 Cal=0 SBA- AGP- GART64- 64bit- FW- Rate=<none>
Capabilities: [c0] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

00:01.0 PCI bridge: VIA Technologies, Inc. VT8366/A/7 [Apollo KT266/A/333 AGP] (prog-if 00 [Normal decode])
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B-
Status: Cap+ 66Mhz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort+ >SERR- <PERR-
Latency: 0
Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
I/O behind bridge: 0000f000-00000fff
Memory behind bridge: e8000000-e9ffffff
Prefetchable memory behind bridge: d8000000-e7ffffff
BridgeCtl: Parity- SERR- NoISA+ VGA+ MAbort- >Reset- FastB2B-
Capabilities: [80] Power Management version 2
Flags: PMEClk- DSI- D1+ D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

00:09.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet (rev 10)
Subsystem: Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 32 (8000ns min, 16000ns max), cache line size 10
Interrupt: pin A routed to IRQ 5
Region 0: I/O ports at d000 [size=256]
Region 1: Memory at eb000000 (32-bit, non-prefetchable) [size=256]
Expansion ROM at <unassigned> [disabled] [size=128K]
Capabilities: [dc] Power Management version 2
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1+,D2+,D3hot+,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

00:0b.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 61) (prog-if 00 [UHCI])
Subsystem: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 32, cache line size 08
Interrupt: pin A routed to IRQ 5
Region 4: I/O ports at d400 [size=32]
Capabilities: [80] Power Management version 2
Flags: PMEClk+ DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

00:0b.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 61) (prog-if 00 [UHCI])
Subsystem: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 32, cache line size 08
Interrupt: pin B routed to IRQ 11
Region 4: I/O ports at d800 [size=32]
Capabilities: [80] Power Management version 2
Flags: PMEClk+ DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

00:0b.2 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 63) (prog-if 20 [EHCI])
Subsystem: VIA Technologies, Inc. USB 2.0
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 32, cache line size 10
Interrupt: pin C routed to IRQ 5
Region 0: Memory at eb001000 (32-bit, non-prefetchable) [size=256]
Capabilities: [80] Power Management version 2
Flags: PMEClk+ DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

00:11.0 ISA bridge: VIA Technologies, Inc. VT8233A ISA Bridge
Subsystem: Elitegroup Computer Systems: Unknown device 0996
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping+ SERR- FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 0
Capabilities: [c0] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

00:11.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06) (prog-if 8a [Master SecP PriP])
Subsystem: VIA Technologies, Inc. VT82C586/B/VT82C686/A/B/VT8233/A/C/VT8235 PIPC Bus Master IDE
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 32
Interrupt: pin A routed to IRQ 0
Region 4: I/O ports at dc00 [size=16]
Capabilities: [c0] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

00:11.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 23) (prog-if 00 [UHCI])
Subsystem: VIA Technologies, Inc. (Wrong ID) USB Controller
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 32, cache line size 08
Interrupt: pin D routed to IRQ 5
Region 4: I/O ports at e000 [size=32]
Capabilities: [80] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

00:11.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 23) (prog-if 00 [UHCI])
Subsystem: VIA Technologies, Inc. (Wrong ID) USB Controller
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 32, cache line size 08
Interrupt: pin D routed to IRQ 5
Region 4: I/O ports at e400 [size=32]
Capabilities: [80] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 40)
Subsystem: Elitegroup Computer Systems: Unknown device 0996
Control: I/O+ Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Interrupt: pin C routed to IRQ 11
Region 0: I/O ports at e800 [size=256]
Capabilities: [c0] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

01:00.0 VGA compatible controller: nVidia Corporation NV17 [GeForce4 MX 440] (rev a3) (prog-if 00 [VGA])
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 32 (1250ns min, 250ns max)
Interrupt: pin A routed to IRQ 11
Region 0: Memory at e8000000 (32-bit, non-prefetchable) [size=16M]
Region 1: Memory at d8000000 (32-bit, prefetchable) [size=128M]
Region 2: Memory at e0000000 (32-bit, prefetchable) [size=512K]
Expansion ROM at <unassigned> [disabled] [size=128K]
Capabilities: [60] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [44] AGP version 2.0
Status: RQ=32 Iso- ArqSz=0 Cal=0 SBA- ITACoh- GART64- HTrans- 64bit- FW+ AGP3- Rate=x1,x2,x4
Command: RQ=1 ArqSz=0 Cal=0 SBA- AGP- GART64- 64bit- FW- Rate=<none>


/proc/scsi/scsi:
Attached devices:


/proc/config.gz in attachment of this email.




Jiri Fogl <eregon@xxxxxxxxxxx>
http://www.eregon.info

Attachment: config.gz
Description: GNU Zip compressed data