Message ID | 20211019163506.2831454-2-daniel.lezcano@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Daniel Lezcano |
Headers | show |
Series | [v3,1/2] thermal/core: Make the userspace governor deprecated | expand |
On Tue, Oct 19, 2021 at 6:35 PM Daniel Lezcano <daniel.lezcano@linaro.org> wrote: > > 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> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > --- > 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 1c4aac8464a7..f154bada2906 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; > > -- > 2.25.1 >
diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c index 1c4aac8464a7..f154bada2906 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;
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 | 3 +++ 1 file changed, 3 insertions(+)