Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 560106 - USB xHCI: Random disconnects of a USB 3.0 HDD enclosure
Summary: USB xHCI: Random disconnects of a USB 3.0 HDD enclosure
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-10 11:20 UTC by Vasiliy Pupkin
Modified: 2015-10-27 21:30 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vasiliy Pupkin 2015-09-10 11:20:01 UTC
Hello,

linux-usb.org asks to open the bugs against the distro first if using a distro kernel. As I'm using Gentoo, opening the bug here.

Problem: when using a USB 3.0 HDD enclosure in USB 3.0 mode (xhci), there are random disconnects and reconnects.

Observations:

- independent of activity/workload
- works perfectly under Windows 7 in XHCI mode
- works everywhere (Linux and Windows) when using USB 2.0 mode (EHCI)
- tried with kernels 4.0.5-gentoo, 4.2.0-gentoo-r1 and 3.18.16-gentoo - no difference
- enabling/disabling runtime PM and USB power management doesn't make any difference
- works on a different host hardware (see details below). Tested with kernel 3.17.7.


=====> Output of /var/log/messages demonstrating the issue:


http://pastebin.com/wbUr5mMe


=====> lsusb and lspci outputs (as seen by host hardware on which it doesn't work)


http://pastebin.com/XDEz2x2g



=====> lsusb and lspci outputs (as seen by host hardware on which it works)


http://pastebin.com/1M1ZVyJr


=====> dmesg on the hardware where it doesn't work:

http://pastebin.com/h3Vdh5j6


=====> dmesg on the hardware where it works:

http://pastebin.com/0J4sfVDT


=====> emerge --info

Portage 2.2.20.1 (python 2.7.9-final-0, default/linux/amd64/13.0, gcc-4.9.3, glibc-2.20-r2, 4.0.5-gentoo x86_64)
=================================================================
System uname: Linux-4.0.5-gentoo-x86_64-Intel-R-_Core-TM-_i5-4250U_CPU_@_1.30GHz-with-gentoo-2.2
KiB Mem:     7622128 total,   2056528 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Mon, 07 Sep 2015 23:30:01 +0000
sh bash 4.3_p39
ld GNU ld (Gentoo 2.24 p1.4) 2.24
app-shells/bash:          4.3_p39::gentoo
dev-java/java-config:     2.2.0::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.9-r1::gentoo, 3.4.1::gentoo
dev-util/cmake:           3.2.2::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.17::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.15::gentoo
sys-devel/binutils:       2.24-r3::gentoo
sys-devel/gcc:            4.8.5::gentoo, 4.9.3::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 3.18::gentoo (virtual/os-headers)
sys-libs/glibc:           2.20-r2::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

sunrise
    location: /var/lib/layman/sunrise
    masters: gentoo
    priority: 0

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA AdobeFlash-11.x"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=haswell -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=haswell -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://ftp.halifax.rwth-aachen.de/gentoo/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/tmp"
USE="X acl alsa amd64 berkdb bzip2 cairo cli cracklib crypt cups cxx dbus dri evdev fontconfig fortran gdbm gtk gudev iconv inotify java jpeg kde libnotify lm_sensors mmx mmxext modules multilib ncurses nls nptl nsplugin opengl openmp pam pcre perl png policykit python qt5 readline samba seccomp session sse sse2 ssl startup-notification svg syslog threads tiff truetype udev unicode vaapi xcb xinerama zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="avx avx2 fma3 fma4 mmx mmxext sse sse2 sse3 ssse3 sse4_1 sse4_2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Vasiliy Pupkin 2015-09-10 11:28:12 UTC
=====> kernel config on the hardware where it doesn't work:

http://pastebin.com/yg65zBdU


=====> kernel config on the hardware where it works:

http://pastebin.com/Yt1f4HXV
Comment 2 Vasiliy Pupkin 2015-09-12 22:43:51 UTC
Found this on a WD page:


Problem:
A USB 3.0 drive randomly disconnects and reconnects from the computer in one of the following scenarios:

   - Drives appear to disconnect and reconnect from the computer repeatedly while it is not transferring any data. This can be identified by notifications such as the sound of a USB device being disconnected or the pop-up on the bottom right of the screen.
   - Autoplay dialog appears repeatedly after closing it, or the device temporarily disappears from the Explorer.
   - The drive sometimes disconnects and immediately reconnects during small data transfers, which may cause an error message such as Delayed Write Failed.



Cause:

Western Digital has found that a small number of newer computer systems with USB 3.0, have a USB 3.0 Redriver vendor ASIC (Application-specific Integrated Circuit) - particularly with Intel USB 3.0 and Renesas (formerly NEC) host chipsets, when used with our USB 3.0 products with Initio CP48 Gen2 and Jmicron CP48 (FW 1.014 or higher) device controllers - may have problems interacting with the advanced power management features of the WD USB 3.0 drives.



Solution:

   - Resolution to the issue at hand requires to guide the Customer to disable the advanced USB 3.0 power management modes (known as U1/U2), on either the computer or the drive. WD can provide a software tool to the Customer which will disable the USB 3.0 power management modes on the WD drive and should permanently resolve the issue.
   - Some USB 3.0 host adapters (typically Reneas [formerly NEC]) and their drivers, have an option to disable USB 3.0 power management functions. This is done within a vendor provided utility (USB 3.0 Host Controller Information) or in Windows Driver Details tab.
   - Another option, if available, is to guide the Customer to connect the drive to a USB 3.0 hub, instead of directly to the computer. The reason is because many USB 3.0 hubs don't support the U1/U2 power management modes, and the issue may be resolved in this way. Ensure that the USB 3.0 hub's firmware is updated to the latest version.

To determine if the system has a problem with U1/U2 power management, have the Customer connect the drive to a USB 2.0 port on the computer. If the drive does not disconnect and reconnect as before, it is safe to assume that the advanced power management feature is causing the issue in the USB 3.0 port.

Make sure to let the Customer know that it is likely that the issue will occur most often when the drive is idle. With smaller, infrequent data transfers, the drive may disconnect during the data transfer resulting in an error message that the file transfer did not complete. During large data transfers, however, the device may stay connected as normal.

https://wdc.custhelp.com/app/answers/detail/a_id/9588/~/a-usb-3.0-drive-randomly-disconnects-and-reconnects-from-a-pc

Now the question is how to disable U1/U2 in Linux.
Comment 3 Vasiliy Pupkin 2015-10-27 21:30:42 UTC
Issue resolved. The root cause was the cable.

USB 3.0 requires really thick and well-shielded cables for error-free operation.