diff mbox series

[v4,4/4] thermal: cpuidle: Register cpuidle cooling device

Message ID 20200429103644.5492-4-daniel.lezcano@linaro.org (mailing list archive)
State New
Delegated to: Daniel Lezcano
Headers show
Series [v4,1/4] powercap/drivers/idle_inject: Specify idle state max latency | expand

Commit Message

Daniel Lezcano April 29, 2020, 10:36 a.m. UTC
The cpuidle driver can be used as a cooling device by injecting idle
cycles. The DT binding for the idle state added an optional

When the property is set, register the cpuidle driver with the idle
state node pointer as a cooling device. The thermal framework will do
the association automatically with the thermal zone via the
cooling-device defined in the device tree cooling-maps section.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 - V4:
   - Do not check the return value as the function does no longer return one
---
 drivers/cpuidle/cpuidle-arm.c  | 3 +++
 drivers/cpuidle/cpuidle-psci.c | 3 +++
 2 files changed, 6 insertions(+)

Comments

Lukasz Luba April 29, 2020, 8:02 p.m. UTC | #1
On 4/29/20 11:36 AM, Daniel Lezcano wrote:
> The cpuidle driver can be used as a cooling device by injecting idle
> cycles. The DT binding for the idle state added an optional
> 
> When the property is set, register the cpuidle driver with the idle
> state node pointer as a cooling device. The thermal framework will do
> the association automatically with the thermal zone via the
> cooling-device defined in the device tree cooling-maps section.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>   - V4:
>     - Do not check the return value as the function does no longer return one
> ---
>   drivers/cpuidle/cpuidle-arm.c  | 3 +++
>   drivers/cpuidle/cpuidle-psci.c | 3 +++
>   2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c
> index 9e5156d39627..8c758920d699 100644
> --- a/drivers/cpuidle/cpuidle-arm.c
> +++ b/drivers/cpuidle/cpuidle-arm.c
> @@ -8,6 +8,7 @@
>   
>   #define pr_fmt(fmt) "CPUidle arm: " fmt
>   
> +#include <linux/cpu_cooling.h>
>   #include <linux/cpuidle.h>
>   #include <linux/cpumask.h>
>   #include <linux/cpu_pm.h>
> @@ -124,6 +125,8 @@ static int __init arm_idle_init_cpu(int cpu)
>   	if (ret)
>   		goto out_kfree_drv;
>   
> +	cpuidle_cooling_register(drv);
> +
>   	return 0;
>   
>   out_kfree_drv:
> diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
> index bae9140a65a5..1f38e0dfc9b2 100644
> --- a/drivers/cpuidle/cpuidle-psci.c
> +++ b/drivers/cpuidle/cpuidle-psci.c
> @@ -9,6 +9,7 @@
>   #define pr_fmt(fmt) "CPUidle PSCI: " fmt
>   
>   #include <linux/cpuhotplug.h>
> +#include <linux/cpu_cooling.h>
>   #include <linux/cpuidle.h>
>   #include <linux/cpumask.h>
>   #include <linux/cpu_pm.h>
> @@ -313,6 +314,8 @@ static int __init psci_idle_init_cpu(int cpu)
>   	if (ret)
>   		goto out_kfree_drv;
>   
> +	cpuidle_cooling_register(drv);
> +
>   	return 0;
>   
>   out_kfree_drv:
> 

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

Regards,
Lukasz
Daniel Lezcano April 29, 2020, 9:01 p.m. UTC | #2
On 29/04/2020 22:02, Lukasz Luba wrote:
> 
> 
> On 4/29/20 11:36 AM, Daniel Lezcano wrote:
>> The cpuidle driver can be used as a cooling device by injecting idle
>> cycles. The DT binding for the idle state added an optional
>>
>> When the property is set, register the cpuidle driver with the idle
>> state node pointer as a cooling device. The thermal framework will do
>> the association automatically with the thermal zone via the
>> cooling-device defined in the device tree cooling-maps section.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---
>>   - V4:
>>     - Do not check the return value as the function does no longer
>> return one
>> ---

[ ... ]

> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

Thanks Lukasz for the review.

Rafael, as Lorenzo and Sudeep are not responsive, could you consider ack
this patch so I can merge the series through the thermal tree ?
Daniel Lezcano May 4, 2020, 6 p.m. UTC | #3
Hi,

On 29/04/2020 23:01, Daniel Lezcano wrote:
> On 29/04/2020 22:02, Lukasz Luba wrote:
>>
>>
>> On 4/29/20 11:36 AM, Daniel Lezcano wrote:
>>> The cpuidle driver can be used as a cooling device by injecting idle
>>> cycles. The DT binding for the idle state added an optional
>>>
>>> When the property is set, register the cpuidle driver with the idle
>>> state node pointer as a cooling device. The thermal framework will do
>>> the association automatically with the thermal zone via the
>>> cooling-device defined in the device tree cooling-maps section.
>>>
>>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>>> ---
>>>   - V4:
>>>     - Do not check the return value as the function does no longer
>>> return one
>>> ---
> 
> [ ... ]
> 
>> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
> 
> Thanks Lukasz for the review.
> 
> Rafael, as Lorenzo and Sudeep are not responsive, could you consider ack
> this patch so I can merge the series through the thermal tree ?

Gentle ping ... Sudeep, Lorenzo or Rafael ?

Thanks

  -- Danie
Amit Kucheria May 6, 2020, 9:57 a.m. UTC | #4
On Wed, Apr 29, 2020 at 4:07 PM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> The cpuidle driver can be used as a cooling device by injecting idle
> cycles. The DT binding for the idle state added an optional

Incomplete sentence.

> When the property is set, register the cpuidle driver with the idle
> state node pointer as a cooling device. The thermal framework will do
> the association automatically with the thermal zone via the
> cooling-device defined in the device tree cooling-maps section.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Conditionally,

Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>


> ---
>  - V4:
>    - Do not check the return value as the function does no longer return one
> ---
>  drivers/cpuidle/cpuidle-arm.c  | 3 +++
>  drivers/cpuidle/cpuidle-psci.c | 3 +++
>  2 files changed, 6 insertions(+)
>
> diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c
> index 9e5156d39627..8c758920d699 100644
> --- a/drivers/cpuidle/cpuidle-arm.c
> +++ b/drivers/cpuidle/cpuidle-arm.c
> @@ -8,6 +8,7 @@
>
>  #define pr_fmt(fmt) "CPUidle arm: " fmt
>
> +#include <linux/cpu_cooling.h>
>  #include <linux/cpuidle.h>
>  #include <linux/cpumask.h>
>  #include <linux/cpu_pm.h>
> @@ -124,6 +125,8 @@ static int __init arm_idle_init_cpu(int cpu)
>         if (ret)
>                 goto out_kfree_drv;
>
> +       cpuidle_cooling_register(drv);
> +
>         return 0;
>
>  out_kfree_drv:
> diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
> index bae9140a65a5..1f38e0dfc9b2 100644
> --- a/drivers/cpuidle/cpuidle-psci.c
> +++ b/drivers/cpuidle/cpuidle-psci.c
> @@ -9,6 +9,7 @@
>  #define pr_fmt(fmt) "CPUidle PSCI: " fmt
>
>  #include <linux/cpuhotplug.h>
> +#include <linux/cpu_cooling.h>
>  #include <linux/cpuidle.h>
>  #include <linux/cpumask.h>
>  #include <linux/cpu_pm.h>
> @@ -313,6 +314,8 @@ static int __init psci_idle_init_cpu(int cpu)
>         if (ret)
>                 goto out_kfree_drv;
>
> +       cpuidle_cooling_register(drv);
> +
>         return 0;
>
>  out_kfree_drv:
> --
> 2.17.1
>
Sudeep Holla May 15, 2020, 9:58 a.m. UTC | #5
On Mon, May 04, 2020 at 08:00:01PM +0200, Daniel Lezcano wrote:
>
> Hi,
>
> On 29/04/2020 23:01, Daniel Lezcano wrote:
> > On 29/04/2020 22:02, Lukasz Luba wrote:
> >>
> >>
> >> On 4/29/20 11:36 AM, Daniel Lezcano wrote:
> >>> The cpuidle driver can be used as a cooling device by injecting idle
> >>> cycles. The DT binding for the idle state added an optional
> >>>
> >>> When the property is set, register the cpuidle driver with the idle
> >>> state node pointer as a cooling device. The thermal framework will do
> >>> the association automatically with the thermal zone via the
> >>> cooling-device defined in the device tree cooling-maps section.
> >>>
> >>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> >>> ---
> >>>   - V4:
> >>>     - Do not check the return value as the function does no longer
> >>> return one
> >>> ---
> >
> > [ ... ]
> >
> >> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
> >
> > Thanks Lukasz for the review.
> >
> > Rafael, as Lorenzo and Sudeep are not responsive, could you consider ack
> > this patch so I can merge the series through the thermal tree ?
>
> Gentle ping ... Sudeep, Lorenzo or Rafael ?
>

Sorry for the delay. I ignore this as it was generic and I was fine with
it. Didn't know you were waiting me, sorry for that.

FWIW:

Acked-by: Sudeep Holla <sudeep.holla@arm.com>

--
Regards,
Sudeep
Daniel Lezcano May 15, 2020, 11:03 a.m. UTC | #6
On 15/05/2020 11:58, Sudeep Holla wrote:
> On Mon, May 04, 2020 at 08:00:01PM +0200, Daniel Lezcano wrote:
>>
>> Hi,
>>
>> On 29/04/2020 23:01, Daniel Lezcano wrote:
>>> On 29/04/2020 22:02, Lukasz Luba wrote:
>>>>
>>>>
>>>> On 4/29/20 11:36 AM, Daniel Lezcano wrote:
>>>>> The cpuidle driver can be used as a cooling device by injecting idle
>>>>> cycles. The DT binding for the idle state added an optional
>>>>>
>>>>> When the property is set, register the cpuidle driver with the idle
>>>>> state node pointer as a cooling device. The thermal framework will do
>>>>> the association automatically with the thermal zone via the
>>>>> cooling-device defined in the device tree cooling-maps section.
>>>>>
>>>>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>>>>> ---
>>>>>   - V4:
>>>>>     - Do not check the return value as the function does no longer
>>>>> return one
>>>>> ---
>>>
>>> [ ... ]
>>>
>>>> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
>>>
>>> Thanks Lukasz for the review.
>>>
>>> Rafael, as Lorenzo and Sudeep are not responsive, could you consider ack
>>> this patch so I can merge the series through the thermal tree ?
>>
>> Gentle ping ... Sudeep, Lorenzo or Rafael ?
>>
> 
> Sorry for the delay. I ignore this as it was generic and I was fine with
> it. Didn't know you were waiting me, sorry for that.

No problem, thanks for the ack.

> Acked-by: Sudeep Holla <sudeep.holla@arm.com>

Rafael, if you are ok with that, I'll take this patch in the thermal
tree along with the others.
Ulf Hansson June 15, 2020, 11:25 a.m. UTC | #7
On Wed, 29 Apr 2020 at 12:37, Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>
> The cpuidle driver can be used as a cooling device by injecting idle
> cycles. The DT binding for the idle state added an optional
>
> When the property is set, register the cpuidle driver with the idle
> state node pointer as a cooling device. The thermal framework will do
> the association automatically with the thermal zone via the
> cooling-device defined in the device tree cooling-maps section.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  - V4:
>    - Do not check the return value as the function does no longer return one
> ---
>  drivers/cpuidle/cpuidle-arm.c  | 3 +++
>  drivers/cpuidle/cpuidle-psci.c | 3 +++
>  2 files changed, 6 insertions(+)
>
> diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c
> index 9e5156d39627..8c758920d699 100644
> --- a/drivers/cpuidle/cpuidle-arm.c
> +++ b/drivers/cpuidle/cpuidle-arm.c
> @@ -8,6 +8,7 @@
>
>  #define pr_fmt(fmt) "CPUidle arm: " fmt
>
> +#include <linux/cpu_cooling.h>
>  #include <linux/cpuidle.h>
>  #include <linux/cpumask.h>
>  #include <linux/cpu_pm.h>
> @@ -124,6 +125,8 @@ static int __init arm_idle_init_cpu(int cpu)
>         if (ret)
>                 goto out_kfree_drv;
>
> +       cpuidle_cooling_register(drv);
> +
>         return 0;
>
>  out_kfree_drv:
> diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
> index bae9140a65a5..1f38e0dfc9b2 100644
> --- a/drivers/cpuidle/cpuidle-psci.c
> +++ b/drivers/cpuidle/cpuidle-psci.c
> @@ -9,6 +9,7 @@
>  #define pr_fmt(fmt) "CPUidle PSCI: " fmt
>
>  #include <linux/cpuhotplug.h>
> +#include <linux/cpu_cooling.h>
>  #include <linux/cpuidle.h>
>  #include <linux/cpumask.h>
>  #include <linux/cpu_pm.h>
> @@ -313,6 +314,8 @@ static int __init psci_idle_init_cpu(int cpu)
>         if (ret)
>                 goto out_kfree_drv;
>
> +       cpuidle_cooling_register(drv);
> +

Apologies for the late reply, but just noticed this change in v5.8-rc1.

Don't you need a cpuidle_cooling_unregister function? For example,
cpuidle-psci may fail and then calls cpuidle_unregister() to cleans up
things.

Is that okay?

Kind regards
Uffe
diff mbox series

Patch

diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c
index 9e5156d39627..8c758920d699 100644
--- a/drivers/cpuidle/cpuidle-arm.c
+++ b/drivers/cpuidle/cpuidle-arm.c
@@ -8,6 +8,7 @@ 
 
 #define pr_fmt(fmt) "CPUidle arm: " fmt
 
+#include <linux/cpu_cooling.h>
 #include <linux/cpuidle.h>
 #include <linux/cpumask.h>
 #include <linux/cpu_pm.h>
@@ -124,6 +125,8 @@  static int __init arm_idle_init_cpu(int cpu)
 	if (ret)
 		goto out_kfree_drv;
 
+	cpuidle_cooling_register(drv);
+
 	return 0;
 
 out_kfree_drv:
diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
index bae9140a65a5..1f38e0dfc9b2 100644
--- a/drivers/cpuidle/cpuidle-psci.c
+++ b/drivers/cpuidle/cpuidle-psci.c
@@ -9,6 +9,7 @@ 
 #define pr_fmt(fmt) "CPUidle PSCI: " fmt
 
 #include <linux/cpuhotplug.h>
+#include <linux/cpu_cooling.h>
 #include <linux/cpuidle.h>
 #include <linux/cpumask.h>
 #include <linux/cpu_pm.h>
@@ -313,6 +314,8 @@  static int __init psci_idle_init_cpu(int cpu)
 	if (ret)
 		goto out_kfree_drv;
 
+	cpuidle_cooling_register(drv);
+
 	return 0;
 
 out_kfree_drv: