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]
Date:   Thu, 17 Dec 2020 14:58:45 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
Cc:     Len Brown <lenb@...nel.org>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] cpufreq: intel_pstate: Use the latest guaranteed freq
 during verify

On Thu, Dec 17, 2020 at 11:44 AM Srinivas Pandruvada
<srinivas.pandruvada@...ux.intel.com> wrote:
>
> This change tries to address an issue, when BIOS disabled turbo
> but HWP_CAP guaranteed is changed later and user space wants to take
> advantage of this increased guaranteed performance.
>
> The HWP_CAP.GUARANTEED value is not a static value. It can be changed
> by some out of band agent or during Intel Speed Select performance
> level change. The HWP_CAP.MAX still shows max possible performance when
> BIOS disabled turbo. So guaranteed can still change as long as this is
> same or below HWP_CAP.MAX.
>
> When guaranteed is changed, the sysfs base_frequency attributes shows
> the latest guaranteed frequency. This attribute can be used by user
> space software to update scaling min/max frequency.
>
> Currently the setpolicy callback already uses the latest HWP_CAP
> values when setting HWP_REQ. But the verify callback will still restrict
> the user settings to the to old guaranteed value. So if the guaranteed
> is increased, user space can't take advantage of it.
>
> To solve this similar to setpolicy callback, read the latest HWP_CAP
> values and use it to restrict the maximum setting. This is done by
> calling intel_pstate_get_hwp_max(), which already accounts for user
> and BIOS turbo disable to get the current max performance.
>
> This issue is side effect of fixing the issue of scaling frequency
> limits by the
>  'commit eacc9c5a927e ("cpufreq: intel_pstate:
>  Fix intel_pstate_get_hwp_max() for turbo disabled")'
> The fix resulted in correct setting of reduced scaling frequencies,
> but this resulted in capping HWP.REQ to HWP_CAP.GUARANTEED in this case.
>
> Cc: 5.8+ <stable@...r.kernel.org> # 5.8+
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
> ---
>  drivers/cpufreq/intel_pstate.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 2a4db856222f..7081d1edb22b 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -2199,6 +2199,12 @@ static void intel_pstate_clear_update_util_hook(unsigned int cpu)
>
>  static int intel_pstate_get_max_freq(struct cpudata *cpu)
>  {
> +       if (hwp_active) {
> +               int turbo_max, max_state;
> +
> +               intel_pstate_get_hwp_max(cpu->cpu, &turbo_max, &max_state);

This would cause intel_pstate_get_hwp_max() to be called twice in
intel_pstate_update_perf_limits() which is not perfect.

> +               return max_state * cpu->pstate.scaling;
> +       }
>         return global.turbo_disabled || global.no_turbo ?
>                         cpu->pstate.max_freq : cpu->pstate.turbo_freq;
>  }
> --

Powered by blists - more mailing lists