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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191028153313.GF4097@hirez.programming.kicks-ass.net>
Date:   Mon, 28 Oct 2019 16:33:13 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Thara Gopinath <thara.gopinath@...aro.org>
Cc:     mingo@...hat.com, ionela.voinescu@....com,
        vincent.guittot@...aro.org, rui.zhang@...el.com,
        edubezval@...il.com, qperret@...gle.com,
        linux-kernel@...r.kernel.org, amit.kachhap@...il.com,
        javi.merino@...nel.org, daniel.lezcano@...aro.org
Subject: Re: [Patch v4 5/6] thermal/cpu-cooling: Update thermal pressure in
 case of a maximum frequency capping

On Tue, Oct 22, 2019 at 04:34:24PM -0400, Thara Gopinath wrote:
> Thermal governors can request for a cpu's maximum supported frequency
> to be capped in case of an overheat event. This in turn means that the
> maximum capacity available for tasks to run on the particular cpu is
> reduced. Delta between the original maximum capacity and capped
> maximum capacity is known as thermal pressure. Enable cpufreq cooling
> device to update the thermal pressure in event of a capped
> maximum frequency.
> 
> Signed-off-by: Thara Gopinath <thara.gopinath@...aro.org>
> ---
>  drivers/thermal/cpu_cooling.c | 31 +++++++++++++++++++++++++++++--
>  1 file changed, 29 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
> index 391f397..2e6a979 100644
> --- a/drivers/thermal/cpu_cooling.c
> +++ b/drivers/thermal/cpu_cooling.c
> @@ -218,6 +218,23 @@ static u32 cpu_power_to_freq(struct cpufreq_cooling_device *cpufreq_cdev,
>  }
>  
>  /**
> + * update_sched_max_capacity - update scheduler about change in cpu
> + *					max frequency.
> + * @policy - cpufreq policy whose max frequency is capped.

Uhm, this function doesn't have a @policy argument.

> + */
> +static void update_sched_max_capacity(struct cpumask *cpus,
> +				      unsigned int cur_max_freq,
> +				      unsigned int max_freq)
> +{
> +	int cpu;
> +	unsigned long capacity = (cur_max_freq << SCHED_CAPACITY_SHIFT) /
> +				  max_freq;

check your types and ranges. What units is _freq in and does 'freq *
SCHED_CAPACITY' fit in 'unsigned int'? If so, why do you assign it to an
'unsigned long'?

> +
> +	for_each_cpu(cpu, cpus)
> +		update_thermal_pressure(cpu, capacity);
> +}

> @@ -331,8 +349,17 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
>  
>  	cpufreq_cdev->cpufreq_state = state;
>  
> -	return dev_pm_qos_update_request(&cpufreq_cdev->qos_req,
> -				cpufreq_cdev->freq_table[state].frequency);
> +	ret = dev_pm_qos_update_request
> +				(&cpufreq_cdev->qos_req,
> +				 cpufreq_cdev->freq_table[state].frequency);
> +
> +	if (ret > 0)
> +		update_sched_max_capacity
> +				(cpufreq_cdev->policy->cpus,
> +				 cpufreq_cdev->freq_table[state].frequency,
> +				 cpufreq_cdev->policy->cpuinfo.max_freq);

Codingstyle wants that in { }.

> +
> +	return ret;
>  }
>  
>  /**
> -- 
> 2.1.4
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ