Loading drivers/cam_req_mgr/cam_req_mgr_core.c +50 −31 Original line number Diff line number Diff line Loading @@ -198,10 +198,16 @@ static void __cam_req_mgr_find_dev_name( if (masked_val & (1 << dev->dev_bit)) continue; if (link->wq_congestion) CAM_INFO_RATE_LIMIT(CAM_CRM, "WQ congestion, Skip Frame: req: %lld not ready on link: 0x%x for pd: %d dev: %s open_req count: %d", req_id, link->link_hdl, pd, dev->dev_info.name, link->open_req_cnt); else CAM_INFO(CAM_CRM, "Skip Frame: req: %lld not ready on link: 0x%x for pd: %d dev: %s open_req count: %d", req_id, link->link_hdl, pd, dev->dev_info.name, link->open_req_cnt); req_id, link->link_hdl, pd, dev->dev_info.name, link->open_req_cnt); } } } Loading Loading @@ -1371,18 +1377,18 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, if (slot->status == CRM_SLOT_STATUS_NO_REQ) { CAM_DBG(CAM_CRM, "No Pending req"); rc = 0; goto error; goto end; } if ((trigger != CAM_TRIGGER_POINT_SOF) && (trigger != CAM_TRIGGER_POINT_EOF)) goto error; goto end; if ((trigger == CAM_TRIGGER_POINT_EOF) && (!(link->trigger_mask & CAM_TRIGGER_POINT_SOF))) { CAM_DBG(CAM_CRM, "Applying for last SOF fails"); rc = -EINVAL; goto error; goto end; } if (trigger == CAM_TRIGGER_POINT_SOF) { Loading @@ -1393,11 +1399,19 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, link->prev_sof_timestamp = link->sof_timestamp; link->sof_timestamp = trigger_data->sof_timestamp_val; /* Check for WQ congestion */ if (jiffies_to_msecs(jiffies - link->last_sof_trigger_jiffies) < MINIMUM_WORKQUEUE_SCHED_TIME_IN_MS) link->wq_congestion = true; else link->wq_congestion = false; if (link->trigger_mask) { CAM_ERR_RATE_LIMIT(CAM_CRM, "Applying for last EOF fails"); rc = -EINVAL; goto error; goto end; } if ((slot->sync_mode == CAM_REQ_MGR_SYNC_MODE_SYNC) && Loading Loading @@ -1457,7 +1471,7 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, rc = -EPERM; } spin_unlock_bh(&link->link_state_spin_lock); goto error; goto end; } } Loading @@ -1466,6 +1480,7 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, /* Apply req failed retry at next sof */ slot->status = CRM_SLOT_STATUS_REQ_PENDING; if (!link->wq_congestion && dev) { link->retry_cnt++; if (link->retry_cnt == MAXIMUM_RETRY_ATTEMPTS) { CAM_DBG(CAM_CRM, Loading @@ -1484,6 +1499,11 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, __cam_req_mgr_notify_error_on_link(link, dev); link->retry_cnt = 0; } } else CAM_WARN_RATE_LIMIT(CAM_CRM, "workqueue congestion, last applied idx:%d rd idx:%d", in_q->last_applied_idx, in_q->rd_idx); } else { if (link->retry_cnt) link->retry_cnt = 0; Loading Loading @@ -1531,10 +1551,9 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, link->open_req_cnt--; } } mutex_unlock(&session->lock); return rc; error: end: if (trigger == CAM_TRIGGER_POINT_SOF) link->last_sof_trigger_jiffies = jiffies; mutex_unlock(&session->lock); return rc; } Loading drivers/cam_req_mgr/cam_req_mgr_core.h +6 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ #define MAXIMUM_RETRY_ATTEMPTS 2 #define MINIMUM_WORKQUEUE_SCHED_TIME_IN_MS 5 #define VERSION_1 1 #define VERSION_2 2 Loading Loading @@ -346,6 +348,8 @@ struct cam_req_mgr_connected_device { * as part of shutdown. * @sof_timestamp_value : SOF timestamp value * @prev_sof_timestamp : Previous SOF timestamp value * @last_sof_trigger_jiffies : Record the jiffies of last sof trigger jiffies * @wq_congestion : Indicates if WQ congestion is detected or not */ struct cam_req_mgr_core_link { int32_t link_hdl; Loading Loading @@ -376,6 +380,8 @@ struct cam_req_mgr_core_link { bool is_shutdown; uint64_t sof_timestamp; uint64_t prev_sof_timestamp; uint64_t last_sof_trigger_jiffies; bool wq_congestion; }; /** Loading Loading
drivers/cam_req_mgr/cam_req_mgr_core.c +50 −31 Original line number Diff line number Diff line Loading @@ -198,10 +198,16 @@ static void __cam_req_mgr_find_dev_name( if (masked_val & (1 << dev->dev_bit)) continue; if (link->wq_congestion) CAM_INFO_RATE_LIMIT(CAM_CRM, "WQ congestion, Skip Frame: req: %lld not ready on link: 0x%x for pd: %d dev: %s open_req count: %d", req_id, link->link_hdl, pd, dev->dev_info.name, link->open_req_cnt); else CAM_INFO(CAM_CRM, "Skip Frame: req: %lld not ready on link: 0x%x for pd: %d dev: %s open_req count: %d", req_id, link->link_hdl, pd, dev->dev_info.name, link->open_req_cnt); req_id, link->link_hdl, pd, dev->dev_info.name, link->open_req_cnt); } } } Loading Loading @@ -1371,18 +1377,18 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, if (slot->status == CRM_SLOT_STATUS_NO_REQ) { CAM_DBG(CAM_CRM, "No Pending req"); rc = 0; goto error; goto end; } if ((trigger != CAM_TRIGGER_POINT_SOF) && (trigger != CAM_TRIGGER_POINT_EOF)) goto error; goto end; if ((trigger == CAM_TRIGGER_POINT_EOF) && (!(link->trigger_mask & CAM_TRIGGER_POINT_SOF))) { CAM_DBG(CAM_CRM, "Applying for last SOF fails"); rc = -EINVAL; goto error; goto end; } if (trigger == CAM_TRIGGER_POINT_SOF) { Loading @@ -1393,11 +1399,19 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, link->prev_sof_timestamp = link->sof_timestamp; link->sof_timestamp = trigger_data->sof_timestamp_val; /* Check for WQ congestion */ if (jiffies_to_msecs(jiffies - link->last_sof_trigger_jiffies) < MINIMUM_WORKQUEUE_SCHED_TIME_IN_MS) link->wq_congestion = true; else link->wq_congestion = false; if (link->trigger_mask) { CAM_ERR_RATE_LIMIT(CAM_CRM, "Applying for last EOF fails"); rc = -EINVAL; goto error; goto end; } if ((slot->sync_mode == CAM_REQ_MGR_SYNC_MODE_SYNC) && Loading Loading @@ -1457,7 +1471,7 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, rc = -EPERM; } spin_unlock_bh(&link->link_state_spin_lock); goto error; goto end; } } Loading @@ -1466,6 +1480,7 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, /* Apply req failed retry at next sof */ slot->status = CRM_SLOT_STATUS_REQ_PENDING; if (!link->wq_congestion && dev) { link->retry_cnt++; if (link->retry_cnt == MAXIMUM_RETRY_ATTEMPTS) { CAM_DBG(CAM_CRM, Loading @@ -1484,6 +1499,11 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, __cam_req_mgr_notify_error_on_link(link, dev); link->retry_cnt = 0; } } else CAM_WARN_RATE_LIMIT(CAM_CRM, "workqueue congestion, last applied idx:%d rd idx:%d", in_q->last_applied_idx, in_q->rd_idx); } else { if (link->retry_cnt) link->retry_cnt = 0; Loading Loading @@ -1531,10 +1551,9 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, link->open_req_cnt--; } } mutex_unlock(&session->lock); return rc; error: end: if (trigger == CAM_TRIGGER_POINT_SOF) link->last_sof_trigger_jiffies = jiffies; mutex_unlock(&session->lock); return rc; } Loading
drivers/cam_req_mgr/cam_req_mgr_core.h +6 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ #define MAXIMUM_RETRY_ATTEMPTS 2 #define MINIMUM_WORKQUEUE_SCHED_TIME_IN_MS 5 #define VERSION_1 1 #define VERSION_2 2 Loading Loading @@ -346,6 +348,8 @@ struct cam_req_mgr_connected_device { * as part of shutdown. * @sof_timestamp_value : SOF timestamp value * @prev_sof_timestamp : Previous SOF timestamp value * @last_sof_trigger_jiffies : Record the jiffies of last sof trigger jiffies * @wq_congestion : Indicates if WQ congestion is detected or not */ struct cam_req_mgr_core_link { int32_t link_hdl; Loading Loading @@ -376,6 +380,8 @@ struct cam_req_mgr_core_link { bool is_shutdown; uint64_t sof_timestamp; uint64_t prev_sof_timestamp; uint64_t last_sof_trigger_jiffies; bool wq_congestion; }; /** Loading