public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux PM <linux-pm@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] cpufreq: intel_pstate: Use HWP capabilities in intel_cpufreq_adjust_perf()
Date: Tue, 05 Jan 2021 22:59:43 -0800	[thread overview]
Message-ID: <a232f29236ae1cc6ecd90495a2dc1c38c1488a04.camel@linux.intel.com> (raw)
In-Reply-To: <1784464.uM0JrOW1fs@kreacher>

On Tue, 2021-01-05 at 19:20 +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> If turbo P-states cannot be used, either due to the configuration of
> the processor, or because intel_pstate is not allowed to used them,
> the maximum available P-state with HWP enabled corresponds to the
> HWP_CAP.GUARANTEED value which is not static.  It can be adjusted by
> an out-of-band agent or during an Intel Speed Select performance
> level change, so long as it remains less than or equal to
> HWP_CAP.MAX.
> 
> However, if turbo P-states cannot be used,
> intel_cpufreq_adjust_perf()
> always uses pstate.max_pstate (set during the initialization of the
> driver only) as the maximum available P-state, so it may miss a
> change
> of the HWP_CAP.GUARANTEED value.
> 
> Prevent that from happening by modifyig intel_cpufreq_adjust_perf()
> to always read the "guaranteed" and "maximum turbo" performance
> levels from the cached HWP_CAP value.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

> ---
>  drivers/cpufreq/intel_pstate.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> Index: linux-pm/drivers/cpufreq/intel_pstate.c
> ===================================================================
> --- linux-pm.orig/drivers/cpufreq/intel_pstate.c
> +++ linux-pm/drivers/cpufreq/intel_pstate.c
> @@ -2653,12 +2653,13 @@ static void intel_cpufreq_adjust_perf(un
>                                       unsigned long capacity)
>  {
>         struct cpudata *cpu = all_cpu_data[cpunum];
> +       u64 hwp_cap = READ_ONCE(cpu->hwp_cap_cached);
>         int old_pstate = cpu->pstate.current_pstate;
>         int cap_pstate, min_pstate, max_pstate, target_pstate;
>  
>         update_turbo_state();
> -       cap_pstate = global.turbo_disabled ? cpu->pstate.max_pstate :
> -                                            cpu-
> >pstate.turbo_pstate;
> +       cap_pstate = global.turbo_disabled ?
> HWP_GUARANTEED_PERF(hwp_cap) :
> +                                           
> HWP_HIGHEST_PERF(hwp_cap);
>  
>         /* Optimization: Avoid unnecessary divisions. */
>  
> 
> 
> 



      reply	other threads:[~2021-01-06  7:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05 18:20 [PATCH] cpufreq: intel_pstate: Use HWP capabilities in intel_cpufreq_adjust_perf() Rafael J. Wysocki
2021-01-06  6:59 ` Srinivas Pandruvada [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a232f29236ae1cc6ecd90495a2dc1c38c1488a04.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox