Re: [REGRESSION] 774ac8b7eff6 ("Thermal: initialize thermal zone device correctly") causes performance drop

From: Zhang Rui
Date: Sat Mar 19 2016 - 00:44:03 EST



Hi, all,

On Wed, 2016-03-16 at 15:27 -0700, Laura Abbott wrote:
> Hi,
>
> Fedora received a bug report (https://bugzilla.redhat.com/show_bug.cgi?id=1317190)
> of a major performance drop on various bench marks and general system
> sluggishness with the 4.4.4 kernel update. The benchmarks were showing
> a reduction to about 18% performance (not minor).
>
> Bisection showed the first bad commit was
>
> commit 774ac8b7eff69e0786970157de2157e68b22f456
> Author: Zhang Rui <rui.zhang@xxxxxxxxx>
> Date: Fri Oct 30 16:31:47 2015 +0800
>
> Thermal: initialize thermal zone device correctly
>
> commit bb431ba26c5cd0a17c941ca6c3a195a3a6d5d461 upstream.
>
> After thermal zone device registered, as we have not read any
> temperature before, thus tz->temperature should not be 0,
> which actually means 0C, and thermal trend is not available.
> In this case, we need specially handling for the first
> thermal_zone_device_update().
>
> Both thermal core framework and step_wise governor is
> enhanced to handle this. And since the step_wise governor
> is the only one that uses trends, so it's the only thermal
> governor that needs to be updated.
>
> Tested-by: Manuel Krause <manuelkrause@xxxxxxxxxxxx>
> Tested-by: szegad <szegadlo@xxxxxxxxxxxxxx>
> Tested-by: prash <prash.n.rao@xxxxxxxxx>
> Tested-by: amish <ammdispose-arch@xxxxxxxxx>
> Tested-by: Matthias <morpheusxyz123@xxxxxxxx>
> Reviewed-by: Javi Merino <javi.merino@xxxxxxx>
> Signed-off-by: Zhang Rui <rui.zhang@xxxxxxxxx>
> Signed-off-by: Chen Yu <yu.c.chen@xxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

According to https://bugzilla.redhat.com/show_bug.cgi?id=1317190#c30
and https://bugzilla.kernel.org/show_bug.cgi?id=114551,
the root cause of the problem is that
1. BIOS reports bogus passive trip point value, which is 0 degree
Celsius
2. Without the thermal patches, thermal core does nothing upon driver
probe, thus processor cooling states are not changed.
3. With the thermal patches applied, thermal core checks the new
registered thermal zone driver when it is probed, and set the cooling
devices to proper state, for example, fan device could be spinning
during boot, even if the system is cool.
4. Thus, on these Lenovo laptops, processor cooling devices are
throttled because the current temperature (around 50C) is higher than
the passive trip point (0C), and the thermal zone is considered as
overheating.

In order to workaround this bogus BIOS, we should disable those invalid
trip points by checking the trip point value, like the patch below,
Laura and Vlad,
can you please try the patch below and confirm if it fixes the problem
for you?