Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1549889lqt; Wed, 20 Mar 2024 07:21:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVIWEotaNJ6J8swY6e7urVSV8HXqLGgHkcydibozjKZw8Sel2DIWqtugCpsgAStFnHtI4i+AJR3naqNQTVC9TDada93z5GvbtoXjwPsIA== X-Google-Smtp-Source: AGHT+IHm9qazNuVBR7ivbCy9fozSQm2ucrt6qpgqpa40N+r/ElLDZEI5/cTs3bWU+S+lwQZ6JfEz X-Received: by 2002:a05:6a20:12c3:b0:1a3:55f9:332d with SMTP id v3-20020a056a2012c300b001a355f9332dmr12295825pzg.25.1710944462954; Wed, 20 Mar 2024 07:21:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710944462; cv=pass; d=google.com; s=arc-20160816; b=wMjXPQp+v2E6IhUQNXlBdlBv4GJ4CjeDlmzibIUTZ6zajoL6Er/e90UL1HRSMVjZ55 Wdje8v4YJZXD+d785oUvAxWoUy6HHkZSfcLmrbuOP1w5ZU2mnvoHtR2Ajckf4+kdEKPo fci+zUpKxHomeVgcFvUqC19jr4eFQg1HJQQYyR+P0tOcu30PcTyZfDCLUBcdq4hvnxFs CrfRqcqKDJgcXGqEEgwxuErvHhrODO/akK9fcOvs8lSTpVUdkHJTs/MdUbN1MBdyIGSZ vVR85oHmyriPJyivssybMAS4U3KYJiRNwujoMK76mXV7LCQWfJBi9WdEjqYkoshgeIm8 UDbA== 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=xQl9sIbhTsEO5xHdSv6Rzf57yy18CSYzA7amVgnS4bE=; fh=QsXgI2qd1Q7ISipoL9J83XIyozpxUIKBCREovI+D7rg=; b=NMl3IIgDyhUVJePpCS7dGh01lWDKC/erLmpmdPZRwfgk2WNGskh4wZ73r/PPPkXgQ3 qBQ4UAsJWk2t4h658aMN0CqcEYMPF/mVZsG9P9n5jWut4RPtOGShP9ot36dAcwRzs0EG aBTElDILF1nW/tKawIFPL3tRR7thxGNQO/laHe8ClzAAcluzRSw6VmHBVRFpI1cUWnGu 0v2Vtm1Lrl6TPf4y2PW2UFpIw+2vw4+CQamU2xGzMLOOzhyE5cXqIQz2LEuEyi9o7eIS 6wdkQ39pSyp/EbMyeMJeEhKhioKHsIRfCHjreDfmXLXFMGSE4F0fPnl4dbkrAM3YjfNI SAdw==; 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-108997-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108997-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id k14-20020a635a4e000000b005cf94b8d9ddsi12478907pgm.869.2024.03.20.07.21.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 07:21:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108997-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; 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-108997-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108997-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id D802AB24C8C for ; Wed, 20 Mar 2024 14:16:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 33C46446AE; Wed, 20 Mar 2024 14:16:02 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CF4CF4084D; Wed, 20 Mar 2024 14:15:59 +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=1710944161; cv=none; b=Pt9d+Ti83Ml9INvSI2dqEJqbICqkkGMuR74s0zawwrp1EWAIMSoDoC0juJq9MoTLDGqo9dLSU4fo5eE1lBDK0rkN/4II8uR4iQNAPlJVR5f30fsJbdJBsEpkAW4ueIVFrr7VqXWKlV3w/LPV0G6bsPj2OOcKnigQdBrxuEWqoJ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710944161; c=relaxed/simple; bh=HKOGAMGI+cY/yHxVFJZLXvcCMLXHhUpxEQn31cO7kJI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=UCewAPVw6RxE2jBFOzQIR1SaamlKWfdMQu2A6ljFzpPFbqWbr28tW+2gFzWaZy4yn1Ts8VacN87cczlzngyRanKCIWA346GRkf7HpFcfcRqGlNDq4aYFF41p2g87gKn/EUUtcdH9PJr1kz+ImY5fI7Ou8CvvkTZLzhF+9MAir/0= 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 628171007; Wed, 20 Mar 2024 07:16:33 -0700 (PDT) Received: from [10.57.71.40] (unknown [10.57.71.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DC4BB3F64C; Wed, 20 Mar 2024 07:15:56 -0700 (PDT) Message-ID: Date: Wed, 20 Mar 2024 14:15:54 +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 v1] 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, rui.zhang@intel.com, finley.xiao@rock-chips.com, linux-rockchip@lists.infradead.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, daniel.lezcano@linaro.org, rafael@kernel.org References: <20240320075704.1924897-1-ye.zhang@rock-chips.com> From: Lukasz Luba In-Reply-To: <20240320075704.1924897-1-ye.zhang@rock-chips.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Ye, On 3/20/24 07:57, Ye Zhang wrote: > 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. > > Signed-off-by: Ye Zhang > --- > 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(); Thank you for the patch. Good catch! It's under the device driver callback optional thing: get_real_power(). Please send the v2 with extended explanation about the section of the code, which is triggered by the get_real_power() presence. Also, please add the tags, so it can be collected by stable kernel. Fixes: 615510fe13bd2434610 ("thermal: devfreq_cooling: remove old power model and use EM") Cc: 5.11+ # 5.11+ BTW, how did you trigger that issue? Do you have such a driver which provides this get_real_power() callback? Regards, Lukasz