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

thermal: trace: Trace when temperature is above a trip point

Create a new event to trace when the temperature is above a trip
point. Use the trace-point when handling non-critical and critical
trip pionts.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>

authored by

Punit Agrawal and committed by
Eduardo Valentin
208cd822 39811569

+44 -1
+12
drivers/thermal/fair_share.c
··· 23 23 */ 24 24 25 25 #include <linux/thermal.h> 26 + #include <trace/events/thermal.h> 26 27 27 28 #include "thermal_core.h" 28 29 ··· 35 34 { 36 35 int count = 0; 37 36 unsigned long trip_temp; 37 + enum thermal_trip_type trip_type; 38 38 39 39 if (tz->trips == 0 || !tz->ops->get_trip_temp) 40 40 return 0; ··· 45 43 if (tz->temperature < trip_temp) 46 44 break; 47 45 } 46 + 47 + /* 48 + * count > 0 only if temperature is greater than first trip 49 + * point, in which case, trip_point = count - 1 50 + */ 51 + if (count > 0) { 52 + tz->ops->get_trip_type(tz, count - 1, &trip_type); 53 + trace_thermal_zone_trip(tz, count - 1, trip_type); 54 + } 55 + 48 56 return count; 49 57 } 50 58
+4 -1
drivers/thermal/step_wise.c
··· 23 23 */ 24 24 25 25 #include <linux/thermal.h> 26 + #include <trace/events/thermal.h> 26 27 27 28 #include "thermal_core.h" 28 29 ··· 130 129 131 130 trend = get_tz_trend(tz, trip); 132 131 133 - if (tz->temperature >= trip_temp) 132 + if (tz->temperature >= trip_temp) { 134 133 throttle = true; 134 + trace_thermal_zone_trip(tz, trip, trip_type); 135 + } 135 136 136 137 dev_dbg(&tz->device, "Trip%d[type=%d,temp=%ld]:trend=%d,throttle=%d\n", 137 138 trip, trip_type, trip_temp, trend, throttle);
+2
drivers/thermal/thermal_core.c
··· 371 371 if (tz->temperature < trip_temp) 372 372 return; 373 373 374 + trace_thermal_zone_trip(tz, trip, trip_type); 375 + 374 376 if (tz->ops->notify) 375 377 tz->ops->notify(tz, trip, trip_type); 376 378
+26
include/trace/events/thermal.h
··· 51 51 TP_printk("type=%s target=%lu", __get_str(type), __entry->target) 52 52 ); 53 53 54 + TRACE_EVENT(thermal_zone_trip, 55 + 56 + TP_PROTO(struct thermal_zone_device *tz, int trip, 57 + enum thermal_trip_type trip_type), 58 + 59 + TP_ARGS(tz, trip, trip_type), 60 + 61 + TP_STRUCT__entry( 62 + __string(thermal_zone, tz->type) 63 + __field(int, id) 64 + __field(int, trip) 65 + __field(enum thermal_trip_type, trip_type) 66 + ), 67 + 68 + TP_fast_assign( 69 + __assign_str(thermal_zone, tz->type); 70 + __entry->id = tz->id; 71 + __entry->trip = trip; 72 + __entry->trip_type = trip_type; 73 + ), 74 + 75 + TP_printk("thermal_zone=%s id=%d trip=%d trip_type=%d", 76 + __get_str(thermal_zone), __entry->id, __entry->trip, 77 + __entry->trip_type) 78 + ); 79 + 54 80 #endif /* _TRACE_THERMAL_H */ 55 81 56 82 /* This part must be outside protection */