Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thermal/debugfs: Print initial trip temperature and hysteresis in tze_seq_show()

The temperature and hysteresis of a trip point may change during a
mitigation episode it is involved in (it may even become invalid
altogether), so in order to avoid possible confusion related to that,
store the temperature and hysteresis of trip points at the time they
are crossed on the way up and print those values instead of their
current temperature and hysteresis.

Fixes: 7ef01f228c9f ("thermal/debugfs: Add thermal debugfs information for mitigation episodes")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

+11 -3
+11 -3
drivers/thermal/thermal_debugfs.c
··· 91 91 * 92 92 * @timestamp: the trip crossing timestamp 93 93 * @duration: total time when the zone temperature was above the trip point 94 + * @trip_temp: trip temperature at mitigation start 95 + * @trip_hyst: trip hysteresis at mitigation start 94 96 * @count: the number of times the zone temperature was above the trip point 95 97 * @max: maximum recorded temperature above the trip point 96 98 * @min: minimum recorded temperature above the trip point ··· 101 99 struct trip_stats { 102 100 ktime_t timestamp; 103 101 ktime_t duration; 102 + int trip_temp; 103 + int trip_hyst; 104 104 int count; 105 105 int max; 106 106 int min; ··· 578 574 struct thermal_debugfs *thermal_dbg = tz->debugfs; 579 575 int trip_id = thermal_zone_trip_id(tz, trip); 580 576 ktime_t now = ktime_get(); 577 + struct trip_stats *trip_stats; 581 578 582 579 if (!thermal_dbg) 583 580 return; ··· 644 639 tz_dbg->trips_crossed[tz_dbg->nr_trips++] = trip_id; 645 640 646 641 tze = list_first_entry(&tz_dbg->tz_episodes, struct tz_episode, node); 647 - tze->trip_stats[trip_id].timestamp = now; 642 + trip_stats = &tze->trip_stats[trip_id]; 643 + trip_stats->trip_temp = trip->temperature; 644 + trip_stats->trip_hyst = trip->hysteresis; 645 + trip_stats->timestamp = now; 648 646 649 647 unlock: 650 648 mutex_unlock(&thermal_dbg->lock); ··· 844 836 seq_printf(s, "| %*d | %*s | %*d | %*d | %c%*lld | %*d | %*d | %*d |\n", 845 837 4 , trip_id, 846 838 8, type, 847 - 9, trip->temperature, 848 - 9, trip->hysteresis, 839 + 9, trip_stats->trip_temp, 840 + 9, trip_stats->trip_hyst, 849 841 c, 10, duration_ms, 850 842 9, trip_stats->avg, 851 843 9, trip_stats->min,