Hi Thara,
On 16-02-21, 19:00, Thara Gopinath wrote:
This is a fix for a regression observed on db845 platforms with 5.7-rc11
kernel. On these platforms running stress tests with 5.11-rc7 kernel
causes big cpus to overheat and ultimately shutdown the system due to
hitting critical temperature (thermal throttling does not happen and
cur_state of cpufreq cooling device for big cpus remain stuck at 0 or max
frequency).
This platform has boost opp defined for big cpus but boost mode itself is
disabled in the cpufreq driver. Hence the initial max frequency request
from cpufreq cooling device(cur_state) for big cpus is for boost
frequency(2803200) where as initial max frequency request from cpufreq
driver itself is for the highest non boost frequency (2649600).
Okay.
qos
framework collates these two requests and puts the max frequency of big
cpus to 2649600 which the thermal framework is unaware of.
It doesn't need to be aware of that. It sets its max frequency and other
frameworks can put their own requests and the lowest one wins. In this case the
other constraint came from cpufreq-core, which is fine.
Now during an
over heat event, with step-wise policy governor, thermal framework tries to
throttle the cpu and places a restriction on max frequency of the cpu to
cur_state - 1
Actually it is cur_state + 1 as the values are inversed here, cooling state 0
refers to highest frequency :)
which in this case 2649600. qos framework in turn tells the
cpufreq cooling device that max frequency of the cpu is already at 2649600
and the cooling device driver returns doing nothing(cur_state of the
cooling device remains unchanged).
And that's where the bug lies, I have sent proper fix for that now.
Thus thermal remains stuck in a loop and
never manages to actually throttle the cpu frequency. This ultimately leads
to system shutdown in case of a thermal overheat event on big cpus.
There are multiple possible fixes for this issue. Fundamentally,it is wrong
for cpufreq driver and cpufreq cooling device driver to show different
maximum possible state/frequency for a cpu.
Not actually, cpufreq core changes the max supported frequency at runtime based
on the availability of boost frequencies.
cpufreq_table_count_valid_entries() is used at different places and it is
implemented correctly.