Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4647053rdb; Tue, 12 Dec 2023 05:48:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5h57w/UckT7TsP8x7/pBDlR0QL65/IsMZXGn9EpS9HiSeg3xzFguUjcAxCnbFVYIKANae X-Received: by 2002:a17:902:7281:b0:1d0:6ffd:6e8b with SMTP id d1-20020a170902728100b001d06ffd6e8bmr2627490pll.131.1702388913808; Tue, 12 Dec 2023 05:48:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702388913; cv=none; d=google.com; s=arc-20160816; b=CVtoP0rfFwSBcbZ1uEmDSIl3M5+YiPNt1ge/fu2fOG1ZXhHAuWdnJOg+23zkYDqlEm g+SDNgEnXje+LRQd7HoAsWK1yt12AR1SKelbVAplRfn/SY1nKn6vx/8JfZfiSom8tdDT E0D6JJY6GD6huyBmUI7h4+rjGQBd9A0NZyRoH3f0mPZEd6b4I2Kl2/OFKrweL6h0F6Oz OCfGpK7uD5JbaJtZ+OT8/D3DQ3/xoXt1qX88OWF32tygXN4LRpku2aAvqRwpAha7JlQf 4p2NuT46TjgwO6VXVSlNZjgLKTTR1N1zf7Cja4x5l8Tzzy6YvfSO4EB6WPbA0a06LIZe HpHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=px+J4H0P24OYvnaVRg1MJ4JchQpKlZzagCuQJ+DFug8=; fh=8IgpUQ2T6XGOjA/qDosxdUSIIBz0a6nQ23NA8pgv1Tg=; b=kfpPGnN3pr/p4cpfkaUppVByT7i/j1tukNdVo4e9qBoljmpRj1o4IW6eGeQZgLcTHn AnN87jZn67AoOrurfYe6uqYDLYkz+zi53e+68jdvPBZd05Ri/0dne5T2GxBxK7VESWM8 meQfflrKu8JtgjeWK2aIkDVvUwc3rkw6TvXdGPCPdrG4Dv/zbIyKGK2cPJ5UVI2C1db6 oLoKcxkRWAzksVualx9IIbH50JQruBg/85lYVZmfcs63P+KED2iDoy0uqVMQDWxTma9Q vqA9kgN72ht2rWElav0kK/MRLl8lqq82gIYYlNrG0XuBo6yBraiMPWcCQ6uPFodelFoK X2Kg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id be3-20020a170902aa0300b001cf8d044c2asi7673232plb.544.2023.12.12.05.48.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 05:48:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E38018056995; Tue, 12 Dec 2023 05:48:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376403AbjLLNsU (ORCPT + 99 others); Tue, 12 Dec 2023 08:48:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376405AbjLLNsM (ORCPT ); Tue, 12 Dec 2023 08:48:12 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1D5ED138; Tue, 12 Dec 2023 05:48:07 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5C852143D; Tue, 12 Dec 2023 05:48:53 -0800 (PST) Received: from e129166.arm.com (unknown [10.57.82.227]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CD9863F738; Tue, 12 Dec 2023 05:48:05 -0800 (PST) From: Lukasz Luba To: linux-kernel@vger.kernel.org, daniel.lezcano@linaro.org, rafael@kernel.org Cc: linux-pm@vger.kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com Subject: [PATCH v2 7/8] thermal/sysfs: Update governors when the 'weight' has changed Date: Tue, 12 Dec 2023 13:48:43 +0000 Message-Id: <20231212134844.1213381-8-lukasz.luba@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231212134844.1213381-1-lukasz.luba@arm.com> References: <20231212134844.1213381-1-lukasz.luba@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 12 Dec 2023 05:48:33 -0800 (PST) Support governors update when the thermal instance's weight has changed. This allows to adjust internal state for the governor. Signed-off-by: Lukasz Luba --- drivers/thermal/thermal_sysfs.c | 9 +++++++++ include/linux/thermal.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c index df85df7d4a88..9afa2e2b76b9 100644 --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -957,6 +957,14 @@ weight_show(struct device *dev, struct device_attribute *attr, char *buf) return sprintf(buf, "%d\n", instance->weight); } +static void handle_weight_update(struct thermal_zone_device *tz) +{ + if (!tz->governor || !tz->governor->update_tz) + return; + + tz->governor->update_tz(tz, THERMAL_INSTANCE_WEIGHT_UPDATE); +} + ssize_t weight_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { @@ -974,6 +982,7 @@ ssize_t weight_store(struct device *dev, struct device_attribute *attr, /* Don't race with governors using the 'weight' value */ mutex_lock(&tz->lock); instance->weight = weight; + handle_weight_update(tz); mutex_unlock(&tz->lock); return count; diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 9fd0d3fb234a..24176f075fbf 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -52,6 +52,7 @@ enum thermal_notify_event { THERMAL_TABLE_CHANGED, /* Thermal table(s) changed */ THERMAL_EVENT_KEEP_ALIVE, /* Request for user space handler to respond */ THERMAL_INSTANCE_LIST_UPDATE, /* List of thermal instances changed */ + THERMAL_INSTANCE_WEIGHT_UPDATE, /* Thermal instance weight changed */ }; /** -- 2.25.1