From mboxrd@z Thu Jan 1 00:00:00 1970 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