Skip to contentSkip to conversation

pci/runtime-pm: respect devices autosuspend timeout on config access

PATCH In review Dave Airlie 2 participants 5 messages Nov 7, 2012 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci/runtime-pm: respect devices autosuspend timeout on config access

So I've been adding runtime pm to nouveau/radeon, and on X start it does a lot of pci accesses. Now because the pm on these devices is equivalent to D3cold, we have to resume them which involves a heavy latency due to POSTing the cards. The driver configures the autosuspend timeout to 5s for this reason, and I think the PCI layer config accesses should respect the autosuspend.

Cc Huang Ying <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
---
 drivers/pci/pci-sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-sysfs.c +1 -1
index 02d107b..12d3d52 100644
@@ -487,7 +487,7 @@ pci_config_pm_runtime_put(struct pci_dev *pdev)
 	struct device *dev = &pdev->dev;
 	struct device *parent = dev->parent;
 
-	pm_runtime_put(dev);
+	pm_runtime_put_autosuspend(dev);
 	if (parent)
 		pm_runtime_put_sync(parent);
 }
Signature · 1 line
1.7.12.1
#1 lore raw
Quoted 20 lines · Dave Airlie

So I've been adding runtime pm to nouveau/radeon, and on X start it does a lot of pci accesses. Now because the pm on these devices is equivalent to D3cold, we have to resume them which involves a heavy latency due to POSTing the cards. The driver configures the autosuspend timeout to 5s for this reason, and I think the PCI layer config accesses should respect the autosuspend.

Cc Huang Ying <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
---
 drivers/pci/pci-sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-sysfs.c +0 -0
index 02d107b..12d3d52 100644

drivers/pci/pci-sysfs.c pci_config_pm_runtime_put(struct pci_dev *pdev) · line 493

Quoted 8 lines
drivers/pci/pci-sysfs.c +1 -1
@@ -487,7 +487,7 @@ pci_config_pm_runtime_put(struct pci_dev *pdev)
 	struct device *dev = &pdev->dev;
 	struct device *parent = dev->parent;
 
-	pm_runtime_put(dev);
+	pm_runtime_put_autosuspend(dev);
 	if (parent)
 		pm_runtime_put_sync(parent);
 }

I think you do not need that. You can implement timeout in .runtime_idle callback of the driver.

Best Regards,
Huang Ying

#2 lore raw
Quoted 18 lines
Quoted 18 lines
Cc Huang Ying <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
---
 drivers/pci/pci-sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-sysfs.c +0 -0
index 02d107b..12d3d52 100644
@@ -487,7 +487,7 @@ pci_config_pm_runtime_put(struct pci_dev *pdev)
 	struct device *dev = &pdev->dev;
 	struct device *parent = dev->parent;
 
Quoted 8 lines

drivers/pci/pci-sysfs.c pci_config_pm_runtime_put(struct pci_dev *pdev) · line 493

Quoted 5 lines
drivers/pci/pci-sysfs.c +1 -1
-	pm_runtime_put(dev);
+	pm_runtime_put_autosuspend(dev);
 	if (parent)
 		pm_runtime_put_sync(parent);
 }

I think you do not need that. You can implement timeout in .runtime_idle callback of the driver.

If I understand what you are suggesting, I should setup some kinda of timer callback to later call suspend, but that seems pointless for me if we have the autosuspend mechanism in place.

Won't I end up racing my timer against other pm stuff? I'm not really runtime pm expert so maybe I'm just missing something.

Dave.

#3 lore raw
Quoted 26 lines · David Airlie
Quoted 17 lines
Quoted 17 lines
Cc Huang Ying <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
---
 drivers/pci/pci-sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-sysfs.c +0 -0
index 02d107b..12d3d52 100644
@@ -487,7 +487,7 @@ pci_config_pm_runtime_put(struct pci_dev *pdev)
 	struct device *dev = &pdev->dev;
 	struct device *parent = dev->parent;
 
Quoted 8 lines

drivers/pci/pci-sysfs.c pci_config_pm_runtime_put(struct pci_dev *pdev) · line 493

Quoted 5 lines
drivers/pci/pci-sysfs.c +1 -1
-	pm_runtime_put(dev);
+	pm_runtime_put_autosuspend(dev);
 	if (parent)
 		pm_runtime_put_sync(parent);
 }

I think you do not need that. You can implement timeout in .runtime_idle callback of the driver.

Quoted 3 lines

If I understand what you are suggesting, I should setup some kinda of timer callback to later call suspend, but that seems pointless for me if we have the autosuspend mechanism in place.

Won't I end up racing my timer against other pm stuff? I'm not really runtime pm expert so maybe I'm just missing something.

You can call pm_runtime_autosuspend or pm_runtime_schedule_suspend in .runtime_idle callback of the driver.

Best Regards,
Huang Ying

#4 lore raw

----- Original Message -----

Quoted 39 lines

From: "Huang Ying" <[email protected]>
To: "David Airlie" <[email protected]>
Cc: [email protected], [email protected], "Bjorn Helgaas" <[email protected]>, "Rafael J. Wysocki" <[email protected]>
Sent: Wednesday, 7 November, 2012 4:26:25 PM
Subject: Re: [PATCH] pci/runtime-pm: respect devices autosuspend timeout on config access

Quoted 31 lines · David Airlie
Quoted 18 lines
Quoted 18 lines
Cc Huang Ying <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
---
 drivers/pci/pci-sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-sysfs.c +0 -0
index 02d107b..12d3d52 100644
@@ -487,7 +487,7 @@ pci_config_pm_runtime_put(struct pci_dev
 *pdev)
 	struct device *dev = &pdev->dev;
 	struct device *parent = dev->parent;
 
Quoted 8 lines
Quoted 5 lines
drivers/pci/pci-sysfs.c +1 -1
-	pm_runtime_put(dev);
+	pm_runtime_put_autosuspend(dev);
 	if (parent)
 		pm_runtime_put_sync(parent);

}

I think you do not need that. You can implement timeout in .runtime_idle callback of the driver.

If I understand what you are suggesting, I should setup some kinda of timer callback to later call suspend, but that seems pointless for me if we have the autosuspend mechanism in place.

Quoted 5 lines
Quoted 2 lines

Won't I end up racing my timer against other pm stuff? I'm not really runtime pm expert so maybe I'm just missing something.

You can call pm_runtime_autosuspend or pm_runtime_schedule_suspend in .runtime_idle callback of the driver.

Ah that explains what I was probably missing, I'll go play with that for a while then!

Thanks,
Dave.