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]
Date:   Thu, 10 Feb 2022 10:57:14 +0530
From:   Viresh Kumar <viresh.kumar@...aro.org>
To:     Pierre Gondois <Pierre.Gondois@....com>
Cc:     linux-kernel@...r.kernel.org, Ionela.Voinescu@....com,
        Lukasz.Luba@....com, Morten.Rasmussen@....com,
        "Rafael J. Wysocki" <rafael@...nel.org>, linux-pm@...r.kernel.org
Subject: Re: [PATCH v3] cpufreq: CPPC: Fix performance/frequency conversion

On 08-02-22, 09:01, Pierre Gondois wrote:
> CPUfreq governors request CPU frequencies using information
> on current CPU usage. The CPPC driver converts them to
> performance requests. Frequency targets are computed as:
> 	target_freq = (util / cpu_capacity) * max_freq
> target_freq is then clamped between [policy->min, policy->max].
> 
> The CPPC driver converts performance values to frequencies
> (and vice-versa) using cppc_cpufreq_perf_to_khz() and
> cppc_cpufreq_khz_to_perf(). These functions both use two different
> factors depending on the range of the input value. For
> cppc_cpufreq_khz_to_perf():
> - (NOMINAL_PERF / NOMINAL_FREQ) or
> - (LOWEST_PERF / LOWEST_FREQ)
> and for cppc_cpufreq_perf_to_khz():
> - (NOMINAL_FREQ / NOMINAL_PERF) or
> - ((NOMINAL_PERF - LOWEST_FREQ) / (NOMINAL_PERF - LOWEST_PERF))
> 
> This means:
> 1- the functions are not inverse for some values:
>    (perf_to_khz(khz_to_perf(x)) != x)
> 2- cppc_cpufreq_perf_to_khz(LOWEST_PERF) can sometimes give
>    a different value from LOWEST_FREQ due to integer approximation
> 3- it is implied that performance and frequency are proportional
>    (NOMINAL_FREQ / NOMINAL_PERF) == (LOWEST_PERF / LOWEST_FREQ)
> 
> This patch changes the conversion functions to an affine function.
> This fixes the 3 points above.
> 
> Suggested-by: Lukasz Luba <lukasz.luba@....com>
> Suggested-by: Morten Rasmussen <morten.rasmussen@....com>
> Signed-off-by: Pierre Gondois <Pierre.Gondois@....com>
> ---
>  drivers/cpufreq/cppc_cpufreq.c | 43 +++++++++++++++++-----------------
>  1 file changed, 21 insertions(+), 22 deletions(-)

Applied. Thanks.

-- 
viresh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ