Skip to content

Commit 9e69acc

Browse files
committed
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: 7ef01f2 ("thermal/debugfs: Add thermal debugfs information for mitigation episodes") Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 1613e60 commit 9e69acc

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/thermal/thermal_debugfs.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ struct cdev_record {
9191
*
9292
* @timestamp: the trip crossing timestamp
9393
* @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
9496
* @count: the number of times the zone temperature was above the trip point
9597
* @max: maximum recorded temperature above the trip point
9698
* @min: minimum recorded temperature above the trip point
@@ -99,6 +101,8 @@ struct cdev_record {
99101
struct trip_stats {
100102
ktime_t timestamp;
101103
ktime_t duration;
104+
int trip_temp;
105+
int trip_hyst;
102106
int count;
103107
int max;
104108
int min;
@@ -574,6 +578,7 @@ void thermal_debug_tz_trip_up(struct thermal_zone_device *tz,
574578
struct thermal_debugfs *thermal_dbg = tz->debugfs;
575579
int trip_id = thermal_zone_trip_id(tz, trip);
576580
ktime_t now = ktime_get();
581+
struct trip_stats *trip_stats;
577582

578583
if (!thermal_dbg)
579584
return;
@@ -639,7 +644,10 @@ void thermal_debug_tz_trip_up(struct thermal_zone_device *tz,
639644
tz_dbg->trips_crossed[tz_dbg->nr_trips++] = trip_id;
640645

641646
tze = list_first_entry(&tz_dbg->tz_episodes, struct tz_episode, node);
642-
tze->trip_stats[trip_id].timestamp = now;
647+
trip_stats = &tze->trip_stats[trip_id];
648+
trip_stats->trip_temp = trip->temperature;
649+
trip_stats->trip_hyst = trip->hysteresis;
650+
trip_stats->timestamp = now;
643651

644652
unlock:
645653
mutex_unlock(&thermal_dbg->lock);
@@ -836,8 +844,8 @@ static int tze_seq_show(struct seq_file *s, void *v)
836844
seq_printf(s, "| %*d | %*s | %*d | %*d | %c%*lld | %*d | %*d | %*d |\n",
837845
4 , trip_id,
838846
8, type,
839-
9, trip->temperature,
840-
9, trip->hysteresis,
847+
9, trip_stats->trip_temp,
848+
9, trip_stats->trip_hyst,
841849
c, 10, duration_ms,
842850
9, trip_stats->avg,
843851
9, trip_stats->min,

0 commit comments

Comments
 (0)