Message ID | 1447799871-56374-14-git-send-email-lina.iyer@linaro.org (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Andy Gross |
Headers | show |
On 18 November 2015 at 06:37, Lina Iyer <lina.iyer@linaro.org> wrote: > Notify runtime PM when the CPU is going to be powered off in the idle > state. This allows for runtime PM suspend/resume of the CPU as well as > its PM domain. > > Cc: Daniel Lezcano <daniel.lezcano@linaro.org> > Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> > Signed-off-by: Lina Iyer <lina.iyer@linaro.org> > --- > drivers/cpuidle/cpuidle-arm.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c > index 545069d..8e72a23 100644 > --- a/drivers/cpuidle/cpuidle-arm.c > +++ b/drivers/cpuidle/cpuidle-arm.c > @@ -11,13 +11,16 @@ > > #define pr_fmt(fmt) "CPUidle arm: " fmt > > +#include <linux/cpu.h> > #include <linux/cpuidle.h> > #include <linux/cpumask.h> > #include <linux/cpu_pm.h> > #include <linux/kernel.h> > #include <linux/module.h> > #include <linux/of.h> > +#include <linux/pm_runtime.h> > #include <linux/slab.h> > +#include <linux/rcupdate.h> > > #include <asm/cpuidle.h> > > @@ -45,6 +48,10 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, > > ret = cpu_pm_enter(); > if (!ret) { > + struct device *cpu_dev = get_cpu_device(dev->cpu); > + > + RCU_NONIDLE(pm_runtime_put_sync_suspend(cpu_dev)); By my test, it seems that the usage_count of cpu device will be decrease to -1 and the code never runs here. If it need a runtime_put somewhere? > + > /* > * Pass idle state index to cpu_suspend which in turn will > * call the CPU ops suspend protocol with idle index as a > @@ -52,6 +59,7 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, > */ > arm_cpuidle_suspend(idx); > > + RCU_NONIDLE(pm_runtime_get_sync(cpu_dev)); > cpu_pm_exit(); > } > > -- > 2.1.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-pm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Nov 18 2015 at 01:50 -0700, Zhaoyang Huang wrote: >On 18 November 2015 at 06:37, Lina Iyer <lina.iyer@linaro.org> wrote: >> Notify runtime PM when the CPU is going to be powered off in the idle >> state. This allows for runtime PM suspend/resume of the CPU as well as >> its PM domain. >> >> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> >> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> >> Signed-off-by: Lina Iyer <lina.iyer@linaro.org> >> --- >> drivers/cpuidle/cpuidle-arm.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c >> index 545069d..8e72a23 100644 >> --- a/drivers/cpuidle/cpuidle-arm.c >> +++ b/drivers/cpuidle/cpuidle-arm.c >> @@ -11,13 +11,16 @@ >> >> #define pr_fmt(fmt) "CPUidle arm: " fmt >> >> +#include <linux/cpu.h> >> #include <linux/cpuidle.h> >> #include <linux/cpumask.h> >> #include <linux/cpu_pm.h> >> #include <linux/kernel.h> >> #include <linux/module.h> >> #include <linux/of.h> >> +#include <linux/pm_runtime.h> >> #include <linux/slab.h> >> +#include <linux/rcupdate.h> >> >> #include <asm/cpuidle.h> >> >> @@ -45,6 +48,10 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, >> >> ret = cpu_pm_enter(); >> if (!ret) { >> + struct device *cpu_dev = get_cpu_device(dev->cpu); >> + >> + RCU_NONIDLE(pm_runtime_put_sync_suspend(cpu_dev)); >By my test, it seems that the usage_count of cpu device will be >decrease to -1 and the code never runs here. If it need a runtime_put >somewhere? You shouldn't have to. Pls make sure all the patches are pulled in and compiles successfully. Let me know if you still run into issues. Thanks, Lina >> + >> /* >> * Pass idle state index to cpu_suspend which in turn will >> * call the CPU ops suspend protocol with idle index as a >> @@ -52,6 +59,7 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, >> */ >> arm_cpuidle_suspend(idx); >> >> + RCU_NONIDLE(pm_runtime_get_sync(cpu_dev)); >> cpu_pm_exit(); >> } >> >> -- >> 2.1.4 >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-pm" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Lina Iyer <lina.iyer@linaro.org> writes: > Notify runtime PM when the CPU is going to be powered off in the idle > state. This allows for runtime PM suspend/resume of the CPU as well as > its PM domain. > > Cc: Daniel Lezcano <daniel.lezcano@linaro.org> > Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> > Signed-off-by: Lina Iyer <lina.iyer@linaro.org> > --- > drivers/cpuidle/cpuidle-arm.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c > index 545069d..8e72a23 100644 > --- a/drivers/cpuidle/cpuidle-arm.c > +++ b/drivers/cpuidle/cpuidle-arm.c > @@ -11,13 +11,16 @@ > > #define pr_fmt(fmt) "CPUidle arm: " fmt > > +#include <linux/cpu.h> > #include <linux/cpuidle.h> > #include <linux/cpumask.h> > #include <linux/cpu_pm.h> > #include <linux/kernel.h> > #include <linux/module.h> > #include <linux/of.h> > +#include <linux/pm_runtime.h> > #include <linux/slab.h> > +#include <linux/rcupdate.h> > > #include <asm/cpuidle.h> > > @@ -45,6 +48,10 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, > > ret = cpu_pm_enter(); > if (!ret) { > + struct device *cpu_dev = get_cpu_device(dev->cpu); > + > + RCU_NONIDLE(pm_runtime_put_sync_suspend(cpu_dev)); > + A comment in the changelog about the use of _put_sync_suspend() instead of a normal _put_sync() would be helpful for this patch. Kevin -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c index 545069d..8e72a23 100644 --- a/drivers/cpuidle/cpuidle-arm.c +++ b/drivers/cpuidle/cpuidle-arm.c @@ -11,13 +11,16 @@ #define pr_fmt(fmt) "CPUidle arm: " fmt +#include <linux/cpu.h> #include <linux/cpuidle.h> #include <linux/cpumask.h> #include <linux/cpu_pm.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/of.h> +#include <linux/pm_runtime.h> #include <linux/slab.h> +#include <linux/rcupdate.h> #include <asm/cpuidle.h> @@ -45,6 +48,10 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, ret = cpu_pm_enter(); if (!ret) { + struct device *cpu_dev = get_cpu_device(dev->cpu); + + RCU_NONIDLE(pm_runtime_put_sync_suspend(cpu_dev)); + /* * Pass idle state index to cpu_suspend which in turn will * call the CPU ops suspend protocol with idle index as a @@ -52,6 +59,7 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, */ arm_cpuidle_suspend(idx); + RCU_NONIDLE(pm_runtime_get_sync(cpu_dev)); cpu_pm_exit(); }
Notify runtime PM when the CPU is going to be powered off in the idle state. This allows for runtime PM suspend/resume of the CPU as well as its PM domain. Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Lina Iyer <lina.iyer@linaro.org> --- drivers/cpuidle/cpuidle-arm.c | 8 ++++++++ 1 file changed, 8 insertions(+)