linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 4/4] thermal: cpuidle: Register cpuidle cooling device
       [not found] <20200414220837.9284-1-daniel.lezcano@linaro.org>
@ 2020-04-14 22:08 ` Daniel Lezcano
  2020-04-21  8:15   ` Daniel Lezcano
  2020-04-28 15:31   ` Lukasz Luba
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Lezcano @ 2020-04-14 22:08 UTC (permalink / raw)
  To: daniel.lezcano, rui.zhang
  Cc: amit.kucheria, Lorenzo Pieralisi,
	open list:CPU IDLE TIME MANAGEMENT FRAMEWORK, Rafael J. Wysocki,
	open list, Sudeep Holla, open list:CPUIDLE DRIVER - ARM PSCI

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>
---
 drivers/cpuidle/cpuidle-arm.c  | 5 +++++
 drivers/cpuidle/cpuidle-psci.c | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c
index 9e5156d39627..2406ac0ae134 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,10 @@ static int __init arm_idle_init_cpu(int cpu)
 	if (ret)
 		goto out_kfree_drv;
 
+	ret = cpuidle_cooling_register(drv);
+	if (ret)
+		pr_err("Failed to register the idle cooling device: %d\n", ret);
+
 	return 0;
 
 out_kfree_drv:
diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
index edd7a54ef0d3..8e805bff646f 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>
@@ -305,6 +306,10 @@ static int __init psci_idle_init_cpu(int cpu)
 	if (ret)
 		goto out_kfree_drv;
 
+	ret = cpuidle_cooling_register(drv);
+	if (ret)
+		pr_err("Failed to register the idle cooling device: %d\n", ret);
+
 	return 0;
 
 out_kfree_drv:
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 4/4] thermal: cpuidle: Register cpuidle cooling device
  2020-04-14 22:08 ` [PATCH v3 4/4] thermal: cpuidle: Register cpuidle cooling device Daniel Lezcano
@ 2020-04-21  8:15   ` Daniel Lezcano
  2020-04-27 16:50     ` Daniel Lezcano
  2020-04-28 15:31   ` Lukasz Luba
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Lezcano @ 2020-04-21  8:15 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Sudeep Holla
  Cc: amit.kucheria, open list:CPU IDLE TIME MANAGEMENT FRAMEWORK,
	Rafael J. Wysocki, open list, rui.zhang,
	open list:CPUIDLE DRIVER - ARM PSCI


Hi Lorenzo, Sudeep,

other patches of the series are acked / reviewed.

If you are ok with these changes, could you add your acked-by so I can
merge all the series via the thermal tree?

Thanks

  -- Daniel

On 15/04/2020 00:08, 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>
> ---
>  drivers/cpuidle/cpuidle-arm.c  | 5 +++++
>  drivers/cpuidle/cpuidle-psci.c | 5 +++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c
> index 9e5156d39627..2406ac0ae134 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,10 @@ static int __init arm_idle_init_cpu(int cpu)
>  	if (ret)
>  		goto out_kfree_drv;
>  
> +	ret = cpuidle_cooling_register(drv);
> +	if (ret)
> +		pr_err("Failed to register the idle cooling device: %d\n", ret);
> +
>  	return 0;
>  
>  out_kfree_drv:
> diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
> index edd7a54ef0d3..8e805bff646f 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>
> @@ -305,6 +306,10 @@ static int __init psci_idle_init_cpu(int cpu)
>  	if (ret)
>  		goto out_kfree_drv;
>  
> +	ret = cpuidle_cooling_register(drv);
> +	if (ret)
> +		pr_err("Failed to register the idle cooling device: %d\n", ret);
> +
>  	return 0;
>  
>  out_kfree_drv:
> 


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 4/4] thermal: cpuidle: Register cpuidle cooling device
  2020-04-21  8:15   ` Daniel Lezcano
@ 2020-04-27 16:50     ` Daniel Lezcano
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Lezcano @ 2020-04-27 16:50 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Sudeep Holla
  Cc: amit.kucheria, open list:CPU IDLE TIME MANAGEMENT FRAMEWORK,
	Rafael J. Wysocki, open list, rui.zhang,
	open list:CPUIDLE DRIVER - ARM PSCI


Hi guys,

any chance you ack this patch ?


On 21/04/2020 10:15, Daniel Lezcano wrote:
> 
> Hi Lorenzo, Sudeep,
> 
> other patches of the series are acked / reviewed.
> 
> If you are ok with these changes, could you add your acked-by so I can
> merge all the series via the thermal tree?
> 
> Thanks
> 
>   -- Daniel
> 
> On 15/04/2020 00:08, 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>
>> ---
>>  drivers/cpuidle/cpuidle-arm.c  | 5 +++++
>>  drivers/cpuidle/cpuidle-psci.c | 5 +++++
>>  2 files changed, 10 insertions(+)
>>
>> diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c
>> index 9e5156d39627..2406ac0ae134 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,10 @@ static int __init arm_idle_init_cpu(int cpu)
>>  	if (ret)
>>  		goto out_kfree_drv;
>>  
>> +	ret = cpuidle_cooling_register(drv);
>> +	if (ret)
>> +		pr_err("Failed to register the idle cooling device: %d\n", ret);
>> +
>>  	return 0;
>>  
>>  out_kfree_drv:
>> diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
>> index edd7a54ef0d3..8e805bff646f 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>
>> @@ -305,6 +306,10 @@ static int __init psci_idle_init_cpu(int cpu)
>>  	if (ret)
>>  		goto out_kfree_drv;
>>  
>> +	ret = cpuidle_cooling_register(drv);
>> +	if (ret)
>> +		pr_err("Failed to register the idle cooling device: %d\n", ret);
>> +
>>  	return 0;
>>  
>>  out_kfree_drv:
>>
> 
> 


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 4/4] thermal: cpuidle: Register cpuidle cooling device
  2020-04-14 22:08 ` [PATCH v3 4/4] thermal: cpuidle: Register cpuidle cooling device Daniel Lezcano
  2020-04-21  8:15   ` Daniel Lezcano
@ 2020-04-28 15:31   ` Lukasz Luba
  1 sibling, 0 replies; 4+ messages in thread
From: Lukasz Luba @ 2020-04-28 15:31 UTC (permalink / raw)
  To: Daniel Lezcano, rui.zhang
  Cc: amit.kucheria, Lorenzo Pieralisi,
	open list:CPU IDLE TIME MANAGEMENT FRAMEWORK, Rafael J. Wysocki,
	open list, Sudeep Holla, open list:CPUIDLE DRIVER - ARM PSCI



On 4/14/20 11:08 PM, 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>
> ---
>   drivers/cpuidle/cpuidle-arm.c  | 5 +++++
>   drivers/cpuidle/cpuidle-psci.c | 5 +++++
>   2 files changed, 10 insertions(+)
> 
> diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c
> index 9e5156d39627..2406ac0ae134 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,10 @@ static int __init arm_idle_init_cpu(int cpu)
>   	if (ret)
>   		goto out_kfree_drv;
>   
> +	ret = cpuidle_cooling_register(drv);
> +	if (ret)
> +		pr_err("Failed to register the idle cooling device: %d\n", ret);

This and similar from cpuidle-psci.c might produce a lot of error log
entries. The 'return 0' below does not take into account that we failed
to register cpuidle cooling. Thus, I would rather ignore the return from 
cpuidle_cooling_register and move this print into
cpuidle_cooling_register function, changing it also to debug level.

> +
>   	return 0;
>   
>   out_kfree_drv:
> diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
> index edd7a54ef0d3..8e805bff646f 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>
> @@ -305,6 +306,10 @@ static int __init psci_idle_init_cpu(int cpu)
>   	if (ret)
>   		goto out_kfree_drv;
>   
> +	ret = cpuidle_cooling_register(drv);
> +	if (ret)
> +		pr_err("Failed to register the idle cooling device: %d\n", ret);
> +

The same here. I would change it into one line:
+	cpuidle_cooling_register(drv);

>   	return 0;
>   
>   out_kfree_drv:
> 

Regards,
Lukasz

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-28 15:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20200414220837.9284-1-daniel.lezcano@linaro.org>
2020-04-14 22:08 ` [PATCH v3 4/4] thermal: cpuidle: Register cpuidle cooling device Daniel Lezcano
2020-04-21  8:15   ` Daniel Lezcano
2020-04-27 16:50     ` Daniel Lezcano
2020-04-28 15:31   ` Lukasz Luba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).