Bug 151261 - USB 3.1 hotplug not working
Summary: USB 3.1 hotplug not working
Status: RESOLVED INVALID
Alias: None
Product: Drivers
Classification: Unclassified
Component: PCI (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Greg Kroah-Hartman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-02 16:40 UTC by Richard van der Hoff
Modified: 2016-08-29 20:10 UTC (History)
2 users (show)

See Also:
Kernel Version: 4.7
Tree: Mainline
Regression: No


Attachments
lspci -vv when the device is present on boot. USB controller is 05:00.0. (51.01 KB, text/plain)
2016-08-02 16:41 UTC, Richard van der Hoff
Details
lspci -vv after hotplug (15.03 KB, text/plain)
2016-08-02 16:41 UTC, Richard van der Hoff
Details
dmesg (87.89 KB, text/plain)
2016-08-02 16:46 UTC, Richard van der Hoff
Details
Working kernel config (190.78 KB, text/plain)
2016-08-25 16:14 UTC, Richard van der Hoff
Details
dmesg showing hotplug event (75.51 KB, text/x-log)
2016-08-25 16:19 UTC, Richard van der Hoff
Details
acpidump (865.89 KB, text/plain)
2016-08-25 18:19 UTC, Richard van der Hoff
Details

Description Richard van der Hoff 2016-08-02 16:40:48 UTC
I'm attempting to use a Plugable USB-C docking station, with my laptop, a Dell XPS 13 (9350). The docking station provides a USB hub, ethernet-over-USB, Displayport via USB-C Alternate Mode, and USB power delivery.

If the docking station is plugged in at startup, everything works correctly. However, if it is unplugged and plugged back in, the USB devices are not detected; lspci shows only "!!! Unknown header type 7f" against the USB controller.
Comment 1 Richard van der Hoff 2016-08-02 16:41:13 UTC
Created attachment 227331 [details]
lspci -vv when the device is present on boot. USB controller is 05:00.0.
Comment 2 Richard van der Hoff 2016-08-02 16:41:44 UTC
Created attachment 227341 [details]
lspci -vv after hotplug
Comment 3 Richard van der Hoff 2016-08-02 16:46:25 UTC
Created attachment 227351 [details]
dmesg

dmesg showing a disconnect/connect cycle.

The device was disconnected at 843s; the WARNING is concerning but appears to be to do with the alternate-mode display (which seems to work fine) rather than the USB subsystem.

The xhci_hcd errors at 848s may be more relevant?

The device was reconnected at 879s.
Comment 4 Richard van der Hoff 2016-08-02 16:47:35 UTC
(I've tried updating to the latest BIOS/firmware from Dell. Hotplugging appears to work correctly under Windows.)
Comment 5 Richard van der Hoff 2016-08-12 08:32:15 UTC
Anything I can do to help investigate this?
Comment 6 Richard van der Hoff 2016-08-23 21:29:40 UTC
I've noticed that the USB devices start working correctly if I force a rescan of the PCI devices:

echo 1 > /sys/bus/pci/devices/0000:01:00.0/remove
echo 1 > /sys/bus/pci/devices/0000:00:1c.0/rescan
Comment 7 Bjorn Helgaas 2016-08-23 22:15:58 UTC
I think only USB hotplug is involved here, not PCI hotplug, right?  Reassigning to USB on that assumption.
Comment 8 Greg Kroah-Hartman 2016-08-24 00:23:41 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 9 Greg Kroah-Hartman 2016-08-24 00:23:42 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 10 Greg Kroah-Hartman 2016-08-24 00:23:43 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 11 Greg Kroah-Hartman 2016-08-24 00:23:46 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 12 Greg Kroah-Hartman 2016-08-24 00:23:47 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 13 Greg Kroah-Hartman 2016-08-24 00:23:48 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 14 Greg Kroah-Hartman 2016-08-24 00:23:49 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 15 Greg Kroah-Hartman 2016-08-24 00:23:49 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 16 Greg Kroah-Hartman 2016-08-24 00:23:50 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 17 Greg Kroah-Hartman 2016-08-24 00:23:51 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 18 Greg Kroah-Hartman 2016-08-24 00:23:53 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 19 Greg Kroah-Hartman 2016-08-24 00:23:56 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 20 Greg Kroah-Hartman 2016-08-24 00:23:57 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 21 Greg Kroah-Hartman 2016-08-24 00:23:57 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 22 Greg Kroah-Hartman 2016-08-24 00:24:01 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 23 Greg Kroah-Hartman 2016-08-24 00:24:01 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 24 Greg Kroah-Hartman 2016-08-24 00:24:02 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 25 Greg Kroah-Hartman 2016-08-24 00:24:03 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 26 Greg Kroah-Hartman 2016-08-24 00:24:04 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 27 Greg Kroah-Hartman 2016-08-24 00:24:04 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 28 Greg Kroah-Hartman 2016-08-24 00:24:05 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 29 Greg Kroah-Hartman 2016-08-24 00:24:05 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 30 Greg Kroah-Hartman 2016-08-24 00:24:05 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 31 Greg Kroah-Hartman 2016-08-24 00:24:05 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 32 Greg Kroah-Hartman 2016-08-24 00:24:06 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 33 Greg Kroah-Hartman 2016-08-24 00:24:07 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 34 Greg Kroah-Hartman 2016-08-24 00:24:08 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 35 Greg Kroah-Hartman 2016-08-24 00:24:08 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 36 Greg Kroah-Hartman 2016-08-24 00:24:09 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 37 Greg Kroah-Hartman 2016-08-24 00:24:10 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 38 Greg Kroah-Hartman 2016-08-24 00:24:11 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 39 Greg Kroah-Hartman 2016-08-24 00:24:12 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 40 Greg Kroah-Hartman 2016-08-24 00:24:12 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 41 Greg Kroah-Hartman 2016-08-24 00:24:13 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 42 Greg Kroah-Hartman 2016-08-24 00:24:14 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 43 Greg Kroah-Hartman 2016-08-24 00:24:21 UTC
On Tue, Aug 23, 2016 at 10:15:58PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=151261

Please send this to the linux-usb@vger.kernel.org mailing list.
Comment 44 Richard van der Hoff 2016-08-24 09:38:17 UTC
Should I send it to the linux-usb@vger.kernel.org mailing list?
Comment 45 Richard van der Hoff 2016-08-24 16:48:10 UTC
Feedback from the USB mailing list confirms my suspicion that this is a PCI issue.

There is a chain of three PCI bridges (00:1c.0, 01:00.0, 02:02.0) before a PCI->USB bridge (05:00.0 or 39:00.0); it is the PCI bridges which are not appearing automatically after a hotplug (they appear if I force a rescan).

I've also raised this on the linux-pci mailing list.
Comment 46 Richard van der Hoff 2016-08-25 12:17:46 UTC
It turned out that all that was needed to fix this was a kernel with CONFIG_HOTPLUG_PCI=y. Thanks to those that offered pointers.
Comment 47 Bjorn Helgaas 2016-08-25 13:20:55 UTC
Strictly speaking, I think you need both of the following:

  CONFIG_HOTPLUG_PCI=y
  CONFIG_HOTPLUG_PCI_PCIE=y
Comment 48 Richard van der Hoff 2016-08-25 13:37:02 UTC
> Strictly speaking, I think you need both of the following:
>
>  CONFIG_HOTPLUG_PCI=y
>  CONFIG_HOTPLUG_PCI_PCIE=y

Apparently not, for me; though having both certainly seems a sensible precaution.
Comment 49 Bjorn Helgaas 2016-08-25 16:07:03 UTC
Oh, your system must use acpiphp then?  Do you have CONFIG_HOTPLUG_PCI_ACPI=y?  Can you attach a complete dmesg log showing a hotplug event?
Comment 50 Richard van der Hoff 2016-08-25 16:14:22 UTC
Created attachment 230211 [details]
Working kernel config
Comment 51 Richard van der Hoff 2016-08-25 16:19:35 UTC
Created attachment 230221 [details]
dmesg showing hotplug event

Hotplug starts at 76.965131.
Comment 52 Richard van der Hoff 2016-08-25 16:22:41 UTC
(In reply to Bjorn Helgaas from comment #49)
> Oh, your system must use acpiphp then?  Do you have
> CONFIG_HOTPLUG_PCI_ACPI=y?  

Apparently so. Complete config attached.

> Can you attach a complete dmesg log showing a
> hotplug event?

Done.

It seems I'm not quite out of the woods yet - unplugging the dock just now caused a kernel panic. Nothing useful in the logs, sadly; if it repeats I'll try to collect some more information and report elsewhere.
Comment 53 Bjorn Helgaas 2016-08-25 16:40:29 UTC
Adding Andreas.  My guess is that your system uses acpiphp so the platform can do Thunderbolt magic when the hotplug happens.  Your dmesg shows some ACPI errors when you do the hotplug, so maybe there's some issue there.  I don't really know how to debug that, but if I were to try, an acpidump might be useful.
Comment 54 Richard van der Hoff 2016-08-25 18:19:50 UTC
Created attachment 230241 [details]
acpidump
Comment 55 Richard van der Hoff 2016-08-25 18:23:13 UTC
The panic turns out to be quite repeatable. It begins (as collected over a serial console):

[   44.010232] BUG: unable to handle kernel NULL pointer dereference at           (null)
[   44.010274] IP: [<ffffffff81630316>] usb_hc_died+0x16/0xc0
[   44.010292] PGD 0 
[   44.010300] Oops: 0000 [#1] SMP
[   44.010310] Modules linked in: xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter ip_tables x_tables rfcomm bnep snd_hda_codec_hdmi snd_soc_skl snd_soc_skl_ipc snd_soc_sst_ipc snd_soc_sst_dsp snd_hda_ext_core snd_soc_sst_match snd_soc_core snd_hda_codec_realtek binfmt_misc snd_compress snd_hda_codec_generic i2c_designware_platform dcdbas ac97_bus i2c_des

Is it useful to file this, along with more details, as a separate bug?
Comment 56 Andreas Noever 2016-08-26 11:44:49 UTC
Looks like usb does not handle surprise removal that well.

Were you able to collect the whole stacktrace? usb_hc_died is called from a bunch of places.
Comment 57 Greg Kroah-Hartman 2016-08-26 12:03:02 UTC
On Fri, Aug 26, 2016 at 11:44:49AM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> Looks like usb does not handle surprise removal that well.

It's "xhci doesn't handle suprise removal of its device" that well, it's
not a USB core issue, it's the host controller driver issue.  And people
are working on it...

thanks,

greg k-h
Comment 58 Richard van der Hoff 2016-08-29 20:10:52 UTC
In the interest of trying to avoid confusion with the original bug, I've filed the panic as https://bugzilla.kernel.org/show_bug.cgi?id=155541.

Andreas: I captured a dump via kdump and extracted a stacktrace, which I have attached to that bug.

Apologies if it's duplicating already-known problems, but I thought it might be helpful to record some pointers in case anyone else is seeing the same symptoms.

Note You need to log in before you can comment on or make changes to this bug.