From: Chen Yu <yu.c.chen@intel.com>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Len Brown <lenb@kernel.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
Zhang Rui <rui.zhang@intel.com>,
Wendy Wang <wendy.wang@intel.com>, Chen Yu <yu.c.chen@intel.com>
Subject: [PATCH 2/2][v2] cpufreq: intel_pstate: Get percpu max freq via HWP MSR register if available
Date: Mon, 11 Jan 2021 15:43:42 +0800 [thread overview]
Message-ID: <0ca097c7bbf58415b1df150ea50cb37579f8f8ab.1610338353.git.yu.c.chen@intel.com> (raw)
In-Reply-To: <cover.1610338353.git.yu.c.chen@intel.com>
Currently when turbo is disabled(either by BIOS or by the user), the intel_pstate
driver reads the max frequency from the package-wide MSR_PLATFORM_INFO(0xce) register.
However on asymmetric platforms it is possible in theory that small and big core with
HWP enabled might have different max cpu frequency, because the MSR_HWP_CAPABILITIES
is percpu scope according to Intel Software Developer Manual.
The turbo max freq is already percpu basis in current code, thus make similar change
to the max non-turbo frequency as well.
Reported-by: Wendy Wang <wendy.wang@intel.com>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
---
v2: per Srinivas' suggestion, avoid duplicated assignment of max_pstate.
--
drivers/cpufreq/intel_pstate.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index bd3dd1be73ba..f2d18991d969 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1725,11 +1725,9 @@ static void intel_pstate_max_within_limits(struct cpudata *cpu)
static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
{
cpu->pstate.min_pstate = pstate_funcs.get_min();
- cpu->pstate.max_pstate = pstate_funcs.get_max();
cpu->pstate.max_pstate_physical = pstate_funcs.get_max_physical();
cpu->pstate.turbo_pstate = pstate_funcs.get_turbo();
cpu->pstate.scaling = pstate_funcs.get_scaling();
- cpu->pstate.max_freq = cpu->pstate.max_pstate * cpu->pstate.scaling;
if (hwp_active && !hwp_mode_bdw) {
unsigned int phy_max, current_max, guar_state;
@@ -1737,8 +1735,12 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
intel_pstate_get_hwp_max(cpu, &phy_max, ¤t_max, &guar_state);
cpu->pstate.turbo_freq = phy_max * cpu->pstate.scaling;
cpu->pstate.turbo_pstate = phy_max;
+ cpu->pstate.max_pstate = guar_state;
+ cpu->pstate.max_freq = guar_state * cpu->pstate.scaling;
} else {
cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * cpu->pstate.scaling;
+ cpu->pstate.max_pstate = pstate_funcs.get_max();
+ cpu->pstate.max_freq = cpu->pstate.max_pstate * cpu->pstate.scaling;
}
if (pstate_funcs.get_aperf_mperf_shift)
--
2.17.1
next prev parent reply other threads:[~2021-01-11 7:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-11 7:43 [PATCH 0/2][v2] Get percpu max freq via HWP MSR register Chen Yu
2021-01-11 7:43 ` [PATCH 1/2][v2] cpufreq: intel_pstate: Add parameter to get guarantee frequency Chen Yu
2021-01-11 12:44 ` Rafael J. Wysocki
2021-01-12 3:29 ` Chen Yu
2021-01-11 7:43 ` Chen Yu [this message]
2021-01-11 11:11 ` [PATCH 2/2][v2] cpufreq: intel_pstate: Get percpu max freq via HWP MSR register if available Srinivas Pandruvada
2021-01-12 3:28 ` Chen Yu
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=0ca097c7bbf58415b1df150ea50cb37579f8f8ab.1610338353.git.yu.c.chen@intel.com \
--to=yu.c.chen@intel.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=rui.zhang@intel.com \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=viresh.kumar@linaro.org \
--cc=wendy.wang@intel.com \
/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).