From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: daniel.lezcano@linaro.org, rjw@rjwysocki.net
Cc: lukasz.luba@arm.com, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, Zhang Rui <rui.zhang@intel.com>,
Amit Kucheria <amitk@kernel.org>
Subject: [PATCH v2 2/2] thermal/core: Make deprecated cooling device state change from userspace
Date: Tue, 19 Oct 2021 17:02:03 +0200 [thread overview]
Message-ID: <20211019150203.2805738-2-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <20211019150203.2805738-1-daniel.lezcano@linaro.org>
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 <daniel.lezcano@linaro.org>
---
drivers/thermal/thermal_sysfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index 1c4aac8464a7..730f1361dbef 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -610,6 +610,8 @@ cur_state_store(struct device *dev, struct device_attribute *attr,
unsigned long state;
int result;
+ pr_warn_once("Setting cooling device state is deprecated\n");
+
if (sscanf(buf, "%ld\n", &state) != 1)
return -EINVAL;
--
2.25.1
next prev parent reply other threads:[~2021-10-19 15:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-19 15:02 [PATCH v2 1/2] thermal/core: Make the userspace governor deprecated Daniel Lezcano
2021-10-19 15:02 ` Daniel Lezcano [this message]
2021-10-19 15:40 ` [PATCH v2 2/2] thermal/core: Make deprecated cooling device state change from userspace Rafael J. Wysocki
2021-10-19 15:43 ` Rafael J. Wysocki
2021-10-19 15:59 ` Daniel Lezcano
2021-10-19 16:26 ` Rafael J. Wysocki
2021-10-19 15:37 ` [PATCH v2 1/2] thermal/core: Make the userspace governor deprecated Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211019150203.2805738-2-daniel.lezcano@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=amitk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rjw@rjwysocki.net \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox