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

login
register
mail settings
Submitter Dave Airlie
Date Nov. 7, 2012, 5:30 a.m.
Message ID <1352266209-29796-1-git-send-email-airlied@redhat.com>
Download mbox | patch
Permalink /patch/197624/
State Superseded
Headers show

Comments

Dave Airlie - Nov. 7, 2012, 5:30 a.m.
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 <ying.huang@intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/pci/pci-sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Huang Ying - Nov. 7, 2012, 5:58 a.m.
On Wed, 2012-11-07 at 15:30 +1000, Dave Airlie wrote:
> 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 <ying.huang@intel.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/pci/pci-sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> index 02d107b..12d3d52 100644
> --- a/drivers/pci/pci-sysfs.c
> +++ b/drivers/pci/pci-sysfs.c
> @@ -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


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dave Airlie - Nov. 7, 2012, 6:15 a.m.
> > 
> > Cc: Huang Ying <ying.huang@intel.com>
> > Cc: Bjorn Helgaas <bhelgaas@google.com>
> > Cc: Rafael J. Wysocki <rjw@sisk.pl>
> > Signed-off-by: Dave Airlie <airlied@redhat.com>
> > ---
> >  drivers/pci/pci-sysfs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> > index 02d107b..12d3d52 100644
> > --- a/drivers/pci/pci-sysfs.c
> > +++ b/drivers/pci/pci-sysfs.c
> > @@ -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.

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.
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Huang Ying - Nov. 7, 2012, 6:26 a.m.
On Wed, 2012-11-07 at 01:15 -0500, David Airlie wrote:
> > > 
> > > Cc: Huang Ying <ying.huang@intel.com>
> > > Cc: Bjorn Helgaas <bhelgaas@google.com>
> > > Cc: Rafael J. Wysocki <rjw@sisk.pl>
> > > Signed-off-by: Dave Airlie <airlied@redhat.com>
> > > ---
> > >  drivers/pci/pci-sysfs.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> > > index 02d107b..12d3d52 100644
> > > --- a/drivers/pci/pci-sysfs.c
> > > +++ b/drivers/pci/pci-sysfs.c
> > > @@ -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.
> 
> 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


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dave Airlie - Nov. 7, 2012, 6:31 a.m.
----- Original Message -----
> From: "Huang Ying" <ying.huang@intel.com>
> To: "David Airlie" <airlied@redhat.com>
> Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, "Bjorn Helgaas" <bhelgaas@google.com>, "Rafael J.
> Wysocki" <rjw@sisk.pl>
> Sent: Wednesday, 7 November, 2012 4:26:25 PM
> Subject: Re: [PATCH] pci/runtime-pm: respect devices autosuspend timeout on config access
> 
> On Wed, 2012-11-07 at 01:15 -0500, David Airlie wrote:
> > > > 
> > > > Cc: Huang Ying <ying.huang@intel.com>
> > > > Cc: Bjorn Helgaas <bhelgaas@google.com>
> > > > Cc: Rafael J. Wysocki <rjw@sisk.pl>
> > > > Signed-off-by: Dave Airlie <airlied@redhat.com>
> > > > ---
> > > >  drivers/pci/pci-sysfs.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> > > > index 02d107b..12d3d52 100644
> > > > --- a/drivers/pci/pci-sysfs.c
> > > > +++ b/drivers/pci/pci-sysfs.c
> > > > @@ -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.
> > 
> > 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.

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

Thanks,
Dave.
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 02d107b..12d3d52 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -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);
 }