]> git.baikalelectronics.ru Git - kernel.git/commit
cpufreq: intel_pstate: Avoid missing HWP max updates in passive mode
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 23 Oct 2020 15:35:32 +0000 (17:35 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 27 Oct 2020 17:53:35 +0000 (18:53 +0100)
commita05faded393a0589cc3b9debf7b49947cb109a7f
tree9a504b819de68d464cb62c1529eef15e7510946c
parentf162e73496f25ca781e2405c84c6c0133e071609
cpufreq: intel_pstate: Avoid missing HWP max updates in passive mode

If the cpufreq policy max limit is changed when intel_pstate operates
in the passive mode with HWP enabled and the "powersave" governor is
used on top of it, the HWP max limit is not updated as appropriate.

Namely, in the "powersave" governor case, the target P-state
is always equal to the policy min limit, so if the latter does
not change, intel_cpufreq_adjust_hwp() is not invoked to update
the HWP Request MSR due to the "target_pstate != old_pstate" check
in intel_cpufreq_update_pstate(), so the HWP max limit is not
updated as a result.

Also, if the CPUFREQ_NEED_UPDATE_LIMITS flag is not set for the
driver and the target frequency does not change along with the
policy max limit, the "target_freq == policy->cur" check in
__cpufreq_driver_target() prevents the driver's ->target() callback
from being invoked at all, so the HWP max limit is not updated.

To prevent that occurring, set the CPUFREQ_NEED_UPDATE_LIMITS flag
in the intel_cpufreq driver structure if HWP is enabled and modify
intel_cpufreq_update_pstate() to do the "target_pstate != old_pstate"
check only in the non-HWP case and let intel_cpufreq_adjust_hwp()
always run in the HWP case (it will update HWP Request only if the
cached value of the register is different from the new one including
the limits, so if neither the target P-state value nor the max limit
changes, the register write will still be avoided).

Fixes: e43b6ae4dc34 ("cpufreq: intel_pstate: Implement passive mode with HWP enabled")
Reported-by: Zhang Rui <rui.zhang@intel.com>
Cc: 5.9+ <stable@vger.kernel.org> # 5.9+: f162e73496f2 cpufreq: Introduce CPUFREQ_NEED_UPDATE_LIMITS ...
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Zhang Rui <rui.zhang@intel.com>
drivers/cpufreq/intel_pstate.c