* [PATCH] ACPI / hotplug / PCI: Take runtime PM autosuspend into account
@ 2019-11-13 15:41 Mika Westerberg
2019-11-13 21:50 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Mika Westerberg @ 2019-11-13 15:41 UTC (permalink / raw)
To: Rafael J. Wysocki, Bjorn Helgaas
Cc: Len Brown, Mika Westerberg, linux-acpi, linux-pci
PCIe ports (the only ones we do runtime PM) are using runtime PM
autosuspend to keep the port powered on for a while after it becomes
idle. However, ACPI hotplug does not take this into account so if we get
multiple hotplug events in a short period of time we may be powering
ports on and off and then back on unnecessarily.
For this reason call pm_runtime_put_autosuspend() for them (with the
accompanying pm_runtime_mark_last_busy()).
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
drivers/pci/hotplug/acpiphp_glue.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index b3869951c0eb..c8264af40643 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -672,7 +672,8 @@ static void trim_stale_devices(struct pci_dev *dev)
list_for_each_entry_safe_reverse(child, tmp, &bus->devices, bus_list)
trim_stale_devices(child);
- pm_runtime_put(&dev->dev);
+ pm_runtime_mark_last_busy(&dev->dev);
+ pm_runtime_put_autosuspend(&dev->dev);
}
}
@@ -714,8 +715,10 @@ static void acpiphp_check_bridge(struct acpiphp_bridge *bridge)
}
}
- if (bridge->pci_dev)
- pm_runtime_put(&bridge->pci_dev->dev);
+ if (bridge->pci_dev) {
+ pm_runtime_mark_last_busy(&bridge->pci_dev->dev);
+ pm_runtime_put_autosuspend(&bridge->pci_dev->dev);
+ }
}
/*
--
2.24.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ACPI / hotplug / PCI: Take runtime PM autosuspend into account
2019-11-13 15:41 [PATCH] ACPI / hotplug / PCI: Take runtime PM autosuspend into account Mika Westerberg
@ 2019-11-13 21:50 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2019-11-13 21:50 UTC (permalink / raw)
To: Mika Westerberg
Cc: Rafael J. Wysocki, Bjorn Helgaas, Len Brown,
ACPI Devel Maling List, Linux PCI
On Wed, Nov 13, 2019 at 4:41 PM Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
>
> PCIe ports (the only ones we do runtime PM) are using runtime PM
> autosuspend to keep the port powered on for a while after it becomes
> idle. However, ACPI hotplug does not take this into account so if we get
> multiple hotplug events in a short period of time we may be powering
> ports on and off and then back on unnecessarily.
>
> For this reason call pm_runtime_put_autosuspend() for them (with the
> accompanying pm_runtime_mark_last_busy()).
>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Makes sense:
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/pci/hotplug/acpiphp_glue.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
> index b3869951c0eb..c8264af40643 100644
> --- a/drivers/pci/hotplug/acpiphp_glue.c
> +++ b/drivers/pci/hotplug/acpiphp_glue.c
> @@ -672,7 +672,8 @@ static void trim_stale_devices(struct pci_dev *dev)
> list_for_each_entry_safe_reverse(child, tmp, &bus->devices, bus_list)
> trim_stale_devices(child);
>
> - pm_runtime_put(&dev->dev);
> + pm_runtime_mark_last_busy(&dev->dev);
> + pm_runtime_put_autosuspend(&dev->dev);
> }
> }
>
> @@ -714,8 +715,10 @@ static void acpiphp_check_bridge(struct acpiphp_bridge *bridge)
> }
> }
>
> - if (bridge->pci_dev)
> - pm_runtime_put(&bridge->pci_dev->dev);
> + if (bridge->pci_dev) {
> + pm_runtime_mark_last_busy(&bridge->pci_dev->dev);
> + pm_runtime_put_autosuspend(&bridge->pci_dev->dev);
> + }
> }
>
> /*
> --
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-13 21:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 15:41 [PATCH] ACPI / hotplug / PCI: Take runtime PM autosuspend into account Mika Westerberg
2019-11-13 21:50 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).