PCI/portdrv: do not disable device on remove()
Subsystems (3)
PATCH 1/1 PCI/portdrv: do not disable device on remove()
'Commit cc27b735ad3a ("PCI/portdrv: Turn off PCIe services during shutdown")' has been added to kernel to shutdown pending PCIe port service interrupts during reboot so that a newly started kexec kernel wouldn't observe pending interrupts.
pcie_port_device_remove() is disabling the root port and switches by calling pci_disable_device() after all PCIe service drivers are shutdown.
pci_disable_device() has a much wider impact then port service itself and it prevents all inbound transactions to reach to the system and impacts the entire PCI traffic behind the bridge.
Issue is that pcie_port_device_remove() doesn't maintain any coordination with the rest of the PCI device drivers in the system before clearing the bus master bit.
This has been found to cause crashes on HP DL360 Gen9 machines during reboot. Besides, kexec is already clearing the bus master bit in pci_device_shutdown() after all PCI drivers are removed.
Just remove the extra clear here.
--- drivers/pci/pcie/portdrv_core.c | 1 - 1 file changed, 1 deletion(-)
drivers/pci/pcie/portdrv_core.c +0 -1
@@ -409,7 +409,6 @@ void pcie_port_device_remove(struct pci_dev *dev) {device_for_each_child (&dev->dev,NULL , remove_iter);pci_free_irq_vectors (dev); -pci_disable_device (dev); }/**
Signature · 1 line
2.7.4
Quoted 12 lines · Sinan Kaya
'Commit
cc27b735ad3a("PCI/portdrv: Turn off PCIe services during shutdown")' has been added to kernel to shutdown pending PCIe port service interrupts during reboot so that a newly started kexec kernel wouldn't observe pending interrupts.
pcie_port_device_remove()is disabling the root port and switches by callingpci_disable_device()after all PCIe service drivers are shutdown.
pci_disable_device()has a much wider impact then port service itself and it prevents all inbound transactions to reach to the system and impacts the entire PCI traffic behind the bridge.
Quoted 7 lines
Issue is that
pcie_port_device_remove()doesn't maintain any coordination with the rest of the PCI device drivers in the system before clearing the bus master bit.This has been found to cause crashes on HP DL360 Gen9 machines during reboot. Besides, kexec is already clearing the bus master bit in
pci_device_shutdown()after all PCI drivers are removed.
FAOD, this problem has been observed on both DL360 Gen9 and DL380 Gen9, in both EFI and legacy modes. I suspect all Gen9 models with the P89 firmware base.
Quoted 1 line
Just remove the extra clear here.
Thank you! Fix tested on:
- DL360 Gen9
- DL380 Gen9
- DL380 Gen10 (confirmed no regression)
- DL380 G7 (confirmed no regression)
Quoted 5 lines
Signed-off-by Sinan Kaya <[email protected]>Fixes cc27b735ad3a ("PCI/portdrv: Turn off PCIe services during shutdown")Cc stable at vger.kernel.orgReported-by Ryan Finnie <[email protected]>
drivers/pci/pcie/portdrv_core.c void pcie_port_device_remove(struct pci_dev *dev) · line 412
Quoted 8 lines · Sinan Kaya
drivers/pci/pcie/portdrv_core.c +0
-1@@ -409,7 +409,6 @@ void pcie_port_device_remove(struct pci_dev *dev) {device_for_each_child (&dev->dev,NULL , remove_iter);pci_free_irq_vectors (dev); -pci_disable_device (dev); }
Shutdown aside, pci_disable_device() is also not called in the ->remove path with this patch, right? Seems wrong. E.g. when unbinding the driver from the root port device, or when unplugging a port (happens all the time with Thunderbolt).
Thanks,
Lukas
Quoted 14 lines · Lukas Wunner
drivers/pci/pcie/portdrv_core.c void pcie_port_device_remove(struct pci_dev *dev) · line 412
Quoted 8 lines · Sinan Kaya
drivers/pci/pcie/portdrv_core.c +0
-1@@ -409,7 +409,6 @@ void pcie_port_device_remove(struct pci_dev *dev) {device_for_each_child (&dev->dev,NULL , remove_iter);pci_free_irq_vectors (dev); -pci_disable_device (dev); }Shutdown aside,
pci_disable_device()is also not called in the ->remove path with this patch, right? Seems wrong. E.g. when unbinding the driver from the root port device, or when unplugging a port (happens all the time with Thunderbolt).
Agreed. I'll spin another version where I skip disable on shutdown path only.
Quoted 5 lines
Thanks,
Lukas
Signature · 3 lines
Sinan Kaya Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.