Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp34329rdh; Tue, 6 Feb 2024 18:11:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIbgO0GdxZzrn/ZMNG/1cJYNp0YsLgehd+R/P/4TRlGZlltmlQIby2p9EwtnrArk9QHe41 X-Received: by 2002:a17:903:25d3:b0:1d9:8d17:87b8 with SMTP id jc19-20020a17090325d300b001d98d1787b8mr3435075plb.34.1707271866335; Tue, 06 Feb 2024 18:11:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707271866; cv=pass; d=google.com; s=arc-20160816; b=SHSF7FEE/zTDBuhXlgfMcEeY7AteuhQrXgDhfS+TwtCcqcFicCZvbt6iNuNXGlMHmk JgDbNNisR89vKzsbRVRLVMT5RuQJ3Ouk/vMFtj6seDocFKYxazqPIhMme4wuIlwo3on0 1vQGQ6LolIkpezAqO1Y/tYU/750lpi2pAsHDSkLPFMIRR62RI8eU6BpHJndAbAZRE/0O FSpUuMUHN8JMFkvJsvzVXnMEvDfPzNqZtZ1KJQSKc3te2gR+9fymeGwXMxpH0lm9/8pK Wdm/QmPwTE4nPQGv9oQ9XFcTyp2DBflUFQwWAupcly+GIO7Pl4m9S4RVpJGexlimcLWI f7JQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:subject:cc:to:from; bh=pXZ92d7RFJYHLQ55tnncyCtNSXYsICTnjx3so8hBSD4=; fh=LTejdmbGFK8H2Yg6t9G6FhBuA7EOoswTBXqHVeRxtkg=; b=upd62F8FSRc3KAEkQ0kz3V8fX9dpQTi7mHX7DyYgx125cxP6cXxcKfFtpzlCbDal9N JyRiEJLrftjTsgOKerQaHa3sshwO2xBuNuw/2Rp8gYHvTIm7QiuuSmTGEHj82/g31rM9 E5H1jU0GGF5V7ARc1KKcBXhU6HGE6E3Z9+fMqf87bEjwXBc6epE9N2gzz68IeM3jK6om eE6lxEITKLL6Ic7NJVNTGNM1/u3saRpHrcqAp9TAZ7edwFiFBay1SAShCt3Dp8P/z6I4 YB6ccw4iJQozcOjhuZkpDwkOpj6aOZZnnVsQ3fxnM2r8CKvMZXZGedQ23rng7I69LoRI VNpA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-55837-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55837-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCU7tTNALm64AhWxV4LvP6FJ1JLtb+4ldwaVHdbmfkbd/ioQ91ArAXM8QjMZL9Oae9aFU247S11Eg6w3TXn/iDZEF2fV4UYvUHNtenPg9Q== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id m8-20020a170902db0800b001d9602f3dccsi431109plx.578.2024.02.06.18.11.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 18:11:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55837-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-55837-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55837-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4BAED28DD99 for ; Wed, 7 Feb 2024 02:09:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 68BCCDDA7; Wed, 7 Feb 2024 02:09:51 +0000 (UTC) Received: from SHSQR01.spreadtrum.com (mx1.unisoc.com [222.66.158.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C4F4FBE5; Wed, 7 Feb 2024 02:09:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=222.66.158.135 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707271790; cv=none; b=MHz/wKw9PErxmM8helxaBEypJ8YiTEBzSQZBrZOyyv7KdX7RaQkm5bK8HH049Sy49MUTLhbdJ3gBCK0ca7BGHpYRATk0XD7wRXCUIAjKazMRYgXINd1+3keLUjSrzOxdFKr0tTzqXLaN2WEkVpD7Bz3t2bCw8WrBECUo+iCSeo4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707271790; c=relaxed/simple; bh=nTXU8U898NWajyMP5BJwpco2rbN3R6w4FOQtYKp+DMc=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=MhuayEMu2NNMBz0/AfTTPd21iVAy1awjojxtbESHyPDYI+Oq2Ecr1Arl2wXnzAQ1gaJ6htA6WQEtnTrVwA9BUg+LosIJWPiI1UdIUnyKey7XDs1x7/jqasItKHo/IER6SkiB76FDDeYgaz6f7U3YfLi6RkNDwcrPcq+eGFQF4oc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com; spf=pass smtp.mailfrom=unisoc.com; arc=none smtp.client-ip=222.66.158.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=unisoc.com Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 41729UAA090594; Wed, 7 Feb 2024 10:09:30 +0800 (+08) (envelope-from Di.Shen@unisoc.com) Received: from SHDLP.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4TV3TH0pWyz2K25NR; Wed, 7 Feb 2024 10:09:23 +0800 (CST) Received: from bj10906pcu1.spreadtrum.com (10.0.73.72) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Wed, 7 Feb 2024 10:09:28 +0800 From: Di Shen To: , , , CC: , , , , , Subject: [RESEND][PATCH V2] thermal: power_allocator: Avoid overwriting PID coefficients from setup time Date: Wed, 7 Feb 2024 10:09:23 +0800 Message-ID: <20240207020923.4720-1-di.shen@unisoc.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL:SHSQR01.spreadtrum.com 41729UAA090594 When the PID coefficients k_* are set via sysfs before the IPA algorithm is triggered then the coefficients would be overwritten after IPA throttle() is called. The old configuration values might be different than the new values estimated by the IPA internal algorithm. There might be a time delay when this overwriting happens. It depends on the thermal zone temperature value. The temperature value needs to cross the first trip point value then IPA algorithms start operating. Although, the PID coefficients setup time should not be affected or linked to any later operating phase and values must not be overwritten. This patch initializes params->sustainable_power when the governor binds to thermal zone to avoid overwriting k_*. The basic function won't be affected, as the k_* still can be estimated if the sustainable_power is modified. Signed-off-by: Di Shen Reviewed-by: Lukasz Luba --- drivers/thermal/gov_power_allocator.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c index 81e061f183ad..1b17dc4c219c 100644 --- a/drivers/thermal/gov_power_allocator.c +++ b/drivers/thermal/gov_power_allocator.c @@ -711,6 +711,8 @@ static int power_allocator_bind(struct thermal_zone_device *tz) if (!tz->tzp->sustainable_power) dev_warn(&tz->device, "power_allocator: sustainable_power will be estimated\n"); + else + params->sustainable_power = tz->tzp->sustainable_power; estimate_pid_constants(tz, tz->tzp->sustainable_power, params->trip_switch_on, -- 2.17.1