From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Lukasz Luba <lukasz.luba@arm.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>
Subject: [PATCH v1 5/7] thermal/debugfs: Compute maximum temperature for mitigation episode as a whole
Date: Thu, 09 May 2024 21:15:19 +0200 [thread overview]
Message-ID: <3295271.aeNJFYEL58@kreacher> (raw)
In-Reply-To: <12438864.O9o76ZdvQC@kreacher>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Notice that the maximum temperature above the trip point must be the
same for all of the trip points involved in a given mitigation episode,
so it need not be computerd for each of them separately.
It is sufficient to compute the maximum temperature for the mitigation
episode as a whole and print it accordingly, so do that.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/thermal/thermal_debugfs.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
Index: linux-pm/drivers/thermal/thermal_debugfs.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_debugfs.c
+++ linux-pm/drivers/thermal/thermal_debugfs.c
@@ -92,7 +92,6 @@ struct cdev_record {
* @timestamp: the trip crossing timestamp
* @duration: total time when the zone temperature was above the trip point
* @count: the number of times the zone temperature was above the trip point
- * @max: maximum recorded temperature above the trip point
* @min: minimum recorded temperature above the trip point
* @avg: average temperature above the trip point
*/
@@ -100,7 +99,6 @@ struct trip_stats {
ktime_t timestamp;
ktime_t duration;
int count;
- int max;
int min;
int avg;
};
@@ -115,15 +113,17 @@ struct trip_stats {
* the way up and down if there are multiple trip described in the
* firmware after the lowest temperature trip point.
*
+ * @node: a list element to be added to the list of tz events
* @timestamp: first trip point crossed the way up
* @duration: total duration of the mitigation episode
- * @node: a list element to be added to the list of tz events
+ * @max_temp: maximum zone temperature during this episode
* @trip_stats: per trip point statistics, flexible array
*/
struct tz_episode {
+ struct list_head node;
ktime_t timestamp;
ktime_t duration;
- struct list_head node;
+ int max_temp;
struct trip_stats trip_stats[];
};
@@ -557,11 +557,10 @@ static struct tz_episode *thermal_debugf
INIT_LIST_HEAD(&tze->node);
tze->timestamp = now;
tze->duration = KTIME_MIN;
+ tze->max_temp = THERMAL_TEMP_INVALID;
- for (i = 0; i < tz->num_trips; i++) {
+ for (i = 0; i < tz->num_trips; i++)
tze->trip_stats[i].min = INT_MAX;
- tze->trip_stats[i].max = INT_MIN;
- }
return tze;
}
@@ -729,11 +728,13 @@ void thermal_debug_update_trip_stats(str
tze = list_first_entry(&tz_dbg->tz_episodes, struct tz_episode, node);
+ if (tz->temperature > tze->max_temp)
+ tze->max_temp = tz->temperature;
+
for (i = 0; i < tz_dbg->nr_trips; i++) {
int trip_id = tz_dbg->trips_crossed[i];
struct trip_stats *trip_stats = &tze->trip_stats[trip_id];
- trip_stats->max = max(trip_stats->max, tz->temperature);
trip_stats->min = min(trip_stats->min, tz->temperature);
trip_stats->avg += (tz->temperature - trip_stats->avg) /
++trip_stats->count;
@@ -789,10 +790,10 @@ static int tze_seq_show(struct seq_file
c = '=';
}
- seq_printf(s, ",-Mitigation at %llums, duration%c%llums\n",
- ktime_to_ms(tze->timestamp), c, duration_ms);
+ seq_printf(s, ",-Mitigation at %llums, duration%c%llums, max. temp=%dm°C\n",
+ ktime_to_ms(tze->timestamp), c, duration_ms, tze->max_temp);
- seq_printf(s, "| trip | type | temp(m°C) | hyst(m°C) | duration(ms) | avg(m°C) | min(m°C) | max(m°C) |\n");
+ seq_printf(s, "| trip | type | temp(m°C) | hyst(m°C) | duration(ms) | avg(m°C) | min(m°C) |\n");
for_each_trip_desc(tz, td) {
const struct thermal_trip *trip = &td->trip;
@@ -814,7 +815,7 @@ static int tze_seq_show(struct seq_file
trip_stats = &tze->trip_stats[trip_id];
/* Skip trips without any stats. */
- if (trip_stats->min > trip_stats->max)
+ if (trip_stats->min == INT_MAX)
continue;
if (trip->type == THERMAL_TRIP_PASSIVE)
@@ -837,15 +838,14 @@ static int tze_seq_show(struct seq_file
c = ' ';
}
- seq_printf(s, "| %*d | %*s | %*d | %*d | %c%*lld | %*d | %*d | %*d |\n",
+ seq_printf(s, "| %*d | %*s | %*d | %*d | %c%*lld | %*d | %*d |\n",
4 , trip_id,
8, type,
9, trip->temperature,
9, trip->hysteresis,
c, 11, duration_ms,
9, trip_stats->avg,
- 9, trip_stats->min,
- 9, trip_stats->max);
+ 9, trip_stats->min);
}
return 0;
next prev parent reply other threads:[~2024-05-09 19:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-09 19:02 [PATCH v1 0/7] thermal/debugfs: Assorted improvements for the 6.11 cycle Rafael J. Wysocki
2024-05-09 19:09 ` [PATCH v1 1/7] thermal/debugfs: Use helper to update trip point overstepping duration Rafael J. Wysocki
2024-05-09 19:12 ` [PATCH v1 2/7] thermal/debugfs: Do not extend mitigation episodes beyond system resume Rafael J. Wysocki
2024-05-09 19:13 ` [PATCH v1 3/7] thermal/debugfs: Print mitigation timestamp value in milliseconds Rafael J. Wysocki
2024-05-09 19:14 ` [PATCH v1 4/7] thermal/debugfs: Fix up units in "mitigations" files Rafael J. Wysocki
2024-05-09 19:15 ` Rafael J. Wysocki [this message]
2024-05-09 19:16 ` [PATCH v1 6/7] thermal/debugfs: Move some statements from under thermal_dbg->lock Rafael J. Wysocki
2024-05-09 19:17 ` [PATCH v1 7/7] thermal: trip: Use common set of trip type names Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3295271.aeNJFYEL58@kreacher \
--to=rjw@rjwysocki.net \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox