Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp629366pxb; Tue, 19 Oct 2021 09:40:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHJv7ecST/1Nskk95ICVAZZEQHWw4VrrztUDl9GT+nkHIqOOgbaBTt6zCLeJS8Wb8XUBgz X-Received: by 2002:a63:36c7:: with SMTP id d190mr21208063pga.86.1634661638857; Tue, 19 Oct 2021 09:40:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634661638; cv=none; d=google.com; s=arc-20160816; b=jakfPI2tGjiTCl0f2/iLTYqm6FjB2xxGzAHplAfzd/M4gBTyMD6Iq6yXyGYLqVkWnt oPOYmzS04IGg2Kv0d4uj0qV5QHpWlAjI3C/64y6pVMqBM1EZc77AtkaCkPtFA0jKlIch 1FODBx6Va1FJwfnE3/ya12wDRhb47cNTaNU+fGLHSdAFJ9urtxl7vRyPLwu6elCZb4Nx i/tkuaMdJ52PZluh1HQTBmi21DwRvhvB5HAJev/F1EwIBWwUUsB9pOF5nbjbWzbFfhd1 Nu8YRUvWi1lyOeJ4SAW8SMQzoFKyCM6IGKyUc1Pl3yThZH6IBavPv1ZBre2qkzMj3gUN 8MWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=Pf+ZmgtAsq2+DIlmaBCIGg+7IqnLeyahgZKALzDPrlI=; b=psA9luF5+PQys6wiSkEaikukEFcgEAKD9S2ffmPYPFkedrvkywkvRrIUGwuzqbup09 /gbmg31ATqh05lEcLegVrYLwYee3eeFWK3zei8uJmBRZG9m4FkoPr26qvRDKsah6Xiki 9i0Gxzg2LUIlqeXcYKkeW1k8Izbi039LfgMpd2hG/aAx6xb1S30gLzB0RJ+/6QlqVqKd kweTeOx8sBElTPWXdNARIsZyGsH8p9rbtFU5Z+6V8ZjoD7lnTO4HCZ71uxEWZOACoYn4 4cVe3IjATIocgficbzx6zDHFPiPU9wKTCzyhh+PK9T4ghrXkJK1AzqoAVavsa17lfiyl yMJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w129si21891251pfw.182.2021.10.19.09.40.25; Tue, 19 Oct 2021 09:40:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234570AbhJSQlM (ORCPT + 99 others); Tue, 19 Oct 2021 12:41:12 -0400 Received: from mail-ot1-f49.google.com ([209.85.210.49]:39865 "EHLO mail-ot1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234483AbhJSQlI (ORCPT ); Tue, 19 Oct 2021 12:41:08 -0400 Received: by mail-ot1-f49.google.com with SMTP id e59-20020a9d01c1000000b00552c91a99f7so3577937ote.6; Tue, 19 Oct 2021 09:38:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Pf+ZmgtAsq2+DIlmaBCIGg+7IqnLeyahgZKALzDPrlI=; b=rU/fxWfYlKDNmuFJq4ltBDdZI1YVe23qrbPOYFMZxoRKf326QK1J/xRkGNYcJ8yA1e 68FFqMI7WeIrO8DITQ0uoi4n8vlnFXx8VUeTKwSczcmqgMbwrhbic1c/ktGmHCTnM0lN 7F57hYjb2lo9F4uQl8cXupcYuPJQ58g5VHIz37S3WDmSFUkr/uLYhFOTEt8ud+XuUj3d wI2cmBl5gRTiGcZGnBTSKv8/EoA0QCgjEFQIE/6FBBD0A0ZQqk06PZrTgFp3JO4cFRQ0 T7xYvoa2CDj04HwFRnNoamEBi4JBaJjiohmtORjOpiL9cmhNZFEcFrbnaOzQG4y0S7F0 oSfg== X-Gm-Message-State: AOAM533j90wWMGUjcS8/xUSXIITEe5yrkJF9ftu3NiCktuSHvFO4C92K DLHdrdepmTzupL6sF+INC5fqaP/JgBG/XR3gHjc= X-Received: by 2002:a05:6830:1af0:: with SMTP id c16mr5911496otd.16.1634661534934; Tue, 19 Oct 2021 09:38:54 -0700 (PDT) MIME-Version: 1.0 References: <20211019163506.2831454-1-daniel.lezcano@linaro.org> <20211019163506.2831454-2-daniel.lezcano@linaro.org> In-Reply-To: <20211019163506.2831454-2-daniel.lezcano@linaro.org> From: "Rafael J. Wysocki" Date: Tue, 19 Oct 2021 18:38:44 +0200 Message-ID: Subject: Re: [PATCH v3 2/2] thermal/core: Deprecate changing cooling device state from userspace To: Daniel Lezcano Cc: "Rafael J. Wysocki" , Lukasz Luba , Linux Kernel Mailing List , Linux PM , Zhang Rui , Amit Kucheria Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 19, 2021 at 6:35 PM Daniel Lezcano 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 Acked-by: Rafael J. Wysocki > --- > 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 >