Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp984184lqp; Fri, 22 Mar 2024 01:51:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWexUPsY8f29kmJANE16loXwy81I4rqA7AE569belzG8kI51U2rfIogB4uKbpms5z765h8kX+bI42CT/sJqPLvoImAzAJuRzROdxANRhg== X-Google-Smtp-Source: AGHT+IFcK8LVtzOub4/WhKi7LsaKF4by0WFAopm6hCJ4swYxm3TQe1M6qsCMS/VqJrloftpuX6KD X-Received: by 2002:a17:906:410a:b0:a3f:1b49:c92b with SMTP id j10-20020a170906410a00b00a3f1b49c92bmr1126815ejk.48.1711097464802; Fri, 22 Mar 2024 01:51:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711097464; cv=pass; d=google.com; s=arc-20160816; b=GKHy8HaGht1a4exFNcZdLsfnjNU5CDfQOwxrrFpsbaXNCNqSs1IBXB3NCKSVoUa5SP rJdcTR/9nDKM8UvAQGRU6b+Acm2c0BtScViMbxV3kPAdiBjfIfNKCPf9oZs6k4sFI42z Tex9ujfmI2IRJFpFCSE9UU8esNNok3tKujugLtsRe7iaPfiD9sebsteiQ5Lz8PhKwzw1 rEenJKvyVmbnpug2lDs2UePgkHwJUI9yyfVUdxb34vA3G9+PVNHLqfM0roQUYX+kUzHJ e0/ZPEPTckHgviOUN2Eiv116WoJsRnxvJVwj18vdNjY5K4bACQILXNTpC4U7Fsdc01qd 0TZg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=j37LkWNYUWo0uI2yuHAPSa9EXC+Yuh7zahU/WU37GcM=; fh=X/t2J9Kc0rfFp+Ia/9HW/9t9xQmHpsgwrjlDvNHcaOs=; b=yI60KtKmeYlTxVzwwOtnUTELIsxKPhb4110xC/ZQf38fJK3PDORTdcH7S4Ku8bp42K aESI2pn8GpIkHXnEeLsLxQtDFHEO6hQvi0SRFchvOhrZc+bmUfhdfpqtXkEy0m+dIWMr wjdbEEHpWDdt+hgL6Z5WEQdVaV6CTwKEED9UAqe0hoMblpazfGxiGMNhZ/kXgJHa0LUw gaJBdgo71hsKU841nPYIeWtTQX0QjCcYGe6lKIiGxJcHz7HDbY8BZ2j8o61h7761DMwb mhpDDyfbK12X3hbl/1qM6ALxIKWJg34gCVUTh/I/M2OvsnOngLpOiqR8ppV2vs2V2utd B92Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-111162-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111162-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id kf7-20020a17090776c700b00a45e1603259si752729ejc.1003.2024.03.22.01.51.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 01:51:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111162-linux.lists.archive=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=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-111162-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111162-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 862341F22791 for ; Fri, 22 Mar 2024 08:51:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 49E921C6AB; Fri, 22 Mar 2024 08:50:27 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CEA3F224D8; Fri, 22 Mar 2024 08:50:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711097426; cv=none; b=HWLtSs5n0/N/5vpw/nS7XV9zAeRnVMk9c1H/cnKK7DROrVAkKz5VuvTgiuVC2ZLzxBsEC/mgH/g3WXWJkVLGnuCFpQAibsmh85X0BJnrIIKpn6gB9gKT6s5nWA74gbSvg085mbqVSJr4Zj56+kkhJMPc72RL/6KHj9R8p6V+eBk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711097426; c=relaxed/simple; bh=8ba/XlgbFs7Ype4sixeB3Mh2Ts60t6pN/+s3RLXasJc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lKgj3ec9DrNAMJSjeJNPPrD+RdyGHf6d+llpA05JpjdZ333fyqgSsnyFe6lyDQbnAuKedekGGnACpPu3AwIcmbsJNDCEcLYd3nbcGRPcdiGna2Ti8oY2/IoNyjNaYYdHnsAZDl3JWMrqFiuMpTIrch5GmNcqMnQgeKtJaq47xjs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 EFA0E1007; Fri, 22 Mar 2024 01:50:50 -0700 (PDT) Received: from [10.57.71.57] (unknown [10.57.71.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C5E183F64C; Fri, 22 Mar 2024 01:50:14 -0700 (PDT) Message-ID: Date: Fri, 22 Mar 2024 08:50:06 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] thermal: devfreq_cooling: Fix perf state when calculate dfc res_util Content-Language: en-US To: Ye Zhang Cc: tao.huang@rock-chips.com, heiko@sntech.de, rafael@kernel.org, daniel.lezcano@linaro.org, finley.xiao@rock-chips.com, linux-rockchip@lists.infradead.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, rui.zhang@intel.com References: <20240321102100.2401340-1-ye.zhang@rock-chips.com> From: Lukasz Luba In-Reply-To: <20240321102100.2401340-1-ye.zhang@rock-chips.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 3/21/24 10:21, Ye Zhang wrote: > The issue occurs when the devfreq cooling device uses the EM power model > and the get_real_power() callback is provided by the driver. > > The EM power table is sorted ascending,can't index the table by cooling > device state,so convert cooling state to performance state by > dfc->max_state - dfc->capped_state. > > Fixes: 615510fe13bd ("thermal: devfreq_cooling: remove old power model and use EM") > Cc: 5.11+ # 5.11+ > Signed-off-by: Ye Zhang > --- > v1 -> v2: > - Update the commit message. > > drivers/thermal/devfreq_cooling.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c > index 50dec24e967a..8fd7cf1932cd 100644 > --- a/drivers/thermal/devfreq_cooling.c > +++ b/drivers/thermal/devfreq_cooling.c > @@ -214,7 +214,7 @@ static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cd > > res = dfc->power_ops->get_real_power(df, power, freq, voltage); > if (!res) { > - state = dfc->capped_state; > + state = dfc->max_state - dfc->capped_state; > > /* Convert EM power into milli-Watts first */ > rcu_read_lock(); Thanks, LGTM Reviewed-by: Lukasz Luba