thermal: intel: powerclamp: Add two module parameters
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Tue, 7 Feb 2023 17:35:34 +0000 (09:35 -0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 9 Feb 2023 20:01:06 +0000 (21:01 +0100)
commitebf519710218814cf827adbf9111af081344c969
tree0fad93cce49a734970db39898bcb93601a81c655
parent707bf8e1dfd51dd0cafe92da24f5276702edebe5
thermal: intel: powerclamp: Add two module parameters

In some use cases, it is desirable to only inject idle on certain set
of CPUs. For example on Alder Lake systems, it is possible that we force
idle only on P-Cores for thermal reasons. Also the idle percent can be
more than 50% if we only choose partial set of CPUs in the system.

Introduce 2 new module parameters for this purpose. They can be only
changed when the cooling device is inactive.

cpumask (Read/Write): A bit mask of CPUs to inject idle. The format of
this bitmask is same as used in other subsystems like in
/proc/irq/*/smp_affinity. The mask is comma separated 32 bit groups.
Each CPU is one bit. For example for 256 CPU system the full mask is:
ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff
The rightmost mask is for CPU 0-32.

max_idle (Read/Write): Maximum injected idle time to the total CPU time
ratio in percent range from 1 to 100. Even if the cooling device max_state
is always 100 (100%), this parameter allows to add a max idle percent
limit. The default is 50, to match the current implementation of powerclamp
driver. Also doesn't allow value more than 75, if the cpumask includes
every CPU present in the system.

Also when the cpumask doesn't include every CPU, there is no use of
compensation using package C-state idle counters. Hence don't start
package C-state polling thread even for a single package or a single die
system in this case.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Documentation/admin-guide/thermal/intel_powerclamp.rst
drivers/thermal/intel/intel_powerclamp.c