linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] cpufreq: intel_pstate: Fix cpuinfo_max_freq when MSR_TURBO_RATIO_LIMIT is 0
Date: Tue, 4 Aug 2020 12:52:41 +0200	[thread overview]
Message-ID: <CAJZ5v0iaWFsD=A=sRdVGDOm6QkT==_4C0qCQ=A4iFYvjVbuyLg@mail.gmail.com> (raw)
In-Reply-To: <20200803183720.13082-1-srinivas.pandruvada@linux.intel.com>

On Mon, Aug 3, 2020 at 8:37 PM Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
>
> The MSR_TURBO_RATIO_LIMIT can be 0. This is not an error. User can update
> this MSR via BIOS settings on some systems or can use msr tools to update.
> Also some systems boot with value = 0.
>
> This results in display of cpufreq/cpuinfo_max_freq wrong. This value
> will be equal to cpufreq/base_frequency, even though turbo is enabled.
>
> But platform will still function normally in HWP mode as we get max
> 1-core frequency from the MSR_HWP_CAPABILITIES. This MSR is already used
> to calculate cpu->pstate.turbo_freq, which is used for to set
> policy->cpuinfo.max_freq. But some other places cpu->pstate.turbo_pstate
> is used. For example to set policy->max.
>
> To fix this, also update cpu->pstate.turbo_pstate when updating
> cpu->pstate.turbo_freq.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

Applied as a fix for 5.9-rc1, thanks!

> ---
>  drivers/cpufreq/intel_pstate.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 7e0f7880b21a..c7540ad28995 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -1572,6 +1572,7 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
>
>                 intel_pstate_get_hwp_max(cpu->cpu, &phy_max, &current_max);
>                 cpu->pstate.turbo_freq = phy_max * cpu->pstate.scaling;
> +               cpu->pstate.turbo_pstate = phy_max;
>         } else {
>                 cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * cpu->pstate.scaling;
>         }
> --
> 2.17.1
>

      reply	other threads:[~2020-08-04 10:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03 18:37 [PATCH] cpufreq: intel_pstate: Fix cpuinfo_max_freq when MSR_TURBO_RATIO_LIMIT is 0 Srinivas Pandruvada
2020-08-04 10:52 ` Rafael J. Wysocki [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='CAJZ5v0iaWFsD=A=sRdVGDOm6QkT==_4C0qCQ=A4iFYvjVbuyLg@mail.gmail.com' \
    --to=rafael@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=viresh.kumar@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).