Skip to content

Commit

Permalink
cpufreq: intel_pstate: Refuse to turn off with HWP enabled
Browse files Browse the repository at this point in the history
After commit f6ebbcf ("cpufreq: intel_pstate: Implement passive
mode with HWP enabled") it is possible to change the driver status
to "off" via sysfs with HWP enabled, which effectively causes the
driver to unregister itself, but HWP remains active and it forces the
minimum performance, so even if another cpufreq driver is loaded,
it will not be able to control the CPU frequency.

For this reason, make the driver refuse to change the status to
"off" with HWP enabled.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
  • Loading branch information
Rafael J. Wysocki committed Sep 1, 2020
1 parent f75aef3 commit 43298db
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/cpufreq/intel_pstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2716,9 +2716,15 @@ static int intel_pstate_update_status(const char *buf, size_t size)
{
int ret;

if (size == 3 && !strncmp(buf, "off", size))
return intel_pstate_driver ?
intel_pstate_unregister_driver() : -EINVAL;
if (size == 3 && !strncmp(buf, "off", size)) {
if (!intel_pstate_driver)
return -EINVAL;

if (hwp_active)
return -EBUSY;

return intel_pstate_unregister_driver();
}

if (size == 6 && !strncmp(buf, "active", size)) {
if (intel_pstate_driver) {
Expand Down

0 comments on commit 43298db

Please sign in to comment.