msm: thermal: Add ftrace to KTM progressive mitigation
Add ftrace events for KTM progressive algorithm mitigation. Below ftrace events are added to KTM, thermal_progressive_sampling thermal_progressive_state thermal_progressive_mitigate Change-Id: Iec8a3a62f5655a59901ebaf744233457c22c84a5 Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
This commit is contained in:
parent
e7714e85c9
commit
abe105f868
|
@ -72,6 +72,8 @@
|
|||
#define MSM_THERMAL_THRESH_UPDATE "update"
|
||||
#define DEVM_NAME_MAX 30
|
||||
#define MAX_CPU_NAME 10
|
||||
#define OVERALL_TYPE "Overall"
|
||||
#define INDIVIDUAL_TYPE "Individual"
|
||||
|
||||
#define VALIDATE_AND_SET_MASK(_node, _key, _mask, _cpu) \
|
||||
do { \
|
||||
|
@ -3271,6 +3273,9 @@ static void do_prog_freq_control(struct thermal_progressive_rule *prog,
|
|||
temp, ret);
|
||||
return;
|
||||
}
|
||||
trace_thermal_progressive_mitigate(prog->sensor_info->name,
|
||||
cluster_ptr ? cluster_ptr->cluster_id : 0,
|
||||
freq_table[idx].frequency);
|
||||
pr_debug("Sensor:%s Limiting Cluster%d max frequency to %u. Temp:%ld\n",
|
||||
prog->sensor_info->name, cluster_ptr->cluster_id,
|
||||
freq_table[idx].frequency, temp);
|
||||
|
@ -3946,15 +3951,33 @@ static void msm_prog_freq_notify(struct therm_threshold *trig_thresh)
|
|||
switch (prog->overall_prog_state) {
|
||||
case MSM_THERM_PROGRESSIVE_SAMPLING:
|
||||
do_prog_freq_control(prog, prog_thresh->curr_max_temp);
|
||||
if (prog->cur_freq_idx == prog->freq_idx_high)
|
||||
if (prog->cur_freq_idx == prog->freq_idx_high) {
|
||||
prog->overall_prog_state =
|
||||
MSM_THERM_PROGRESSIVE_PAUSED;
|
||||
trace_thermal_progressive_state(
|
||||
prog->sensor_info->name, OVERALL_TYPE,
|
||||
prog->overall_prog_state);
|
||||
pr_debug("sensor=%s type=%s curr_state=%s\n",
|
||||
prog->sensor_info->name, OVERALL_TYPE,
|
||||
prog->overall_prog_state ?
|
||||
(prog->overall_prog_state == 1 ?
|
||||
"paused" : "monitor") : "sampling");
|
||||
}
|
||||
break;
|
||||
case MSM_THERM_PROGRESSIVE_MONITOR:
|
||||
do_prog_freq_control(prog, prog_thresh->curr_max_temp);
|
||||
if (prog->cur_freq_idx != prog->freq_idx_high)
|
||||
if (prog->cur_freq_idx != prog->freq_idx_high) {
|
||||
prog->overall_prog_state =
|
||||
MSM_THERM_PROGRESSIVE_SAMPLING;
|
||||
trace_thermal_progressive_state(
|
||||
prog->sensor_info->name, OVERALL_TYPE,
|
||||
prog->overall_prog_state);
|
||||
pr_debug("sensor=%s type=%s curr_state=%s\n",
|
||||
prog->sensor_info->name, OVERALL_TYPE,
|
||||
prog->overall_prog_state ?
|
||||
(prog->overall_prog_state == 1 ?
|
||||
"paused" : "monitor") : "sampling");
|
||||
}
|
||||
break;
|
||||
case MSM_THERM_PROGRESSIVE_PAUSED:
|
||||
break;
|
||||
|
@ -4117,6 +4140,9 @@ static void msm_progressive_monitor(struct work_struct *work)
|
|||
pr_debug("Sensor:%d temp:%ld polling_delay_ms:%d\n",
|
||||
sensor_data->sensor_id, temp, prog->polling_delay_ms);
|
||||
|
||||
trace_thermal_progressive_sampling(prog->sensor_info->name,
|
||||
temp);
|
||||
|
||||
switch (sensor_data->prog_state) {
|
||||
case MSM_THERM_PROGRESSIVE_SAMPLING:
|
||||
case MSM_THERM_PROGRESSIVE_PAUSED:
|
||||
|
@ -4147,6 +4173,9 @@ static void msm_progressive_monitor(struct work_struct *work)
|
|||
sensor_data->sensor_id);
|
||||
break;
|
||||
}
|
||||
trace_thermal_progressive_state(
|
||||
prog->sensor_info->name, INDIVIDUAL_TYPE,
|
||||
sensor_data->prog_state);
|
||||
|
||||
if (sensor_data->prog_trip_clear) {
|
||||
sensor_mgr_set_threshold(sensor_data->sensor_id,
|
||||
|
@ -4166,6 +4195,12 @@ static void msm_progressive_monitor(struct work_struct *work)
|
|||
new_prog_state = MSM_THERM_PROGRESSIVE_PAUSED;
|
||||
|
||||
start_sampling:
|
||||
trace_thermal_progressive_state(
|
||||
prog->sensor_info->name, OVERALL_TYPE, new_prog_state);
|
||||
pr_debug("sensor=%s type=%s curr_state=%s\n",
|
||||
prog->sensor_info->name, OVERALL_TYPE, new_prog_state ?
|
||||
(new_prog_state == 1 ? "paused" : "monitor") : "sampling");
|
||||
|
||||
prog->overall_prog_state = new_prog_state;
|
||||
prog_thresh->thresh_list[0].notify(&prog_thresh->thresh_list[0]);
|
||||
|
||||
|
|
|
@ -155,6 +155,93 @@ DEFINE_EVENT(msm_lmh_print_event, lmh_event_call,
|
|||
|
||||
#elif defined(TRACE_MSM_THERMAL)
|
||||
|
||||
DECLARE_EVENT_CLASS(msm_thermal_progressive_sampling,
|
||||
|
||||
TP_PROTO(const char *sensor, long temp),
|
||||
|
||||
TP_ARGS(sensor, temp),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__string(_name, sensor)
|
||||
__field(long, temp)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__assign_str(_name, sensor);
|
||||
__entry->temp = temp;
|
||||
),
|
||||
|
||||
TP_printk("prog_sampling:sensor=%s temp=%ld",
|
||||
__get_str(_name), __entry->temp)
|
||||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(msm_thermal_progressive_state,
|
||||
|
||||
TP_PROTO(const char *sensor, const char *type, int curr_state),
|
||||
|
||||
TP_ARGS(sensor, type, curr_state),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__string(_name, sensor)
|
||||
__string(_type, type)
|
||||
__field(int, curr_state)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__assign_str(_name, sensor);
|
||||
__assign_str(_type, type);
|
||||
__entry->curr_state = curr_state;
|
||||
),
|
||||
|
||||
TP_printk("prog_state:sensor=%s type=%s curr_state=%s",
|
||||
__get_str(_name), __get_str(_type),
|
||||
__entry->curr_state ? (__entry->curr_state == 1 ?
|
||||
"paused" : "monitor") : "sampling")
|
||||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(msm_thermal_progressive_mitigate,
|
||||
|
||||
TP_PROTO(const char *sensor, unsigned int cluster, unsigned int freq),
|
||||
|
||||
TP_ARGS(sensor, cluster, freq),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__string(_name, sensor)
|
||||
__field(unsigned int, cluster)
|
||||
__field(unsigned int, freq)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__assign_str(_name, sensor);
|
||||
__entry->cluster = cluster;
|
||||
__entry->freq = freq;
|
||||
),
|
||||
|
||||
TP_printk("prog_mitigate:sensor=%s device=cluster%u freq=%u",
|
||||
__get_str(_name), __entry->cluster, __entry->freq)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(msm_thermal_progressive_sampling, thermal_progressive_sampling,
|
||||
|
||||
TP_PROTO(const char *sensor, long temp),
|
||||
|
||||
TP_ARGS(sensor, temp)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(msm_thermal_progressive_state, thermal_progressive_state,
|
||||
|
||||
TP_PROTO(const char *sensor, const char *type, int curr_state),
|
||||
|
||||
TP_ARGS(sensor, type, curr_state)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(msm_thermal_progressive_mitigate, thermal_progressive_mitigate,
|
||||
|
||||
TP_PROTO(const char *sensor, unsigned int cluster, unsigned int freq),
|
||||
|
||||
TP_ARGS(sensor, cluster, freq)
|
||||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(msm_thermal_post_core_ctl,
|
||||
|
||||
TP_PROTO(unsigned int cpu, unsigned int online),
|
||||
|
|
Loading…
Reference in New Issue