Skip to contentSkip to conversation

intel_powerclamp: New module parameter

PATCH In review Srinivas Pandruvada 2 participants 4 messages Feb 7, 2023 – Feb 8, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover intel_powerclamp: New module parameter

Split from the series for powerclamp user of powercap idle-inject series:
Use idle_inject framework for intel_powerclamp version v5.

v3:
minor document change

v2
- Build warnings reported by Rui
- Moved the powerclamp documentation to admin guide folder
- Commit log updated as suggested by Rafael and other code suggestion

Srinivas Pandruvada (2):
Documentation:admin-guide: Move intel_powerclamp documentation thermal/drivers/intel_powerclamp: Add two module parameters

 Documentation/admin-guide/index.rst           |   1 +
 .../thermal/intel_powerclamp.rst              |  22 +++
 Documentation/driver-api/thermal/index.rst    |   1 -
 MAINTAINERS                                   |   1 +
 drivers/thermal/intel/intel_powerclamp.c      | 177 +++++++++++++++---
 5 files changed, 180 insertions(+), 22 deletions(-)
 rename Documentation/{driver-api => admin-guide}/thermal/intel_powerclamp.rst (93%)
Signature · 1 line
2.39.1
#1 lore raw

PATCH v3 1/2 Documentation:admin-guide: Move intel_powerclamp documentation

Create a folder "thermal" under Documentation/admin-guide and move intel_powerclamp documentation to this folder.

---
v3:
No change

 Documentation/admin-guide/index.rst                              | 1 +
 .../{driver-api => admin-guide}/thermal/intel_powerclamp.rst     | 0
 Documentation/driver-api/thermal/index.rst                       | 1 -
 MAINTAINERS                                                      | 1 +
 4 files changed, 2 insertions(+), 1 deletion(-)
 rename Documentation/{driver-api => admin-guide}/thermal/intel_powerclamp.rst (100%)
Documentation/admin-guide/index.rst +1 -0
index 5bfafcbb9562..c872a8a1ddfa 100644
@@ -116,6 +116,7 @@ configure specific aspects of kernel behavior to your liking.
    svga
    syscall-user-dispatch
    sysrq
+   thermal
    thunderbolt
    ufs
    unicode
Documentation/admin-guide/thermal/intel_powerclamp.rst renamed from Documentation/driver-api/thermal/intel_powerclamp.rst +0 -0
similarity index 100%
rename from Documentation/driver-api/thermal/intel_powerclamp.rst
rename to Documentation/admin-guide/thermal/intel_powerclamp.rst
Documentation/driver-api/thermal/index.rst +0 -1
index 030306ffa408..a886028014ab 100644
@@ -14,7 +14,6 @@ Thermal
 
    exynos_thermal
    exynos_thermal_emulation
-   intel_powerclamp
    nouveau_thermal
    x86_pkg_temperature_thermal
    intel_dptf
MAINTAINERS +1 -0
index b4043f72dfac..28fd62eacaf3 100644
@@ -20714,6 +20714,7 @@ S:	Supported
 Q:	https://patchwork.kernel.org/project/linux-pm/list/
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git thermal
 F:	Documentation/ABI/testing/sysfs-class-thermal
+F:	Documentation/admin-guide/thermal/
 F:	Documentation/devicetree/bindings/thermal/
 F:	Documentation/driver-api/thermal/
 F:	drivers/thermal/
Signature · 1 line
2.39.1
#2 lore raw

PATCH v3 2/2 thermal/drivers/intel_powerclamp: Add two module parameters

In reply to Srinivas Pandruvada

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 leftmost 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.

---
v3:
One word document change from leftmost to rightmost

v2:
Addressed comments from v5 series from Rafael
Build issue reported by Rui

 .../admin-guide/thermal/intel_powerclamp.rst  |  22 +++
 drivers/thermal/intel/intel_powerclamp.c      | 177 +++++++++++++++---
 2 files changed, 178 insertions(+), 21 deletions(-)
Documentation/admin-guide/thermal/intel_powerclamp.rst +22 -0
index 3f6dfb0b3ea6..2d9d2d739f02 100644
@@ -26,6 +26,8 @@ By:
 	    - Generic Thermal Layer (sysfs)
 	    - Kernel APIs (TBD)
 
+	(*) Module Parameters
+
 INTRODUCTION
 ============
 
@@ -318,3 +320,23 @@ device, a PID based userspace thermal controller can manage to
 control CPU temperature effectively, when no other thermal influence
 is added. For example, a UltraBook user can compile the kernel under
 certain temperature (below most active trip points).
+
+Module Parameters
+=================
+
+``cpumask`` (RW)
+	A bit mask of CPUs to inject idle. The format of the 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 a 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`` (RW)
+	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.
drivers/thermal/intel/intel_powerclamp.c +156 -21

222 lines not on this page · raw message

Signature · 1 line
2.39.1
reviewer Tested-by on the v3 series
#3 lore raw
In reply to Srinivas Pandruvada
Quoted 7 lines · Srinivas Pandruvada

Split from the series for powerclamp user of powercap idle-inject series:
Use idle_inject framework for intel_powerclamp version v5.

v3:
minor document change

I have tested the V2 version of this patch series + the whole series of Richardo's scheduler fixes from
https://lore.kernel.org/lkml/[email protected]/

The previous scheduler problem is gone and idle injection with a cpumask works well.

Give that we only have document change in V3,

thanks,
rui

Quoted 20 lines

v2
- Build warnings reported by Rui
- Moved the powerclamp documentation to admin guide folder
- Commit log updated as suggested by Rafael and other code suggestion

Srinivas Pandruvada (2):
Documentation:admin-guide: Move intel_powerclamp documentation thermal/drivers/intel_powerclamp: Add two module parameters

 Documentation/admin-guide/index.rst           |   1 +
 .../thermal/intel_powerclamp.rst              |  22 +++
 Documentation/driver-api/thermal/index.rst    |   1 -
 MAINTAINERS                                   |   1 +
 drivers/thermal/intel/intel_powerclamp.c      | 177 +++++++++++++++-
--
 5 files changed, 180 insertions(+), 22 deletions(-)
 rename Documentation/{driver-api => admin-

guide}/thermal/intel_powerclamp.rst (93%)