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: <20191223175458.GC31446@arm.com>
Date:   Mon, 23 Dec 2019 17:54:58 +0000
From:   Ionela Voinescu <ionela.voinescu@....com>
To:     Thara Gopinath <thara.gopinath@...aro.org>
Cc:     mingo@...hat.com, peterz@...radead.org, vincent.guittot@...aro.org,
        rui.zhang@...el.com, qperret@...gle.com, daniel.lezcano@...aro.org,
        viresh.kumar@...aro.org, linux-kernel@...r.kernel.org,
        amit.kachhap@...il.com, javi.merino@...nel.org,
        amit.kucheria@...durent.com
Subject: Re: [Patch v6 6/7] thermal/cpu-cooling: Update thermal pressure in
 case of a maximum frequency capping

On Wednesday 11 Dec 2019 at 23:11:47 (-0500), Thara Gopinath wrote:
[...]
> @@ -430,6 +430,10 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
>  				 unsigned long state)
>  {
>  	struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
> +	struct cpumask *cpus;
> +	unsigned int frequency;
> +	unsigned long capacity;
> +	int ret;
>  
>  	/* Request state should be less than max_level */
>  	if (WARN_ON(state > cpufreq_cdev->max_level))
> @@ -441,8 +445,19 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
>  
>  	cpufreq_cdev->cpufreq_state = state;
>  
> -	return freq_qos_update_request(&cpufreq_cdev->qos_req,
> -				get_state_freq(cpufreq_cdev, state));
> +	frequency = get_state_freq(cpufreq_cdev, state);
> +
> +	ret = freq_qos_update_request(&cpufreq_cdev->qos_req, frequency);
> +
> +	if (ret > 0) {
> +		cpus = cpufreq_cdev->policy->cpus;
> +		capacity = frequency *
> +				arch_scale_cpu_capacity(cpumask_first(cpus));
> +		capacity /= cpufreq_cdev->policy->cpuinfo.max_freq;
> +		arch_set_thermal_pressure(cpus, capacity);

Given that you already get a CPU's capacity (orig) here, why don't
you pass thermal pressure directly to arch_set_thermal_pressure,
rather than passing the capped capacity and subtracting it later from
the same CPU capacity (arch_scale_cpu_capacity)?

If my math is correct this would work nicely:
                pressure = cpufreq_cdev->policy->cpuinfo.max_freq;
		pressure -= frequency;
		pressure *= arch_scale_cpu_capacity(cpumask_first(cpus);
		pressure /= cpufreq_cdev->policy->cpuinfo.max_freq;

Thanks,
Ionela.

> +	}
> +
> +	return ret;
>  }
>  
>  /* Bind cpufreq callbacks to thermal cooling device ops */
> -- 
> 2.1.4
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ