From: Lukasz Luba <lukasz.luba@arm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Amit Kucheria <amitk@kernel.org>,
Amit Daniel Kachhap <amit.kachhap@gmail.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Javi Merino <javi.merino@kernel.org>,
Zhang Rui <rui.zhang@intel.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
Thara Gopinath <thara.gopinath@linaro.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
"v5 . 7+" <stable@vger.kernel.org>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] thermal: cpufreq_cooling: freq_qos_update_request() returns < 0 on error
Date: Wed, 17 Feb 2021 10:45:53 +0000 [thread overview]
Message-ID: <0b276055-e93a-3e08-5eee-662008d8db6c@arm.com> (raw)
In-Reply-To: <20210217103911.n34zzjttyso7dlco@vireshk-i7>
On 2/17/21 10:39 AM, Viresh Kumar wrote:
> On 17-02-21, 10:29, Lukasz Luba wrote:
>> On 2/17/21 5:48 AM, Viresh Kumar wrote:
>>> freq_qos_update_request() returns 1 if the effective constraint value
>>> has changed, 0 if the effective constraint value has not changed, or a
>>> negative error code on failures.
>>>
>>> The frequency constraints for CPUs can be set by different parts of the
>>> kernel. If the maximum frequency constraint set by other parts of the
>>> kernel are set at a lower value than the one corresponding to cooling
>>> state 0, then we will never be able to cool down the system as
>>> freq_qos_update_request() will keep on returning 0 and we will skip
>>> updating cpufreq_state and thermal pressure.
>>
>> To be precised, thermal pressure signal is not so important in this
>> mechanism and the 'cpufreq_state' has changed recently:
>
> Right, I wasn't concerned only about no thermal cooling, but both
> thermal cooling and pressure.
>
>> 236761f19a4f373354 thermal/drivers/cpufreq_cooling: Update cpufreq_state
>> only if state has changed
>
> This moved the assignment to a more logical place for me, i.e. not to
> do that on errors, just that the block in which it landed may not get
> called at all :(
>
>>> Fix that by doing the updates even in the case where
>>> freq_qos_update_request() returns 0, as we have effectively set the
>>> constraint to a new value even if the consolidated value of the
>>> actual constraint is unchanged because of external factors.
>>>
>>> Cc: v5.7+ <stable@vger.kernel.org> # v5.7+
>>> Reported-by: Thara Gopinath <thara.gopinath@linaro.org>
>>> Fixes: f12e4f66ab6a ("thermal/cpu-cooling: Update thermal pressure in case of a maximum frequency capping")
>>
>> I'm not sure if that f12e4f is the root cause.
>
> Hmm, depends on how we define the problem :)
>
> If this was just about thermal-cooling not happening, then may be yes,
> but to me it is rather about mishandled return value of
> freq_qos_update_request() which has more than one side effects and so
> I went for the main commit.
>
> This is also important as f12e4f66ab6a got merged in 5.7 and 236761f19
> merged in 5.11 and this patch needs to get applied in stable kernels
> since 5.7 to fix it all.
>
'to fix it all' - I agree
next prev parent reply other threads:[~2021-02-17 10:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-17 5:48 [PATCH] thermal: cpufreq_cooling: freq_qos_update_request() returns < 0 on error Viresh Kumar
2021-02-17 10:29 ` Lukasz Luba
2021-02-17 10:39 ` Viresh Kumar
2021-02-17 10:45 ` Lukasz Luba [this message]
2021-02-17 14:21 ` Rafael J. Wysocki
2021-02-17 15:38 ` Thara Gopinath
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0b276055-e93a-3e08-5eee-662008d8db6c@arm.com \
--to=lukasz.luba@arm.com \
--cc=amit.kachhap@gmail.com \
--cc=amitk@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=javi.merino@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rui.zhang@intel.com \
--cc=stable@vger.kernel.org \
--cc=thara.gopinath@linaro.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).