]> git.hungrycats.org Git - linux/commit
thermal/debugfs: Avoid excessive updates of trip point statistics
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 17 Apr 2024 13:09:46 +0000 (15:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 May 2024 07:49:15 +0000 (09:49 +0200)
commit3463efd7d6e423a495f8e322553af702d89fb1c3
tree2a12f1eba9475dbb1125258e288bd0812be6ccc8
parenta56965e24c7f19caee9d233a96eca87192e0b610
thermal/debugfs: Avoid excessive updates of trip point statistics

[ Upstream commit 0a293c77580581c4b058eb40287acadac6ffd14a ]

Since thermal_debug_update_temp() is called before invoking
thermal_debug_tz_trip_down() for the trips that were crossed by the
zone temperature on the way up, it updates the statistics for them
as though the current zone temperature was above the low temperature
of each of them.  However, if a given trip has just been crossed on the
way down, the zone temperature is in fact below its low temperature,
but this is handled by thermal_debug_tz_trip_down() running after the
update of the trip statistics.

The remedy is to call thermal_debug_update_temp() after
thermal_debug_tz_trip_down() has been invoked for all of the
trips in question, but then thermal_debug_tz_trip_up() needs to
be adjusted, so it does not update the statistics for the trips
that has just been crossed on the way up, as that will be taken
care of by thermal_debug_update_temp() down the road.

Modify the code accordingly.

Fixes: 7ef01f228c9f ("thermal/debugfs: Add thermal debugfs information for mitigation episodes")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/thermal/thermal_core.c
drivers/thermal/thermal_debugfs.c