[+cc Rafael, linux-pm for a PM perspective] On Mon, Jun 11, 2018 at 04:29:18PM -0600, Keith Busch wrote: > A bridge that supports D3 but not hotplug will be subject to runtime > power management placing it in a non-operation power state if it doesn't > have any devices attached. This patch will prevent this power management > during error recovery so that the rescan at the end may be successful. I assume you're seeing a problem that's fixed by this patch? I'm not very familiar with the pm_runtime_*() interfaces. The fact that drivers/pci/ only contains two calls to pm_runtime_forbid() and two to pm_runtime_allow() (one in a quirk) makes me wonder if this is the right approach. Do we need something similar in other enumeration paths, e.g., boot-time enumeration, hot-add, sysfs "rescan" entry, etc? > Cc: Oza Pawandeep <poza@xxxxxxxxxxxxxx> > Signed-off-by: Keith Busch <keith.busch@xxxxxxxxx> > --- > drivers/pci/pcie/err.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c > index f7ce0cb0b0b7..247b6ce14f0d 100644 > --- a/drivers/pci/pcie/err.c > +++ b/drivers/pci/pcie/err.c > @@ -16,6 +16,7 @@ > #include <linux/kernel.h> > #include <linux/errno.h> > #include <linux/aer.h> > +#include <linux/pm_runtime.h> > #include "portdrv.h" > #include "../pci.h" > > @@ -294,6 +295,7 @@ void pcie_do_fatal_recovery(struct pci_dev *dev, u32 service) > udev = dev->bus->self; > > parent = udev->subordinate; > + pm_runtime_forbid(&udev->dev); > pci_lock_rescan_remove(); > list_for_each_entry_safe_reverse(pdev, temp, &parent->devices, > bus_list) { > @@ -329,6 +331,7 @@ void pcie_do_fatal_recovery(struct pci_dev *dev, u32 service) > } > > pci_unlock_rescan_remove(); > + pm_runtime_allow(&udev->dev); > } > > /** > -- > 2.14.3 >