Re: [PATCH] cpufreq: intel_pstate: Fix HWP on boot CPU after system resume

From: Viresh Kumar
Date: Sun May 01 2016 - 22:13:11 EST

On 02-05-16, 02:27, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> Commit 41cfd64cf49fc "Update frequencies of policy->cpus only from
> ->set_policy()" changed the way the intel_pstate driver's ->set_policy
> callback updates the HWP (hardware-managed P-states) settings.
> A side effect of it is that if those settings are modified on the
> boot CPU during system suspend and wakeup, they will never be
> restored during subsequent system resume.
> To address this problem, allow cpufreq drivers that don't provide
> ->target or ->target_index callbacks to use ->suspend and ->resume
> callbacks and add a ->resume callback to intel_pstate to restore
> the HWP settings on the CPUs that belong to the given policy.
> Fixes: 41cfd64cf49fc "Update frequencies of policy->cpus only from ->set_policy()"
> Tested-by: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> ---
> Note: We've tried to address that issue by adding syscore_ops to
> intel_pstate and restoring the boot CPU's HWP setting from a
> syscore resume, but that turns out to be too early (apparently,
> the processor is not ready for that at that point).
> ---
> drivers/cpufreq/cpufreq.c | 28 ++++++++++++++++------------
> drivers/cpufreq/intel_pstate.c | 12 ++++++++++--
> 2 files changed, 26 insertions(+), 14 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>