linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: rjw@rjwysocki.net, edubezval@gmail.com, rui.zhang@intel.com,
	linux-pm@vger.kernel.org, amit.kucheria@linaro.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver
Date: Mon, 2 Dec 2019 13:34:54 +0100	[thread overview]
Message-ID: <2aa22bd4-8337-4356-e7fd-3ae5678c1b6f@linaro.org> (raw)
In-Reply-To: <20191126080315.zc5rllbsc5utuhzq@vireshk-i7>


Hi Viresh,

thanks for the review

On 26/11/2019 09:03, Viresh Kumar wrote:
> On 13-11-19, 09:40, Daniel Lezcano wrote:
>> The cpu idle cooling device offers a new method to cool down a CPU by
>> injecting idle cycles at runtime.
>>
>> It has some similarities with the intel power clamp driver but it is
>> actually designed to be more generic and relying on the idle injection
>> powercap framework.
>>
>> The idle injection cycle is fixed while the running cycle is variable. That
>> allows to have control on the device reactivity for the user experience.
>>
>> An idle state powering down the CPU or the cluster will allow to drop
>> the static leakage, thus restoring the heat capacity of the SoC. It
>> can be set with a trip point between the hot and the critical points,
>> giving the opportunity to prevent a hard reset of the system when the
>> cpufreq cooling fails to cool down the CPU.
>>
>> With more sophisticated boards having a per core sensor, the idle
>> cooling device allows to cool down a single core without throttling
>> the compute capacity of several cpus belonging to the same clock line,
>> so it could be used in collaboration with the cpufreq cooling device.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---
>>  drivers/thermal/Kconfig           |   7 +
>>  drivers/thermal/Makefile          |   1 +
>>  drivers/thermal/cpuidle_cooling.c | 233 ++++++++++++++++++++++++++++++
>>  include/linux/cpu_cooling.h       |  22 +++
>>  4 files changed, 263 insertions(+)
>>  create mode 100644 drivers/thermal/cpuidle_cooling.c
>>
>> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
>> index 2b82c4861091..00d69906c508 100644
>> --- a/drivers/thermal/Kconfig
>> +++ b/drivers/thermal/Kconfig
>> @@ -168,6 +168,13 @@ config CPU_FREQ_THERMAL
>>  	  This will be useful for platforms using the generic thermal interface
>>  	  and not the ACPI interface.
>>  
>> +config CPU_IDLE_THERMAL
>> +	bool "CPU idle cooling device"
>> +	depends on IDLE_INJECT
>> +	help
>> +	  This implements the CPU cooling mechanism through
>> +	  idle injection. This will throttle the CPU by injecting
>> +	  idle cycle.
>>  endif
>>  
>>  config CLOCK_THERMAL
>> diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
>> index d3b01cc96981..9c8aa2d4bd28 100644
>> --- a/drivers/thermal/Makefile
>> +++ b/drivers/thermal/Makefile
>> @@ -20,6 +20,7 @@ thermal_sys-$(CONFIG_THERMAL_GOV_POWER_ALLOCATOR)	+= power_allocator.o
>>  
>>  # cpufreq cooling
>>  thermal_sys-$(CONFIG_CPU_FREQ_THERMAL)	+= cpu_cooling.o
> 
> We should really rename this as cpufreq_cooling now :)

Ok, will do on top of this series.

>> +thermal_sys-$(CONFIG_CPU_IDLE_THERMAL)	+= cpuidle_cooling.o
>>  
>>  # clock cooling
>>  thermal_sys-$(CONFIG_CLOCK_THERMAL)	+= clock_cooling.o
>> diff --git a/drivers/thermal/cpuidle_cooling.c b/drivers/thermal/cpuidle_cooling.c
>> new file mode 100644
>> index 000000000000..6e911fa87c47
>> --- /dev/null
>> +++ b/drivers/thermal/cpuidle_cooling.c
>> @@ -0,0 +1,233 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + *  Copyright (C) 2019 Linaro Limited.
>> + *
>> + *  Author: Daniel Lezcano <daniel.lezcano@linaro.org>
>> + *
>> + */
>> +#include <linux/cpu_cooling.h>
>> +#include <linux/cpuidle.h>
>> +#include <linux/err.h>
>> +#include <linux/idle_inject.h>
>> +#include <linux/idr.h>
>> +#include <linux/slab.h>
>> +#include <linux/thermal.h>
>> +
>> +/**
>> + * struct cpuidle_cooling_device - data for the idle cooling device
>> + * @ii_dev: an atomic to keep track of the last task exiting the idle cycle
>> + * @idle_duration_us: an integer defining the duration of the idle injection
>> + * @state: an normalized integer giving the state of the cooling device
>> + */
>> +struct cpuidle_cooling_device {
>> +	struct idle_inject_device *ii_dev;
>> +	unsigned int idle_duration_us;
> 
> This field is set with TICK_USEC and nothing else. Why not just use TICK_USEC
> instead at all the places and remove this field?

Actually the idle duration value is platform dependent and even it is
now TICK_USEC, we want to be able to change it (at boot or runtime).

I'll add a function to change the value.

[ ... ]

-- 
 <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


  reply	other threads:[~2019-12-02 12:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-13  8:40 [PATCH 1/3] thermal/drivers/Kconfig: Convert the CPU cooling device to a choice Daniel Lezcano
2019-11-13  8:40 ` [PATCH 2/3] thermal/drivers/cpu_cooling: Add idle cooling device documentation Daniel Lezcano
2019-11-13  8:40 ` [PATCH 3/3] thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver Daniel Lezcano
2019-11-26  8:03   ` Viresh Kumar
2019-12-02 12:34     ` Daniel Lezcano [this message]
2019-11-19  5:46 ` [PATCH 1/3] thermal/drivers/Kconfig: Convert the CPU cooling device to a choice Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2aa22bd4-8337-4356-e7fd-3ae5678c1b6f@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=amit.kucheria@linaro.org \
    --cc=edubezval@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=rui.zhang@intel.com \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).