[RESEND,V2] thermal: power_allocator: Avoid overwriting PID coefficients from setup time
Message ID | 20240207020923.4720-1-di.shen@unisoc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-55837-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1948759dyb; Tue, 6 Feb 2024 18:10:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGtC/cQ70gfjpQafUImyJp/fkrPLxbL8AfBUOpIMFGh//nP7/JrDJUJUI5PP7ywr99w2jJ5 X-Received: by 2002:a5d:6da2:0:b0:33b:48ef:e746 with SMTP id u2-20020a5d6da2000000b0033b48efe746mr2929782wrs.68.1707271807241; Tue, 06 Feb 2024 18:10:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707271807; cv=pass; d=google.com; s=arc-20160816; b=U0e3mD1q1HdO42/yxy4MAY+xyrN5K54gjcACvM3U/TZ7j9oTOOC+DFwKZNdqHJCkb+ GnQsZef3AKl6zFS14aau8tMl3apIWDIQUmX3pHOYsyESLB2TsbX2rbGBGk+T0pD0Khn1 /ZObz7OUEG37bqFs7BKoWM3hSTq0IcwhXPOcW4XX1f6h083J+Abcib13Mie0n9SElHFB JOlV7VkGlgRnWn4r3BSSikpJKP+fc5trxpH+r2yIJsTM5AkNVCKb4Z4qLGkzbgLBEUyF lT12apeHalZF+l80e5x1pA2OaX6YKzKSnDHyNzMMd7yJ8Cx6RyfozaFVylK6le6te9aV eUyw== 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=5mGxToy96H3XFpdJ/+deD65vJdn9wZmQnNV1rzujk/g=; b=Opj7AvZLgB1NSZ9hBqnjWPvLVxwJe1ZrChkdcWQGD49M/6VnETyroZKubiVVme2es6 OmnVI7geuC+sWxklLqgkpiCeYZcnDH1Xq+oKzuS1Z+vBHJKLLLnti9+eJaPCGwE5T/qJ YJaLQtcgxizq6bYwJAEEAeav0zq6m9QqemdyvKta5jcD2ISRQ/+9RfxnFwxJQYki8kIp C3HRG34IqW7Y9Alt/nBjc6pp1s9Oh88jeouJBLF5iyiTSp/AAjLYiOaOEOtBZ3nAiY4h JhRAdpAjC16xOHjzXCeuaMK7vwYlyRGxzPBD73NKfh2AzGA1MHfvqLsz3mMjVQgSkpFZ KnwQ==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55837-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCWpYlP2umF6ZHypjmUgNlTx+iSBqexhN820UV7asFHNGKzbYYiDimMya1fo/7/+D/BOLBh2u413MYqIbS4IZkmbtQXoXw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h8-20020a50ed88000000b0055ef9a173fdsi193980edr.546.2024.02.06.18.10.07 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 18:10:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55837-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-55837-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55837-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id D0F071F285AF for <ouuuleilei@gmail.com>; Wed, 7 Feb 2024 02:10:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A1397EED9; Wed, 7 Feb 2024 02:09:52 +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 <di.shen@unisoc.com> To: <lukasz.luba@arm.com>, <rafael@kernel.org>, <daniel.lezcano@linaro.org>, <rui.zhang@intel.com> CC: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <xuewen.yan@unisoc.com>, <zhanglyra@gmail.com>, <orsonzhai@gmail.com>, <cindygm567@gmail.com> 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: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790204242559019079 X-GMAIL-MSGID: 1790204242559019079 |
Series |
[RESEND,V2] thermal: power_allocator: Avoid overwriting PID coefficients from setup time
|
|
Commit Message
Di Shen
Feb. 7, 2024, 2:09 a.m. UTC
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 <di.shen@unisoc.com> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> --- drivers/thermal/gov_power_allocator.c | 2 ++ 1 file changed, 2 insertions(+)
Comments
On Wed, Feb 7, 2024 at 3:09 AM Di Shen <di.shen@unisoc.com> wrote: > > 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 <di.shen@unisoc.com> > Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> > --- > 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, > -- Applied as 6.9 material, thanks!
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,