1
0

msm: eva: Enhance power and perf logging

Use CVP_PWR instead of CVP_PROF.
Add AON timer reading.
Avoid SSR if core init failed.

Change-Id: I1dd40edc893009a2f2794e3431bb08398ec6352b
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
Este cometimento está contido em:
George Shen
2023-05-12 20:17:31 -07:00
ascendente 36fa77e4d7
cometimento 115a7bf5c7
5 ficheiros modificados com 36 adições e 26 eliminações

Ver ficheiro

@@ -162,6 +162,15 @@ static int cvp_synx_recover(void)
#define ROW_SIZE 32 #define ROW_SIZE 32
unsigned long long get_aon_time(void)
{
unsigned long long val;
asm volatile("mrs %0, cntvct_el0" : "=r" (val));
return val;
}
int get_hfi_version(void) int get_hfi_version(void)
{ {
struct msm_cvp_core *core; struct msm_cvp_core *core;
@@ -3561,7 +3570,7 @@ static DECLARE_WORK(iris_hfi_wd_work, iris_hfi_wd_work_handler);
irqreturn_t iris_hfi_isr_wd(int irq, void *dev) irqreturn_t iris_hfi_isr_wd(int irq, void *dev)
{ {
struct iris_hfi_device *device = dev; struct iris_hfi_device *device = dev;
dprintk(CVP_ERR, "Got HW WDOG IRQ! \n"); dprintk(CVP_ERR, "Got HW WDOG IRQ at %llu! \n", get_aon_time());
disable_irq_nosync(irq); disable_irq_nosync(irq);
queue_work(device->cvp_workq, &iris_hfi_wd_work); queue_work(device->cvp_workq, &iris_hfi_wd_work);
return IRQ_HANDLED; return IRQ_HANDLED;
@@ -4910,7 +4919,6 @@ static inline int __resume(struct iris_hfi_device *device)
rc = __boot_firmware(device); rc = __boot_firmware(device);
if (rc) { if (rc) {
dprintk(CVP_ERR, "Failed to reset cvp core\n"); dprintk(CVP_ERR, "Failed to reset cvp core\n");
msm_cvp_trigger_ssr(core, SSR_ERR_FATAL);
goto err_reset_core; goto err_reset_core;
} }

Ver ficheiro

@@ -31,6 +31,9 @@ static bool is_subblock_profile_existed(struct msm_cvp_inst *inst)
inst->prop.cycles[HFI_HW_LSR]); inst->prop.cycles[HFI_HW_LSR]);
} }
static char hw_names[HFI_MAX_HW_THREADS][8] = {{"FDU"}, {"OD"}, {"MPU"}, {"ICA"},
{"VADL"}, {"TOF"}, {"RGE"}, {"XRA"},
{"LSR"}};
static void aggregate_power_update(struct msm_cvp_core *core, static void aggregate_power_update(struct msm_cvp_core *core,
struct cvp_power_level *nrt_pwr, struct cvp_power_level *nrt_pwr,
struct cvp_power_level *rt_pwr, struct cvp_power_level *rt_pwr,
@@ -57,17 +60,18 @@ static void aggregate_power_update(struct msm_cvp_core *core,
} else { } else {
i = 1; i = 1;
} }
dprintk(CVP_PROF, "pwrUpdate fdu od mpu ica vadl tof rge xra lsr\n");
for (j = 0; j < HFI_MAX_HW_THREADS; j++) for (j = 0; j < HFI_MAX_HW_THREADS; j++)
dprintk(CVP_PROF, "%u ", inst->prop.cycles[j]); if (inst->prop.cycles[j])
dprintk(CVP_PROF, "\n"); dprintk(CVP_PWR, "pwrUpdate %s %u\n",
hw_names[j], inst->prop.cycles[j]);
dprintk(CVP_PROF, "pwrUpdate fdu_o od_o ica_o mpu_o vadl_o tof_o rge_o xra_o lsr_o\n");
for (j = 0; j < HFI_MAX_HW_THREADS; j++) for (j = 0; j < HFI_MAX_HW_THREADS; j++)
dprintk(CVP_PROF, "%u ", inst->prop.op_cycles[j]); if (inst->prop.op_cycles[j])
dprintk(CVP_PROF, "\n"); dprintk(CVP_PWR, "pwrUpdate_OP %s %u\n",
hw_names[j], inst->prop.op_cycles[j]);
dprintk(CVP_PROF, " fw %u fw_o %u\n", inst->prop.fw_cycles, inst->prop.fw_op_cycles); dprintk(CVP_PWR, " fw %u fw_o %u\n", inst->prop.fw_cycles,
inst->prop.fw_op_cycles);
for (j = 0; j < HFI_MAX_HW_THREADS; j++) for (j = 0; j < HFI_MAX_HW_THREADS; j++)
blocks_sum[i][j] += inst->prop.cycles[j]; blocks_sum[i][j] += inst->prop.cycles[j];
@@ -89,20 +93,17 @@ static void aggregate_power_update(struct msm_cvp_core *core,
(op_bw_max[i] >= inst->prop.ddr_op_bw) ? (op_bw_max[i] >= inst->prop.ddr_op_bw) ?
op_bw_max[i] : inst->prop.ddr_op_bw; op_bw_max[i] : inst->prop.ddr_op_bw;
dprintk(CVP_PWR, "%s:%d - fps fdu mpu od ica vadl tof rge xra lsf\n",
__func__, __LINE__);
for (j = 0; j < HFI_MAX_HW_THREADS; j++) { for (j = 0; j < HFI_MAX_HW_THREADS; j++) {
dprintk(CVP_PWR, " %d ", inst->prop.fps[j]); if (inst->prop.fps[j])
dprintk(CVP_PWR, "fps %s %d ", hw_names[j],
inst->prop.fps[j]);
core->dyn_clk.sum_fps[j] += inst->prop.fps[j]; core->dyn_clk.sum_fps[j] += inst->prop.fps[j];
} }
dprintk(CVP_PWR, "\n");
dprintk(CVP_PWR, "%s:%d - sum_fps fdu mpu od ica vadl tof rge xra lsf\n",
__func__, __LINE__);
for (j = 0; j < HFI_MAX_HW_THREADS; j++) for (j = 0; j < HFI_MAX_HW_THREADS; j++)
dprintk(CVP_PWR, " %d ", core->dyn_clk.sum_fps[j]); if (core->dyn_clk.sum_fps[j])
dprintk(CVP_PWR, "\n"); dprintk(CVP_PWR, "sum_fps %s %d ", hw_names[j],
core->dyn_clk.sum_fps[j]);
} }
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
@@ -168,7 +169,7 @@ static int adjust_bw_freqs(void)
min_bw = max_bw/10; min_bw = max_bw/10;
aggregate_power_update(core, &nrt_pwr, &rt_pwr, cvp_max_rate); aggregate_power_update(core, &nrt_pwr, &rt_pwr, cvp_max_rate);
dprintk(CVP_PROF, "PwrUpdate nrt %u %u rt %u %u\n", dprintk(CVP_PWR, "PwrUpdate nrt %u %u rt %u %u\n",
nrt_pwr.core_sum, nrt_pwr.op_core_sum, nrt_pwr.core_sum, nrt_pwr.op_core_sum,
rt_pwr.core_sum, rt_pwr.op_core_sum); rt_pwr.core_sum, rt_pwr.op_core_sum);
@@ -201,7 +202,7 @@ static int adjust_bw_freqs(void)
bw_sum = (bw_sum > max_bw) ? max_bw : bw_sum; bw_sum = (bw_sum > max_bw) ? max_bw : bw_sum;
bw_sum = (bw_sum < min_bw) ? min_bw : bw_sum; bw_sum = (bw_sum < min_bw) ? min_bw : bw_sum;
dprintk(CVP_PROF, "%s %lld %lld\n", __func__, dprintk(CVP_PWR, "%s %lld %lld\n", __func__,
core_sum, bw_sum); core_sum, bw_sum);
if (!cl->has_scaling) { if (!cl->has_scaling) {
dprintk(CVP_ERR, "Cannot scale CVP clock\n"); dprintk(CVP_ERR, "Cannot scale CVP clock\n");

Ver ficheiro

@@ -625,7 +625,7 @@ void handle_sys_error(enum hal_command_response cmd, void *data)
if (!core->trigger_ssr) { if (!core->trigger_ssr) {
cvp_print_inst(CVP_WARN, inst); cvp_print_inst(CVP_WARN, inst);
if (hfi_device->error != CVP_ERR_NOC_ERROR) if (hfi_device->error != CVP_ERR_NOC_ERROR)
msm_cvp_print_inst_bufs(inst, false); msm_cvp_print_inst_bufs(inst, false);
} }
} }
@@ -1298,8 +1298,8 @@ void msm_cvp_ssr_handler(struct work_struct *work)
send_again: send_again:
mutex_lock(&core->lock); mutex_lock(&core->lock);
if (core->state == CVP_CORE_INIT_DONE) { if (core->state == CVP_CORE_INIT_DONE) {
dprintk(CVP_WARN, "%s: ssr type %d\n", __func__, dprintk(CVP_WARN, "%s: ssr type %d at %llu\n", __func__,
core->ssr_type); core->ssr_type, get_aon_time());
/* /*
* In current implementation user-initiated SSR triggers * In current implementation user-initiated SSR triggers
* a fatal error from hardware. However, there is no way * a fatal error from hardware. However, there is no way

Ver ficheiro

@@ -33,4 +33,5 @@ int cvp_comm_set_arp_buffers(struct msm_cvp_inst *inst);
int cvp_comm_release_persist_buffers(struct msm_cvp_inst *inst); int cvp_comm_release_persist_buffers(struct msm_cvp_inst *inst);
int msm_cvp_noc_error_info(struct msm_cvp_core *core); int msm_cvp_noc_error_info(struct msm_cvp_core *core);
int cvp_print_inst(u32 tag, struct msm_cvp_inst *inst); int cvp_print_inst(u32 tag, struct msm_cvp_inst *inst);
unsigned long long get_aon_time(void);
#endif #endif

Ver ficheiro

@@ -325,9 +325,9 @@ wait_dsp:
mutex_unlock(&inst->cvpdspbufs.lock); mutex_unlock(&inst->cvpdspbufs.lock);
if (!empty) if (!empty)
dprintk(CVP_WARN, "Failed flush DSP frame retried %d\n", dprintk(CVP_WARN, "Failed sess %pK DSP frame retried %d\n",
(inst->core->resources.msm_cvp_hw_rsp_timeout >> 5) inst,
- max_retries); (inst->core->resources.msm_cvp_hw_rsp_timeout >> 5));
max_retries = inst->core->resources.msm_cvp_hw_rsp_timeout >> 1; max_retries = inst->core->resources.msm_cvp_hw_rsp_timeout >> 1;
wait_frame: wait_frame:
mutex_lock(&inst->frames.lock); mutex_lock(&inst->frames.lock);