home » 2016 » 01 » Spammed port resume error -110 in dmesg

Spammed port resume error -110 in dmesg

Posted:
2016-01-18
Tags:
kernel linux bugs

This is a bug that has been annoying me for a long while now. The only symptom of it is this message spammed 50 times per second in the dmesg log:

ehci-pci 0000:00:13.2: port 5 resume error -110
ehci-pci 0000:00:13.2: port 5 resume error -110
ehci-pci 0000:00:13.2: port 5 resume error -110
...

The internet finds a few posts from other people who have seen the same problem, such as this one or this or this. The last one is interesting because the commenter claims that he can trigger the bug by connecting a bad usb device.

One thing we can take not of is the number -110. It likely is an errno value for a timeout error. Perhaps the kernel was doing something with the USB device while the cable was unplugged. It tries to write the the device but it is not there so it times out and then a few milliseconds later tries again and so on.

Another interesting number code is 0000:00:13.2. That is the PCI address to the USB port that the message is complaining about. On my computer:

$ lspci -s 13.2
00:13.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller

With that address, we can force reset the USB port using the ehci drivers /sys interface:

# Disconnect
$ sudo sh -c "echo 0000:00:13.2 > /sys/bus/pci/drivers/ehci-pci/unbind"
# Reconnect
sudo sh -c "echo 0000:00:13.2 > /sys/bus/pci/drivers/ehci-pci/bind"

That should cause the EHCI driver to reset the port and write messages like these to dmesg:

ehci-pci 0000:00:13.2: remove, state 1
usb usb2: USB disconnect, device number 1
ehci-pci 0000:00:13.2: USB bus 2 deregistered
ehci-pci 0000:00:13.2: EHCI Host Controller
ehci-pci 0000:00:13.2: new USB bus registered, assigned bus number 2
ehci-pci 0000:00:13.2: applying AMD SB700/SB800/Hudson-2/3 EHCI dummy qh workaround
ehci-pci 0000:00:13.2: debug port 1
ehci-pci 0000:00:13.2: irq 19, io mem 0xfe7ff400
ehci-pci 0000:00:13.2: USB 2.0 started, EHCI 1.00
usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: Product: EHCI Host Controller
usb usb2: Manufacturer: Linux 4.2.0-18-generic ehci_hcd
usb usb2: SerialNumber: 0000:00:13.2
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 6 ports detected
hub 5-0:1.0: USB hub found
hub 5-0:1.0: 3 ports detected
hub 6-0:1.0: USB hub found
hub 6-0:1.0: 3 ports detected

Which fixes the problem for me.

The message appears to come from line 1051 of the ehci-hub.c file in the kernel sources. It contains some very hairy logic so it wouldn't surprise me if this is a bug in Linux.