]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
PCI: pciehp: Fix race condition handling surprise link down
authorMika Westerberg <mika.westerberg@linux.intel.com>
Fri, 13 Oct 2017 18:35:46 +0000 (21:35 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 7 Nov 2017 00:49:00 +0000 (18:49 -0600)
commit499022396a381d1b681105b74ac366017ce051e9
tree03a82bbaa0605948aa63150def1cc440e9abcedb
parent1a5767725cecedd80a541799c83c0c97b8b5b624
PCI: pciehp: Fix race condition handling surprise link down

A surprise link down may retrain very quickly causing the same slot
generate a link up event before handling the link down event completes.

Since the link is active, the power off work queued from the first link
down will cause a second down event when power is disabled. However, the
link up event sets the slot state to POWERON_STATE before the event to
handle this is enqueued, making the second down event believe it needs to
do something.

This creates constant link up and down event cycle.

To prevent this it is better to handle each event at the time in order it
occurred, so change the driver to use ordered workqueue instead.

A normal device hotplug triggers two events (presense detect and link up)
that are already handled properly in the driver but we currently log an
error if we find an existing device in the slot. Since this is not an error
change the log level to be debug instead to avoid scaring users.

This is based on the original work by Ashok Raj.

Link: https://patchwork.kernel.org/patch/9469023
Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/hotplug/pciehp_ctrl.c
drivers/pci/hotplug/pciehp_hpc.c
drivers/pci/hotplug/pciehp_pci.c