Thread (8 messages) 8 messages, 4 authors, 2021-10-21

[thermal: thermal/next] thermal/core: Deprecate changing cooling device state from userspace

From: thermal-bot for Daniel Lezcano <hidden>
Date: 2021-10-21 20:16:50
Subsystem: the rest, thermal · Maintainers: Linus Torvalds, Rafael J. Wysocki, Daniel Lezcano

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     a67a46af4ad6342378e332b7420c1d1a2818c53f
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//a67a46af4ad6342378e332b7420c1d1a2818c53f
Author:        Daniel Lezcano [off-list ref]
AuthorDate:    Tue, 19 Oct 2021 18:35:06 +02:00
Committer:     Daniel Lezcano [off-list ref]
CommitterDate: Thu, 21 Oct 2021 17:35:11 +02:00

thermal/core: Deprecate changing cooling device state from userspace

The cooling devices have their cooling device set_cur_state
read-writable all the time in the sysfs directory, thus allowing the
userspace to act on it.

The thermal framework is wrongly used by userspace as a power capping
framework by acting on the cooling device opaque state. This one then
competes with the in-kernel governor decision.

We have seen in out-of-tree kernels, a big number of devices which are
abusely declaring themselves as cooling device just to act on their
power.

The role of the thermal framework is to protect the junction
temperature of the silicon. Letting the userspace to play with a
cooling device is invalid and potentially dangerous.

The powercap framework is the right framework to do power capping and
moreover it deals with the aggregation via the dev pm qos.

As the userspace governor is marked deprecated and about to be
removed, there is no point to keep this file writable also in the
future.

Emit a warning and deprecate the interface.

Signed-off-by: Daniel Lezcano <redacted>
Acked-by: Rafael J. Wysocki <redacted>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Link: https://lore.kernel.org/r/20211019163506.2831454-2-daniel.lezcano@linaro.org (local)
---
 drivers/thermal/thermal_sysfs.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index 1c4aac8..f154bad 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -610,6 +610,9 @@ cur_state_store(struct device *dev, struct device_attribute *attr,
 	unsigned long state;
 	int result;
 
+	dev_warn_once(&cdev->device,
+		      "Setting cooling device state is deprecated\n");
+	
 	if (sscanf(buf, "%ld\n", &state) != 1)
 		return -EINVAL;
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help