]> git.baikalelectronics.ru Git - kernel.git/commit
cpufreq: intel_pstate: Free memory only when turning off
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 1 Sep 2020 16:33:41 +0000 (18:33 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 1 Sep 2020 19:14:52 +0000 (21:14 +0200)
commit3bf92c1207458f88ad31c522d70b721d7d2a521c
tree6ee954f462af2d48876aefee7e2eacbda84afe0b
parent9dc2f19889b175111990d11b9b302c38d8ab8e71
cpufreq: intel_pstate: Free memory only when turning off

When intel_pstate switches the operation mode from "active" to
"passive" or the other way around, freeing its data structures
representing CPUs and allocating them again from scratch is not
necessary and wasteful.  Moreover, if these data structures are
preserved, the cached HWP Request MSR value from there may be
written to the MSR to start with to reinitialize it and help to
restore the EPP value set previously (it is set to 0xFF when CPUs
go offline to allow their SMT siblings to use the full range of
EPP values and that also happens when the driver gets unregistered).

Accordingly, modify the driver to only do a full cleanup on driver
object registration errors and when its status is changed to "off"
via sysfs and to write the cached HWP Request MSR value back to
the MSR on CPU init if the data structure representing the given
CPU is still there.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
drivers/cpufreq/intel_pstate.c