774ac8b7eff6 ("Thermal: initialize thermal zone device correctly") causes performance drop
Laura Abbott
Tested-by Manuel Krause Tested-by szegad Tested-by prash Tested-by amish Tested-by Matthias Reviewed-by Javi MerinoHi,
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 <[email protected]> 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.
Reverting this plus to other commits in the series (a67208e94d94 "Thermal: handle thermal zone device properly during system sleep" and 27f356149d59 "Thermal: do thermal zone update after a cooling device registered") confirmed the performance was back to normal.
Bugzilla has the full discussion but this comment from one of the reporters sums it up:
"In 4.4.3 and prior, my 2.40 MHz processor would fluctuate between 1000 and 3400 MHz. In 4.4.4, the processor would fluctuate between 400 and 700 MHz, according to /proc/cpuinfo.
Setting /sys/devices/system/cpu/cpufreq/policy0/scaling_governor to performance, instead of the default "powersave" forces the CPU to 2400 MHz, and improves performance greatly, but still not to the same level as in 4.4.3."
Any ideas?
Thanks,
Laura
Quoted 48 lines · Laura Abbott
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
774ac8b7eff69e0786970157de2157e68b22f456Author: Zhang Rui <[email protected]> Date: Fri Oct 30 16:31:47 2015 +0800Thermal: initialize thermal zone device correctly commit
bb431ba26c5cd0a17c941ca6c3a195a3a6d5d461upstream. After thermal zone device registered, as we have not read any temperature before, thustz->temperatureshould not be 0, which actually means 0C, and thermal trend is not available. In this case, we need specially handling for the firstthermal_zone_device_update().
Both thermal core framework andstep_wisegovernor is enhanced to handle this. And since thestep_wisegovernor is the only one that uses trends, so it's the only thermal governor that needs to be updated.Tested-by Manuel Krause <[email protected]>Tested-by szegad <[email protected]>Tested-by prash <[email protected]>Tested-by amish <[email protected]>Tested-by Matthias <[email protected]>Reviewed-by Javi Merino <[email protected]>Signed-off-by Zhang Rui <[email protected]>Signed-off-by Chen Yu <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Reverting this plus to other commits in the series (
a67208e94d94"Thermal: handle thermal zone device properly during system sleep" and27f356149d59"Thermal: do thermal zone update after a cooling device registered") confirmed the performance was back to normal.Bugzilla has the full discussion but this comment from one of the reporters sums it up:
"In 4.4.3 and prior, my 2.40 MHz processor would fluctuate between 1000 and 3400 MHz. In 4.4.4, the processor would fluctuate between 400 and 700 MHz, according to
/proc/cpuinfo.
Quoted 6 lines
Setting
/sys/devices/system/cpu/cpufreq/policy0/scaling_governorto performance, instead of the default "powersave" forces the CPU to 2400 MHz, and improves performance greatly, but still not to the same level as in 4.4.3."Any ideas?
Is this same "slowdown" also seen in 4.5?
thanks,
greg k-h
Quoted 54 lines · Greg Kroah-Hartman
Quoted 53 lines · Laura Abbott
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
774ac8b7eff69e0786970157de2157e68b22f456Author: Zhang Rui <[email protected]> Date: Fri Oct 30 16:31:47 2015 +0800Thermal: initialize thermal zone device correctly commit
bb431ba26c5cd0a17c941ca6c3a195a3a6d5d461upstream. After thermal zone device registered, as we have not read any temperature before, thustz->temperatureshould not be 0, which actually means 0C, and thermal trend is not available. In this case, we need specially handling for the firstthermal_zone_device_update().
Both thermal core framework andstep_wisegovernor is enhanced to handle this. And since thestep_wisegovernor is the only one that uses trends, so it's the only thermal governor that needs to be updated.Tested-by Manuel Krause <[email protected]>Tested-by szegad <[email protected]>Tested-by prash <[email protected]>Tested-by amish <[email protected]>Tested-by Matthias <[email protected]>Reviewed-by Javi Merino <[email protected]>Signed-off-by Zhang Rui <[email protected]>Signed-off-by Chen Yu <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Reverting this plus to other commits in the series (
a67208e94d94"Thermal: handle thermal zone device properly during system sleep" and27f356149d59"Thermal: do thermal zone update after a cooling device registered") confirmed the performance was back to normal.Bugzilla has the full discussion but this comment from one of the reporters sums it up:
"In 4.4.3 and prior, my 2.40 MHz processor would fluctuate between 1000 and 3400 MHz. In 4.4.4, the processor would fluctuate between 400 and 700 MHz, according to
/proc/cpuinfo.Setting
/sys/devices/system/cpu/cpufreq/policy0/scaling_governorto performance, instead of the default "powersave" forces the CPU to 2400 MHz, and improves performance greatly, but still not to the same level as in 4.4.3."
Quoted 8 lines
Quoted 1 line
Any ideas?
Is this same "slowdown" also seen in 4.5?
thanks,
greg k-h
Yes, the same issue is seen on 4.5 according to the reporter.
Thanks,
Laura
Quoted 57 lines · Laura Abbott
Quoted 56 lines · Greg Kroah-Hartman
Quoted 54 lines · Laura Abbott
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
774ac8b7eff69e0786970157de2157e68b22f456Author: Zhang Rui <[email protected]> Date: Fri Oct 30 16:31:47 2015 +0800Thermal: initialize thermal zone device correctly commit
bb431ba26c5cd0a17c941ca6c3a195a3a6d5d461upstream. After thermal zone device registered, as we have not read any temperature before, thustz->temperatureshould not be 0, which actually means 0C, and thermal trend is not available. In this case, we need specially handling for the firstthermal_zone_device_update().
Both thermal core framework andstep_wisegovernor is enhanced to handle this. And since thestep_wisegovernor is the only one that uses trends, so it's the only thermal governor that needs to be updated.Tested-by Manuel Krause <[email protected]>Tested-by szegad <[email protected]>Tested-by prash <[email protected]>Tested-by amish <[email protected]>Tested-by Matthias <[email protected]>Reviewed-by Javi Merino <[email protected]>Signed-off-by Zhang Rui <[email protected]>Signed-off-by Chen Yu <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Reverting this plus to other commits in the series (
a67208e94d94"Thermal: handle thermal zone device properly during system sleep" and27f356149d59"Thermal: do thermal zone update after a cooling device registered") confirmed the performance was back to normal.Bugzilla has the full discussion but this comment from one of the reporters sums it up:
"In 4.4.3 and prior, my 2.40 MHz processor would fluctuate between 1000 and 3400 MHz. In 4.4.4, the processor would fluctuate between 400 and 700 MHz, according to
/proc/cpuinfo.Setting
/sys/devices/system/cpu/cpufreq/policy0/scaling_governorto performance, instead of the default "powersave" forces the CPU to 2400 MHz, and improves performance greatly, but still not to the same level as in 4.4.3."Any ideas?
Quoted 8 lines
Quoted 6 lines
Is this same "slowdown" also seen in 4.5?
thanks,
greg k-h
Yes, the same issue is seen on 4.5 according to the reporter.
Great, we are "bug compatible" :)
Can you please work to get this resolved in Linus's tree and then we can backport the needed changes into the 4.4-stable release.
Zhang, any ideas here?
thanks,
greg k-h
Zhang, Rui
reviewerCan you send me the output of "grep . /sys/class/thermal/*/*" both w/ and w/o the broken patch series?
Thanks,
rui
Quoted 76 lines
-----Original Message-----
From: Laura Abbott [mailto:[email protected]]
Sent: Thursday, March 17, 2016 6:28 AM
To: Zhang, Rui <[email protected]>; Javi Merino <[email protected]>; Chen, Yu C <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>; Manuel Krause <[email protected]>; szegad <[email protected]>; prash <[email protected]>; amish <[email protected]>; Matthias <[email protected]>; [email protected]; Linux Kernel Mailing List <[email protected]>
Subject: [REGRESSION]774ac8b7eff6("Thermal: initialize thermal zone device correctly") causes performance drop
Importance: HighHi,
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
774ac8b7eff69e0786970157de2157e68b22f456Author: Zhang Rui <[email protected]> Date: Fri Oct 30 16:31:47 2015 +0800Thermal: initialize thermal zone device correctly
commit
bb431ba26c5cd0a17c941ca6c3a195a3a6d5d461upstream.After thermal zone device registered, as we have not read any temperature before, thus
tz->temperatureshould not be 0, which actually means 0C, and thermal trend is not available. In this case, we need specially handling for the firstthermal_zone_device_update().Both thermal core framework and
step_wisegovernor is enhanced to handle this. And since thestep_wisegovernor is the only one that uses trends, so it's the only thermal governor that needs to be updated.Tested-by Manuel Krause <[email protected]>Tested-by szegad <[email protected]>Tested-by prash <[email protected]>Tested-by amish <[email protected]>Tested-by Matthias <[email protected]>Reviewed-by Javi Merino <[email protected]>Signed-off-by Zhang Rui <[email protected]>Signed-off-by Chen Yu <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Reverting this plus to other commits in the series (
a67208e94d94"Thermal: handle thermal zone device properly during system sleep" and27f356149d59"Thermal: do thermal zone update after a cooling device registered") confirmed the performance was back to normal.Bugzilla has the full discussion but this comment from one of the reporters sums it up:
"In 4.4.3 and prior, my 2.40 MHz processor would fluctuate between 1000 and 3400 MHz. In 4.4.4, the processor would fluctuate between 400 and 700 MHz, according to
/proc/cpuinfo.Setting
/sys/devices/system/cpu/cpufreq/policy0/scaling_governorto performance, instead of the default "powersave" forces the CPU to 2400 MHz, and improves performance greatly, but still not to the same level as in 4.4.3."Any ideas?
Thanks,
Laura
Quoted 66 lines · Laura Abbott
Quoted 65 lines · Greg Kroah-Hartman
Quoted 63 lines · Laura Abbott
Hi,
Fedora received a bug report (https://bugzilla.redhat.com/show_bu
g.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 <[email protected]>
Date: Fri Oct 30 16:31:47 2015 +0800Thermal: initialize thermal zone device correctly commit
bb431ba26c5cd0a17c941ca6c3a195a3a6d5d461upstream. After thermal zone device registered, as we have not read any
temperature before, thustz->temperatureshould not be 0, which actually means 0C, and thermal trend is not available. In this case, we need specially handling for the firstthermal_zone_device_update().
Both thermal core framework andstep_wisegovernor is enhanced to handle this. And since thestep_wisegovernor is the only one that uses trends, so it's the only thermal governor that needs to be updated.Tested-by Manuel Krause <[email protected]>Tested-by szegad <[email protected]>Tested-by prash <[email protected]>Tested-by amish <[email protected]>Tested-by Matthias <[email protected]>Reviewed-by Javi Merino <[email protected]>Signed-off-by Zhang Rui <[email protected]>Signed-off-by Chen Yu <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]g>
Reverting this plus to other commits in the series (
a67208e94d94"Thermal: handle thermal zone device properly during system sleep"
and27f356149d59"Thermal: do thermal zone update after a cooling device registered") confirmed the performance was back to normal.Bugzilla has the full discussion but this comment from one of the reporters sums it up:
"In 4.4.3 and prior, my 2.40 MHz processor would fluctuate between
1000 and 3400 MHz. In 4.4.4, the processor would fluctuate between
400 and 700 MHz, according to/proc/cpuinfo.Setting
/sys/devices/system/cpu/cpufreq/policy0/scaling_governorto
performance, instead of the default "powersave" forces the CPU to 2400 MHz, and improves performance greatly, but still not to the same level as in 4.4.3."Any ideas?
Quoted 8 lines
Quoted 6 lines
Is this same "slowdown" also seen in 4.5?
thanks,
greg k-h
Yes, the same issue is seen on 4.5 according to the reporter.
What does it show here when performance drops?
grep . /sys/devices/system/cpu/intel_pstate/*
Is the problem still occurs if you set /sys/class/thermal/thermal_zone*/mode to "disabled"
Thanks,
Srinivas
Quoted 8 lines
Thanks,
Laura
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
(bringing this back to the main thread)
Quoted 75 lines · Srinivas
Quoted 66 lines · Laura Abbott
Quoted 65 lines · Greg Kroah-Hartman
Quoted 63 lines · Laura Abbott
Hi,
Fedora received a bug report (https://bugzilla.redhat.com/show_bu
g.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
774ac8b7eff69e0786970157de2157e68b22f456Author: Zhang Rui <[email protected]> Date: Fri Oct 30 16:31:47 2015 +0800Thermal: initialize thermal zone device correctly commit
bb431ba26c5cd0a17c941ca6c3a195a3a6d5d461upstream. After thermal zone device registered, as we have not read
any
temperature before, thustz->temperatureshould not be 0, which actually means 0C, and thermal trend is not available. In this case, we need specially handling for the firstthermal_zone_device_update().
Both thermal core framework andstep_wisegovernor is enhanced to handle this. And since thestep_wisegovernor is the only one that uses trends, so it's the only thermal governor that needs to be updated.Tested-by Manuel Krause <[email protected]>Tested-by szegad <[email protected]>Tested-by prash <[email protected]>Tested-by amish <[email protected]>Tested-by Matthias <[email protected]>Reviewed-by Javi Merino <[email protected]>Signed-off-by Zhang Rui <[email protected]>Signed-off-by Chen Yu <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]g>
Reverting this plus to other commits in the series (
a67208e94d94"Thermal: handle thermal zone device properly during system sleep"
and27f356149d59"Thermal: do thermal zone update after a cooling device registered") confirmed the performance was back to normal.Bugzilla has the full discussion but this comment from one of the reporters sums it up:
"In 4.4.3 and prior, my 2.40 MHz processor would fluctuate between
1000 and 3400 MHz. In 4.4.4, the processor would fluctuate between
400 and 700 MHz, according to/proc/cpuinfo.Setting
/sys/devices/system/cpu/cpufreq/policy0/scaling_governorto
performance, instead of the default "powersave" forces the CPU to 2400 MHz, and improves performance greatly, but still not to the same level as in 4.4.3."Any ideas?
Quoted 8 lines
Quoted 6 lines
Is this same "slowdown" also seen in 4.5?
thanks,
greg k-h
Yes, the same issue is seen on 4.5 according to the reporter.
Quoted 9 lines
What does it show here when performance drops?
grep ./sys/devices/system/cpu/intel_pstate/*Is the problem still occurs if you set
/sys/class/thermal/thermal_zone*/modeto "disabled"Thanks,
Srinivas
A separate thread was started which gave this insight:
"I think
the problem is your device has a passive trip temp of 0 /sys/class/thermal/thermal_zone0/trip_point_2_temp:0 /sys/class/thermal/thermal_zone0/trip_point_2_type:passive
Which triggers a false throttle = true. I think we should this trip as invalid in the case of
if (tz->temperature >= trip_temp) {} check
in thermal_zone_trip_update()."
So would something like the following work?
drivers/thermal/step_wise.c +1 -1
@@ -143,7 +143,7 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) trend =get_tz_trend (tz, trip); -if (tz->temperature >= trip_temp) { +if (trip_type !=THERMAL_TRIPS_NONE && tz->temperature >= trip_temp) { throttle = true;trace_thermal_zone_trip (tz, trip, trip_type); }
(completely untested, no idea if I'm even close)
Thanks,
Laura
Quoted 127 lines · Laura Abbott
(bringing this back to the main thread)
Quoted 92 lines · Srinivas
Quoted 83 lines · Laura Abbott
Quoted 82 lines · Greg Kroah-Hartman
Quoted 80 lines · Laura Abbott
Hi,
Fedora received a bug report (https://bugzilla.redhat.com/sho
w_bu
g.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 <[email protected]>
Date: Fri Oct 30 16:31:47 2015 +0800Thermal: initialize thermal zone device correctly commit
bb431ba26c5cd0a17c941ca6c3a195a3a6d5d461upstream.
After thermal zone device registered, as we have not read
any
temperature before, thustz->temperatureshould not be 0,
which actually means 0C, and thermal trend is not available.
In this case, we need specially handling for the firstthermal_zone_device_update().
Both thermal core framework andstep_wisegovernor is enhanced to handle this. And since thestep_wisegovernor
is the only one that uses trends, so it's the only thermal
governor that needs to be updated.Tested-by Manuel Krause <[email protected]>Tested-by szegad <[email protected]>Tested-by prash <[email protected]>Tested-by amish <[email protected]>Tested-by Matthias <[email protected]>Reviewed-by Javi Merino <[email protected]>Signed-off-by Zhang Rui <[email protected]>Signed-off-by Chen Yu <[email protected]>Signed-off-by Greg Kroah-Hartman <gregkh@linuxfoundation.or
g>Reverting this plus to other commits in the series (
a67208e94d94
"Thermal: handle thermal zone device properly during system sleep"
and27f356149d59"Thermal: do thermal zone update after a cooling
device registered") confirmed the performance was back to normal.Bugzilla has the full discussion but this comment from one of the
reporters sums it up:"In 4.4.3 and prior, my 2.40 MHz processor would fluctuate between
1000 and 3400 MHz. In 4.4.4, the processor would fluctuate between
400 and 700 MHz, according to/proc/cpuinfo.Setting
/sys/devices/system/cpu/cpufreq/policy0/scaling_governorto
performance, instead of the default "powersave" forces the CPU to
2400 MHz, and improves performance greatly, but still not to the
same level as in 4.4.3."Any ideas?
Quoted 8 lines
Quoted 6 lines
Is this same "slowdown" also seen in 4.5?
thanks,
greg k-h
Yes, the same issue is seen on 4.5 according to the reporter.
Quoted 9 lines
What does it show here when performance drops?
grep ./sys/devices/system/cpu/intel_pstate/*Is the problem still occurs if you set
/sys/class/thermal/thermal_zone*/modeto "disabled"Thanks,
SrinivasA separate thread was started which gave this insight:
"I think
the problem is your device has a passive trip temp of 0/sys/class/thermal/thermal_zone0/trip_point_2_temp:0/sys/class/thermal/thermal_zone0/trip_point_2_type:passiveWhich triggers a false throttle = true. I think we should this trip as
invalid in the case of
if (tz->temperature>=trip_temp) {} check
inthermal_zone_trip_update()."So would something like the following work?
drivers/thermal/step_wise.c +0
-0@@ -143,7 +143,7 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
Quoted 6 lines
trend =get_tz_trend(tz, trip);
- if (tz->temperature>=trip_temp) {
+ if (trip_type!=THERMAL_TRIPS_NONE&&tz->temperature>=trip_temp) {
if (trip_temp && tz->temperature >= trip_temp) {throttle = true;
Quoted 3 lines
trace_thermal_zone_trip(tz, trip,
trip_type); }
I think Rui is working on some change.
Thanks,
Srinivas
Quoted 4 lines
(completely untested, no idea if I'm even close)
Thanks,
Laura
Zhang Rui
reviewer Tested-by Manuel Krause Tested-by szegad Tested-by prash Tested-by amish Tested-by Matthias Reviewed-by Javi MerinoHi, all,
Quoted 28 lines · Laura Abbott
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
774ac8b7eff69e0786970157de2157e68b22f456Author: Zhang Rui <[email protected]> Date: Fri Oct 30 16:31:47 2015 +0800Thermal: initialize thermal zone device correctly
commit
bb431ba26c5cd0a17c941ca6c3a195a3a6d5d461upstream.After thermal zone device registered, as we have not read any temperature before, thus
tz->temperatureshould not be 0, which actually means 0C, and thermal trend is not available. In this case, we need specially handling for the firstthermal_zone_device_update().Both thermal core framework and
step_wisegovernor is enhanced to handle this. And since thestep_wisegovernor is the only one that uses trends, so it's the only thermal governor that needs to be updated.
Quoted 9 lines
Tested-by Manuel Krause <[email protected]>Tested-by szegad <[email protected]>Tested-by prash <[email protected]>Tested-by amish <[email protected]>Tested-by Matthias <[email protected]>Reviewed-by Javi Merino <[email protected]>Signed-off-by Zhang Rui <[email protected]>Signed-off-by Chen Yu <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
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?
Quoted 1 line
From
81ad4276b505e987dd8ebbdf63605f92cd172b52Mon Sep 17 00:00:00 2001
From: Zhang Rui <[email protected]>
Date: Fri, 18 Mar 2016 10:03:24 +0800
Subject: [PATCH] Thermal: Ignore invalid trip points
In some cases, platform thermal driver may report invalid trip points, thermal core should not take any action for these trip points.
This fixed a regression that bogus trip point starts to screw up thermal control on some Lenovo laptops, after
commit bb431ba26c5cd0a17c941ca6c3a195a3a6d5d461
Author: Zhang Rui <[email protected]> Date: Fri Oct 30 16:31:47 2015 +0800
Thermal: initialize thermal zone device correctly
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.
--- drivers/thermal/thermal_core.c | 13 ++++++++++++- include/linux/thermal.h | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/thermal/thermal_core.c +12 -1
@@ -454,6 +454,10 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) {enum thermal_trip_type type; +/* Ignore disabled trip points */ +if (test_bit (trip, &tz->trips_disabled)) +return ; + tz->ops->get_trip_type (tz, trip, &type);if (type ==THERMAL_TRIP_CRITICAL || type ==THERMAL_TRIP_HOT )
@@ -1800,6 +1804,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, {struct thermal_zone_device *tz;enum thermal_trip_type trip_type; +int trip_temp;int result;int count;int passive =0 ;
@@ -1871,9 +1876,15 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, goto unregister;for (count =0 ; count < trips; count++) { - tz->ops->get_trip_type (tz, count, &trip_type); +if (tz->ops->get_trip_type (tz, count, &trip_type)) +set_bit (count, &tz->trips_disabled);if (trip_type ==THERMAL_TRIP_PASSIVE ) passive =1 ; +if (tz->ops->get_trip_temp (tz, count, &trip_temp)) +set_bit (count, &tz->trips_disabled); +/* Check for bogus trip points */ +if (trip_temp ==0 ) +set_bit (count, &tz->trips_disabled); }if (!passive) {
include/linux/thermal.h +2 -0
@@ -156,6 +156,7 @@ struct thermal_attr {* @trip_hyst_attrs: attributes for trip points for sysfs: trip hysteresis * @devdata: private pointer for device private data * @trips: number of trip points the thermal zone supports +* @trips_disabled; bitmap for disabled trips * @passive_delay: number of milliseconds to wait between polls when * performing passive cooling. * @polling_delay: number of milliseconds to wait between polls when
@@ -191,6 +192,7 @@ struct thermal_zone_device {struct thermal_attr *trip_hyst_attrs;void *devdata;int trips; +unsigned long trips_disabled;/* bitmap for disabled trips */ int passive_delay;int polling_delay;int temperature;
Signature · 1 line
1.9.1
Hi Rui,
I'm sorry for the delay; Reading the e-mail the first time I have missed the part about the patch, so I'm building the kernel now.
By the way, the patch reported a slight offset missmatch:
patching file drivers/thermal/thermal_core.c
Hunk #2 succeeded at 1800 (offset -4 lines).
Hunk #3 succeeded at 1872 (offset -4 lines).
Is this fine?
Quoted 198 lines · Vladyslav Frolov
Hi Rui,
I'm sorry for the delay; Reading the e-mail the first time I have missed the part about the patch, so I'm building the kernel now.
By the way, the patch reported a slight offset missmatch:
patching file
drivers/thermal/thermal_core.c
Hunk #2 succeeded at 1800 (offset -4 lines).
Hunk #3 succeeded at 1872 (offset -4 lines).Is this fine?
Quoted 181 lines · Zhang Rui
Hi, all,
Quoted 29 lines · Laura Abbott
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
774ac8b7eff69e0786970157de2157e68b22f456Author: Zhang Rui <[email protected]> Date: Fri Oct 30 16:31:47 2015 +0800Thermal: initialize thermal zone device correctly
commit
bb431ba26c5cd0a17c941ca6c3a195a3a6d5d461upstream.After thermal zone device registered, as we have not read any temperature before, thus
tz->temperatureshould not be 0, which actually means 0C, and thermal trend is not available. In this case, we need specially handling for the firstthermal_zone_device_update().Both thermal core framework and
step_wisegovernor is enhanced to handle this. And since thestep_wisegovernor is the only one that uses trends, so it's the only thermal governor that needs to be updated.Quoted 9 lines
Tested-by Manuel Krause <[email protected]>Tested-by szegad <[email protected]>Tested-by prash <[email protected]>Tested-by amish <[email protected]>Tested-by Matthias <[email protected]>Reviewed-by Javi Merino <[email protected]>Signed-off-by Zhang Rui <[email protected]>Signed-off-by Chen Yu <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>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?From
81ad4276b505e987dd8ebbdf63605f92cd172b52Mon Sep 17 00:00:00 2001
From: Zhang Rui <[email protected]>
Date: Fri, 18 Mar 2016 10:03:24 +0800
Subject: [PATCH] Thermal: Ignore invalid trip pointsIn some cases, platform thermal driver may report invalid trip points, thermal core should not take any action for these trip points.
This fixed a regression that bogus trip point starts to screw up thermal control on some Lenovo laptops, after
commitbb431ba26c5cd0a17c941ca6c3a195a3a6d5d461Author: Zhang Rui <[email protected]> Date: Fri Oct 30 16:31:47 2015 +0800Thermal: initialize thermal zone device correctly
After thermal zone device registered, as we have not read any temperature before, thus
tz->temperatureshould not be 0, which actually means 0C, and thermal trend is not available. In this case, we need specially handling for the firstthermal_zone_device_update().Both thermal core framework and
step_wisegovernor is enhanced to handle this. And since thestep_wisegovernor is the only one that uses trends, so it's the only thermal governor that needs to be updated.Tested-by Manuel Krause <[email protected]>Tested-by szegad <[email protected]>Tested-by prash <[email protected]>Tested-by amish <[email protected]>Tested-by Matthias <[email protected]>Reviewed-by Javi Merino <[email protected]>Signed-off-by Zhang Rui <[email protected]>Signed-off-by Chen Yu <[email protected]>CC <[email protected]> #3.18+Signed-off-by Zhang Rui <[email protected]>--- drivers/thermal/thermal_core.c | 13 ++++++++++++- include/linux/thermal.h | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-)drivers/thermal/thermal_core.c +4
-0@@ -454,6 +454,10 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) {enum thermal_trip_type type; +/* Ignore disabled trip points */ +if (test_bit (trip, &tz->trips_disabled)) +return ; + tz->ops->get_trip_type (tz, trip, &type);if (type == THERMAL_TRIP_CRITICAL || type == THERMAL_TRIP_HOT)drivers/thermal/thermal_core.c +1
-0@@ -1800,6 +1804,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, { struct thermal_zone_device *tz; enum thermal_trip_type trip_type; + int trip_temp; int result; int count;int passive = 0;drivers/thermal/thermal_core.c +7
-1@@ -1871,9 +1876,15 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, goto unregister; for (count = 0; count < trips; count++) { - tz->ops->get_trip_type (tz, count, &trip_type); +if (tz->ops->get_trip_type (tz, count, &trip_type)) +set_bit (count, &tz->trips_disabled);if (trip_type ==THERMAL_TRIP_PASSIVE ) passive =1 ; +if (tz->ops->get_trip_temp (tz, count, &trip_temp)) +set_bit (count, &tz->trips_disabled); +/* Check for bogus trip points */ +if (trip_temp ==0 ) +set_bit (count, &tz->trips_disabled); }if (!passive) {include/linux/thermal.h +0
-0@@ -156,6 +156,7 @@ struct thermal_attr {* @trip_hyst_attrs: attributes for trip points for sysfs: trip hysteresis
* @devdata: private pointer for device private data
* @trips: number of trip points the thermal zone supports+ * @trips_disabled; bitmap for disabled trips * @passive_delay: number of milliseconds to wait between polls when * performing passive cooling. * @polling_delay: number of milliseconds to wait between polls wheninclude/linux/thermal.h +1
-1@@ -191,6 +192,7 @@ struct thermal_zone_device {struct thermal_attr *trip_hyst_attrs;void *devdata;int trips; +unsigned long trips_disabled;/* bitmap for disabled trips */ int passive_delay;int polling_delay;int temperature; --1.9.1
Hi Rui,
The patch seems to work fine! I have tried both rmmod & modprobe thermal and suspend & resume. Great!
Quoted 213 lines · Vladyslav Frolov
Hi Rui,
I'm sorry for the delay; Reading the e-mail the first time I have missed the part about the patch, so I'm building the kernel now.
By the way, the patch reported a slight offset missmatch:
patching file
drivers/thermal/thermal_core.c
Hunk #2 succeeded at 1800 (offset -4 lines).
Hunk #3 succeeded at 1872 (offset -4 lines).Is this fine?
Quoted 198 lines · Vladyslav Frolov
Hi Rui,
I'm sorry for the delay; Reading the e-mail the first time I have missed the part about the patch, so I'm building the kernel now.
By the way, the patch reported a slight offset missmatch:
patching file
drivers/thermal/thermal_core.c
Hunk #2 succeeded at 1800 (offset -4 lines).
Hunk #3 succeeded at 1872 (offset -4 lines).Is this fine?
Quoted 181 lines · Zhang Rui
Hi, all,
Quoted 29 lines · Laura Abbott
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
774ac8b7eff69e0786970157de2157e68b22f456Author: Zhang Rui <[email protected]> Date: Fri Oct 30 16:31:47 2015 +0800Thermal: initialize thermal zone device correctly
commit
bb431ba26c5cd0a17c941ca6c3a195a3a6d5d461upstream.After thermal zone device registered, as we have not read any temperature before, thus
tz->temperatureshould not be 0, which actually means 0C, and thermal trend is not available. In this case, we need specially handling for the firstthermal_zone_device_update().Both thermal core framework and
step_wisegovernor is enhanced to handle this. And since thestep_wisegovernor is the only one that uses trends, so it's the only thermal governor that needs to be updated.Quoted 9 lines
Tested-by Manuel Krause <[email protected]>Tested-by szegad <[email protected]>Tested-by prash <[email protected]>Tested-by amish <[email protected]>Tested-by Matthias <[email protected]>Reviewed-by Javi Merino <[email protected]>Signed-off-by Zhang Rui <[email protected]>Signed-off-by Chen Yu <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>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?From
81ad4276b505e987dd8ebbdf63605f92cd172b52Mon Sep 17 00:00:00 2001
From: Zhang Rui <[email protected]>
Date: Fri, 18 Mar 2016 10:03:24 +0800
Subject: [PATCH] Thermal: Ignore invalid trip pointsIn some cases, platform thermal driver may report invalid trip points, thermal core should not take any action for these trip points.
This fixed a regression that bogus trip point starts to screw up thermal control on some Lenovo laptops, after
commitbb431ba26c5cd0a17c941ca6c3a195a3a6d5d461Author: Zhang Rui <[email protected]> Date: Fri Oct 30 16:31:47 2015 +0800Thermal: initialize thermal zone device correctly
After thermal zone device registered, as we have not read any temperature before, thus
tz->temperatureshould not be 0, which actually means 0C, and thermal trend is not available. In this case, we need specially handling for the firstthermal_zone_device_update().Both thermal core framework and
step_wisegovernor is enhanced to handle this. And since thestep_wisegovernor is the only one that uses trends, so it's the only thermal governor that needs to be updated.Tested-by Manuel Krause <[email protected]>Tested-by szegad <[email protected]>Tested-by prash <[email protected]>Tested-by amish <[email protected]>Tested-by Matthias <[email protected]>Reviewed-by Javi Merino <[email protected]>Signed-off-by Zhang Rui <[email protected]>Signed-off-by Chen Yu <[email protected]>CC <[email protected]> #3.18+Signed-off-by Zhang Rui <[email protected]>--- drivers/thermal/thermal_core.c | 13 ++++++++++++- include/linux/thermal.h | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-)drivers/thermal/thermal_core.c +4
-0@@ -454,6 +454,10 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) {enum thermal_trip_type type; +/* Ignore disabled trip points */ +if (test_bit (trip, &tz->trips_disabled)) +return ; + tz->ops->get_trip_type (tz, trip, &type);if (type == THERMAL_TRIP_CRITICAL || type == THERMAL_TRIP_HOT)drivers/thermal/thermal_core.c +1
-0@@ -1800,6 +1804,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, { struct thermal_zone_device *tz; enum thermal_trip_type trip_type; + int trip_temp; int result; int count;int passive = 0;drivers/thermal/thermal_core.c +7
-1@@ -1871,9 +1876,15 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, goto unregister; for (count = 0; count < trips; count++) { - tz->ops->get_trip_type (tz, count, &trip_type); +if (tz->ops->get_trip_type (tz, count, &trip_type)) +set_bit (count, &tz->trips_disabled);if (trip_type ==THERMAL_TRIP_PASSIVE ) passive =1 ; +if (tz->ops->get_trip_temp (tz, count, &trip_temp)) +set_bit (count, &tz->trips_disabled); +/* Check for bogus trip points */ +if (trip_temp ==0 ) +set_bit (count, &tz->trips_disabled); }if (!passive) {include/linux/thermal.h +0
-0@@ -156,6 +156,7 @@ struct thermal_attr {* @trip_hyst_attrs: attributes for trip points for sysfs: trip hysteresis
* @devdata: private pointer for device private data
* @trips: number of trip points the thermal zone supports+ * @trips_disabled; bitmap for disabled trips * @passive_delay: number of milliseconds to wait between polls when * performing passive cooling. * @polling_delay: number of milliseconds to wait between polls wheninclude/linux/thermal.h +1
-1@@ -191,6 +192,7 @@ struct thermal_zone_device {struct thermal_attr *trip_hyst_attrs;void *devdata;int trips; +unsigned long trips_disabled;/* bitmap for disabled trips */ int passive_delay;int polling_delay;int temperature; --1.9.1