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:   Mon, 25 Mar 2019 13:04:41 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
Cc:     "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Len Brown <lenb@...nel.org>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        Prashanth Prakash <pprakash@...eaurora.org>,
        Xiongfeng Wang <wangxiongfeng2@...wei.com>,
        "4 . 20+" <stable@...r.kernel.org>
Subject: Re: [PATCH 2/2] cpufreq: intel_pstate: Also use cppc nominal_perf for base_frequency

On Fri, Mar 22, 2019 at 11:45 PM Srinivas Pandruvada
<srinivas.pandruvada@...ux.intel.com> wrote:
>
> ACPI specifications stat that if the "Guaranteed Performance Register" is
> not implemented, OSPM assumes guaranteed performance is always equal to
> nominal performance. So for invalid and unimplemented guaranteed
> performance register, use nominal performance as guaranteed performance.
>
> This change will fallback to nominal_perf when guranteed_perf is invalid.
> If nominal_perf is also invalid, then fallback to existing implementation,
> which is to read from HWP Capabilities MSR.
>
> Fixes: 86d333a8cc7f ("cpufreq: intel_pstate: Add base_frequency attribute")
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
> Cc: 4.20+ <stable@...r.kernel.org> # 4.20+
> ---
>  drivers/cpufreq/intel_pstate.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 7b4b0a7ac68b..e16dea241c55 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -385,6 +385,9 @@ static int intel_pstate_get_cppc_guranteed(int cpu)
>         if (ret)
>                 return ret;
>
> +       if (!cppc_perf.guaranteed_perf)
> +               return cppc_perf.nominal_perf;
> +
>         return cppc_perf.guaranteed_perf;
>  }

I would do this the other way around, that is

if (cppc_perf.guaranteed_perf)
        return cppc_perf.guaranteed_perf;

return cppc_perf.nominal_perf;

That is slightly easier to follow IMO.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ