Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1569911rdb; Wed, 24 Jan 2024 22:24:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IETFeD1+e7BxW1I10zPtKz25h0S13PiUWWndvBk67m5pfiyECBt0xMNN//2wr6a9FiCFltw X-Received: by 2002:a17:902:684d:b0:1d7:6423:97bf with SMTP id f13-20020a170902684d00b001d7642397bfmr570258pln.11.1706163865643; Wed, 24 Jan 2024 22:24:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706163865; cv=pass; d=google.com; s=arc-20160816; b=ApuGT1tfdRyU3k7cFH7PI+cFtQplOSbIJ85esjnlmpGcVl7ee6qvp4OppK1m8epyzd BbvGhkEUvSyqEY9Cxnd+LtyQNDn7HkKI6m4DlcFYUrr5aDyyQplXNpCXZEzv+quJWNEt pHI0RqhgmpwzVUCwUpBVqVWC91+RXEkhJjkGzznYLcP3pa54Gv8gfTc0tLMxczeut3py mfMrJ1sqiZbpe2+z7FuPpFU6WmeXrlnXJcpmivjqXtkueE7OkbBWb3yh7qkrc4ug8xrE 8vbBvxc+6W/CRvh9qUhsZbb67Zl969ZGhvFEpo/TwzfRuJSj5NUyJUASPYbABoHl4OzX NC0g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=d4UGS1YD99z0Yfty5DZmN5o/KAtqOsg+qOkzVYFPHfc=; fh=V34BVVpU8VmKs8PEHIlT/yincNXP2mvih5acAjYfdrQ=; b=Ux4TLqv3mvNLFaqH/fyYpzkQcCT0CU5WzdFXU8mHoj4ASf1BdN2ttTlEWxQ2h1jDCM ygMYNjws64AaX+4hyMcPeXveLKj+HKiNLodyz819ypKkMixFUu30HwxTA7RdiWv0Veli ebZ4SbSzsRM7VuVWu3kDql+i1nAN7PgDxTplCLFuLS0fcpcv170rf3Sbj3PphcNJcw/o 2iYTjgsMqL1MyqTSpfspUIhCG6RtylhRfJd2+i9v8OOO37VekWkT47n11szIBpLjIDNz jDTLpUu3kH7b453dpY/sT0u7IIv6xtqT47TYVlJStfhfGTgWJNJF/HDRPLc6peeAlYIY xqVw== 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-38002-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38002-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q22-20020a170902789600b001d5c38f4b60si12541501pll.146.2024.01.24.22.24.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 22:24:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38002-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-38002-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38002-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 4AD69284F47 for ; Thu, 25 Jan 2024 06:24:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2D2210A35; Thu, 25 Jan 2024 06:24:14 +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 26A3410A12; Thu, 25 Jan 2024 06:24:10 +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=1706163854; cv=none; b=WnafPK1LsZEzIkJKYc9ZfyxdIUWfCcJF8q9Vr19RI53J2UB7QoJjUvzH2mB3df3nMMY1Gg0W4mh5aqNuO7GU5DaX5+2z//3xNnjuNjg48BdGvkGWMDyY6q6uTwSIvOzBVkUA3l5XeHkpmRlF3LYtWeJdP7E5djr4ZDxEuU+T2fY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706163854; c=relaxed/simple; bh=IJnqiJ3su0ULAtCoiKNxfIa4lBJxYdBgJQZXApe+y2A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EqJV3bUAMVwF7sSDvN7nUgMv2CIUz+o59UxiSKmZCUDAeilO67IsVBH4Aoh2ZvE4NIVEdndPRDEn8hqTc4AcBbjbGXI2Sibm68YafszVWSv6+MObbXcHDJze1cPqrBGGKlpDOoagbSsXAp9Kh14+PngGHnUUi17h/THiR8Tptdg= 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 40P6NZMG074726; Thu, 25 Jan 2024 14:23:35 +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 4TL9Z2408Nz2SKBpW; Thu, 25 Jan 2024 14:16:10 +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; Thu, 25 Jan 2024 14:23:33 +0800 From: Di Shen To: , , , CC: , , , , , Subject: [PATCH V2] thermal: power_allocator: Avoid overwriting PID coefficients from setup time Date: Thu, 25 Jan 2024 14:23:31 +0800 Message-ID: <20240125062331.28943-1-di.shen@unisoc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <1f8914cb-fc66-4068-8f7c-4d13b2454f7d@arm.com> References: <1f8914cb-fc66-4068-8f7c-4d13b2454f7d@arm.com> 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 40P6NZMG074726 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 --- 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