* [PATCH][v3] cpufreq: intel_pstate: Get percpu max freq via HWP MSR register if available
@ 2021-01-12 5:21 Chen Yu
2021-01-12 13:52 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Chen Yu @ 2021-01-12 5:21 UTC (permalink / raw)
To: Srinivas Pandruvada, Rafael J. Wysocki
Cc: Len Brown, Viresh Kumar, linux-pm, linux-kernel, Chen Yu
Currently when turbo is disabled(either by BIOS or by the user), the
intel_pstate driver reads the max non-turbo 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 non-turbo 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.
v3: Per Rafael's suggestion, do not add new argument in intel_pstate_get_hwp_max()
to avoid redundant local vars.
Per Srinivas' suggestion, refined the commit log to reflect the 'non-turbo'
max frequency.
--
drivers/cpufreq/intel_pstate.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index eaf32ef7a030..99e180f644c3 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1724,11 +1724,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;
@@ -1736,9 +1734,12 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
intel_pstate_get_hwp_max(cpu, &phy_max, ¤t_max);
cpu->pstate.turbo_freq = phy_max * cpu->pstate.scaling;
cpu->pstate.turbo_pstate = phy_max;
+ cpu->pstate.max_pstate = HWP_GUARANTEED_PERF(READ_ONCE(cpu->hwp_cap_cached));
} 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)
cpu->aperf_mperf_shift = pstate_funcs.get_aperf_mperf_shift();
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH][v3] cpufreq: intel_pstate: Get percpu max freq via HWP MSR register if available
2021-01-12 5:21 [PATCH][v3] cpufreq: intel_pstate: Get percpu max freq via HWP MSR register if available Chen Yu
@ 2021-01-12 13:52 ` Rafael J. Wysocki
2021-01-12 15:03 ` Chen Yu
0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2021-01-12 13:52 UTC (permalink / raw)
To: Chen Yu
Cc: Srinivas Pandruvada, Rafael J. Wysocki, Len Brown, Viresh Kumar,
Linux PM, Linux Kernel Mailing List
On Tue, Jan 12, 2021 at 6:19 AM Chen Yu <yu.c.chen@intel.com> wrote:
>
> Currently when turbo is disabled(either by BIOS or by the user), the
> intel_pstate driver reads the max non-turbo 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 non-turbo 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.
> v3: Per Rafael's suggestion, do not add new argument in intel_pstate_get_hwp_max()
> to avoid redundant local vars.
> Per Srinivas' suggestion, refined the commit log to reflect the 'non-turbo'
> max frequency.
Looks good now, thanks!
Is it needed in -stable and if so, which -stable series should it go into?
> --
> drivers/cpufreq/intel_pstate.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index eaf32ef7a030..99e180f644c3 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -1724,11 +1724,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;
> @@ -1736,9 +1734,12 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
> intel_pstate_get_hwp_max(cpu, &phy_max, ¤t_max);
> cpu->pstate.turbo_freq = phy_max * cpu->pstate.scaling;
> cpu->pstate.turbo_pstate = phy_max;
> + cpu->pstate.max_pstate = HWP_GUARANTEED_PERF(READ_ONCE(cpu->hwp_cap_cached));
> } 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)
> cpu->aperf_mperf_shift = pstate_funcs.get_aperf_mperf_shift();
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][v3] cpufreq: intel_pstate: Get percpu max freq via HWP MSR register if available
2021-01-12 13:52 ` Rafael J. Wysocki
@ 2021-01-12 15:03 ` Chen Yu
2021-01-12 18:46 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Chen Yu @ 2021-01-12 15:03 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Srinivas Pandruvada, Rafael J. Wysocki, Len Brown, Viresh Kumar,
Linux PM, Linux Kernel Mailing List
On Tue, Jan 12, 2021 at 02:52:50PM +0100, Rafael J. Wysocki wrote:
> On Tue, Jan 12, 2021 at 6:19 AM Chen Yu <yu.c.chen@intel.com> wrote:
> >
> > Currently when turbo is disabled(either by BIOS or by the user), the
> > intel_pstate driver reads the max non-turbo 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 non-turbo 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.
> > v3: Per Rafael's suggestion, do not add new argument in intel_pstate_get_hwp_max()
> > to avoid redundant local vars.
> > Per Srinivas' suggestion, refined the commit log to reflect the 'non-turbo'
> > max frequency.
>
> Looks good now, thanks!
>
> Is it needed in -stable and if so, which -stable series should it go into?
>
Yes, I think so, it should be
Cc: stable@vger.kernel.org # 4.18+
as the HWP reading turbo frequency was firstly introduced in v4.18-rc2 and it
was easier to be applied.
BTW, this patch is on top of your previous patch set on intel_pstate clean up:
https://patchwork.kernel.org/project/linux-pm/list/?series=410797
thanks,
Chenyu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][v3] cpufreq: intel_pstate: Get percpu max freq via HWP MSR register if available
2021-01-12 15:03 ` Chen Yu
@ 2021-01-12 18:46 ` Rafael J. Wysocki
0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2021-01-12 18:46 UTC (permalink / raw)
To: Chen Yu
Cc: Rafael J. Wysocki, Srinivas Pandruvada, Rafael J. Wysocki,
Len Brown, Viresh Kumar, Linux PM, Linux Kernel Mailing List
On Tue, Jan 12, 2021 at 4:00 PM Chen Yu <yu.c.chen@intel.com> wrote:
>
> On Tue, Jan 12, 2021 at 02:52:50PM +0100, Rafael J. Wysocki wrote:
> > On Tue, Jan 12, 2021 at 6:19 AM Chen Yu <yu.c.chen@intel.com> wrote:
> > >
> > > Currently when turbo is disabled(either by BIOS or by the user), the
> > > intel_pstate driver reads the max non-turbo 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 non-turbo 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.
> > > v3: Per Rafael's suggestion, do not add new argument in intel_pstate_get_hwp_max()
> > > to avoid redundant local vars.
> > > Per Srinivas' suggestion, refined the commit log to reflect the 'non-turbo'
> > > max frequency.
> >
> > Looks good now, thanks!
> >
> > Is it needed in -stable and if so, which -stable series should it go into?
> >
> Yes, I think so, it should be
> Cc: stable@vger.kernel.org # 4.18+
> as the HWP reading turbo frequency was firstly introduced in v4.18-rc2 and it
> was easier to be applied.
> BTW, this patch is on top of your previous patch set on intel_pstate clean up:
> https://patchwork.kernel.org/project/linux-pm/list/?series=410797
OK, applied (with a few minor edits in the subject and changelog) as
5.12 material along with those patches , thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-01-12 18:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12 5:21 [PATCH][v3] cpufreq: intel_pstate: Get percpu max freq via HWP MSR register if available Chen Yu
2021-01-12 13:52 ` Rafael J. Wysocki
2021-01-12 15:03 ` Chen Yu
2021-01-12 18:46 ` Rafael J. Wysocki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.