lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2aa22bd4-8337-4356-e7fd-3ae5678c1b6f@linaro.org>
Date:   Mon, 2 Dec 2019 13:34:54 +0100
From:   Daniel Lezcano <daniel.lezcano@...aro.org>
To:     Viresh Kumar <viresh.kumar@...aro.org>
Cc:     rjw@...ysocki.net, edubezval@...il.com, rui.zhang@...el.com,
        linux-pm@...r.kernel.org, amit.kucheria@...aro.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] thermal/drivers/cpu_cooling: Introduce the cpu idle
 cooling driver


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@...aro.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@...aro.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ