Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1433384 > unrolled thread

[PATCH] PM / runtime: Asynchronous "idle" in pm_runtime_allow()

Started by"Rafael J. Wysocki" <rjw@rjwysocki.net>
First post2016-06-29 02:50 +0200
Last post2016-07-01 00:50 +0200
Articles 5 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] PM / runtime: Asynchronous "idle" in pm_runtime_allow() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-06-29 02:50 +0200
    Re: [PATCH] PM / runtime: Asynchronous "idle" in pm_runtime_allow() Alan Stern <stern@rowland.harvard.edu> - 2016-06-29 16:10 +0200
      Re: [PATCH] PM / runtime: Asynchronous "idle" in pm_runtime_allow() Lukas Wunner <lukas@wunner.de> - 2016-06-29 17:00 +0200
    Re: [PATCH] PM / runtime: Asynchronous "idle" in pm_runtime_allow() Ulf Hansson <ulf.hansson@linaro.org> - 2016-06-29 19:00 +0200
    Re: [PATCH] PM / runtime: Asynchronous "idle" in pm_runtime_allow() Kevin Hilman <khilman@baylibre.com> - 2016-07-01 00:50 +0200

#1433384 — [PATCH] PM / runtime: Asynchronous "idle" in pm_runtime_allow()

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2016-06-29 02:50 +0200
Subject[PATCH] PM / runtime: Asynchronous "idle" in pm_runtime_allow()
Message-ID<rPbRv-5D5-5@gated-at.bofh.it>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Arjan reports that it takes a relatively long time to enable runtime
PM for multiple devices at system startup, because all writes to the
"control" attribute in sysfs are handled synchronously and if the
device is suspended as a result of the write, it will block until
that operation is complete.

That may be avoided by passing the RPM_ASYNC flag to rpm_idle()
in pm_runtime_allow() which will make it execute the device's
"idle" callback asynchronously, so writes to "control" changing
it from "on" to "auto" will return without waiting.

Reported-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/base/power/runtime.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-pm/drivers/base/power/runtime.c
===================================================================
--- linux-pm.orig/drivers/base/power/runtime.c
+++ linux-pm/drivers/base/power/runtime.c
@@ -1256,7 +1256,7 @@ void pm_runtime_allow(struct device *dev
 
 	dev->power.runtime_auto = true;
 	if (atomic_dec_and_test(&dev->power.usage_count))
-		rpm_idle(dev, RPM_AUTO);
+		rpm_idle(dev, RPM_AUTO | RPM_ASYNC);
 
  out:
 	spin_unlock_irq(&dev->power.lock);

[toc] | [next] | [standalone]


#1433766

FromAlan Stern <stern@rowland.harvard.edu>
Date2016-06-29 16:10 +0200
Message-ID<rPolI-5aS-5@gated-at.bofh.it>
In reply to#1433384
On Wed, 29 Jun 2016, Rafael J. Wysocki wrote:

> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Arjan reports that it takes a relatively long time to enable runtime
> PM for multiple devices at system startup, because all writes to the
> "control" attribute in sysfs are handled synchronously and if the
> device is suspended as a result of the write, it will block until
> that operation is complete.
> 
> That may be avoided by passing the RPM_ASYNC flag to rpm_idle()
> in pm_runtime_allow() which will make it execute the device's
> "idle" callback asynchronously, so writes to "control" changing
> it from "on" to "auto" will return without waiting.
> 
> Reported-by: Arjan van de Ven <arjan@linux.intel.com>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/base/power/runtime.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: linux-pm/drivers/base/power/runtime.c
> ===================================================================
> --- linux-pm.orig/drivers/base/power/runtime.c
> +++ linux-pm/drivers/base/power/runtime.c
> @@ -1256,7 +1256,7 @@ void pm_runtime_allow(struct device *dev
>  
>  	dev->power.runtime_auto = true;
>  	if (atomic_dec_and_test(&dev->power.usage_count))
> -		rpm_idle(dev, RPM_AUTO);
> +		rpm_idle(dev, RPM_AUTO | RPM_ASYNC);
>  
>   out:
>  	spin_unlock_irq(&dev->power.lock);

Acked-by: Alan Stern <stern@rowland.harvard.edu>

[toc] | [prev] | [next] | [standalone]


#1433830

FromLukas Wunner <lukas@wunner.de>
Date2016-06-29 17:00 +0200
Message-ID<rPp85-5s5-19@gated-at.bofh.it>
In reply to#1433766
On Wed, Jun 29, 2016 at 10:02:42AM -0400, Alan Stern wrote:
> On Wed, 29 Jun 2016, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > 
> > Arjan reports that it takes a relatively long time to enable runtime
> > PM for multiple devices at system startup, because all writes to the
> > "control" attribute in sysfs are handled synchronously and if the
> > device is suspended as a result of the write, it will block until
> > that operation is complete.
> > 
> > That may be avoided by passing the RPM_ASYNC flag to rpm_idle()
> > in pm_runtime_allow() which will make it execute the device's
> > "idle" callback asynchronously, so writes to "control" changing
> > it from "on" to "auto" will return without waiting.

Looks like pm_runtime_allow() can now be added to the section "It is
safe to execute the following helper functions from interrupt context"
in Documentation/power/runtime_pm.txt.

Best regards,

Lukas

> > 
> > Reported-by: Arjan van de Ven <arjan@linux.intel.com>
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
> >  drivers/base/power/runtime.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > Index: linux-pm/drivers/base/power/runtime.c
> > ===================================================================
> > --- linux-pm.orig/drivers/base/power/runtime.c
> > +++ linux-pm/drivers/base/power/runtime.c
> > @@ -1256,7 +1256,7 @@ void pm_runtime_allow(struct device *dev
> >  
> >  	dev->power.runtime_auto = true;
> >  	if (atomic_dec_and_test(&dev->power.usage_count))
> > -		rpm_idle(dev, RPM_AUTO);
> > +		rpm_idle(dev, RPM_AUTO | RPM_ASYNC);
> >  
> >   out:
> >  	spin_unlock_irq(&dev->power.lock);
> 
> Acked-by: Alan Stern <stern@rowland.harvard.edu>

[toc] | [prev] | [next] | [standalone]


#1433913

FromUlf Hansson <ulf.hansson@linaro.org>
Date2016-06-29 19:00 +0200
Message-ID<rPr0d-6DT-5@gated-at.bofh.it>
In reply to#1433384
On 29 June 2016 at 02:53, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Arjan reports that it takes a relatively long time to enable runtime
> PM for multiple devices at system startup, because all writes to the
> "control" attribute in sysfs are handled synchronously and if the
> device is suspended as a result of the write, it will block until
> that operation is complete.
>
> That may be avoided by passing the RPM_ASYNC flag to rpm_idle()
> in pm_runtime_allow() which will make it execute the device's
> "idle" callback asynchronously, so writes to "control" changing
> it from "on" to "auto" will return without waiting.
>
> Reported-by: Arjan van de Ven <arjan@linux.intel.com>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
>  drivers/base/power/runtime.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-pm/drivers/base/power/runtime.c
> ===================================================================
> --- linux-pm.orig/drivers/base/power/runtime.c
> +++ linux-pm/drivers/base/power/runtime.c
> @@ -1256,7 +1256,7 @@ void pm_runtime_allow(struct device *dev
>
>         dev->power.runtime_auto = true;
>         if (atomic_dec_and_test(&dev->power.usage_count))
> -               rpm_idle(dev, RPM_AUTO);
> +               rpm_idle(dev, RPM_AUTO | RPM_ASYNC);
>
>   out:
>         spin_unlock_irq(&dev->power.lock);
>

[toc] | [prev] | [next] | [standalone]


#1434892

FromKevin Hilman <khilman@baylibre.com>
Date2016-07-01 00:50 +0200
Message-ID<rPSWt-6SL-3@gated-at.bofh.it>
In reply to#1433384
"Rafael J. Wysocki" <rjw@rjwysocki.net> writes:

> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Arjan reports that it takes a relatively long time to enable runtime
> PM for multiple devices at system startup, because all writes to the
> "control" attribute in sysfs are handled synchronously and if the
> device is suspended as a result of the write, it will block until
> that operation is complete.
>
> That may be avoided by passing the RPM_ASYNC flag to rpm_idle()
> in pm_runtime_allow() which will make it execute the device's
> "idle" callback asynchronously, so writes to "control" changing
> it from "on" to "auto" will return without waiting.
>
> Reported-by: Arjan van de Ven <arjan@linux.intel.com>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Reviewed-by: Kevin Hilman <khilman@baylibre.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web