From f5f9d74e97ec9e2b9931a5285267ebc784c16c7b Mon Sep 17 00:00:00 2001 From: Ravikishore Pampana Date: Wed, 30 Sep 2020 15:30:11 +0530 Subject: [PATCH] msm: camera: core: Change the error logs to rate limited In bubble cases and if not recovered, error logs causing excessive logging issues. Change the error and warn logs to rate limited in error bubble and apply failure cases. CRs-Fixed: 2785070 Change-Id: Ia7268cfc7b672c24f3161cd65c53df5ee357e7ee Signed-off-by: Ravikishore Pampana --- drivers/cam_isp/cam_isp_context.c | 44 ++++++++++++------- .../isp_hw/ife_csid_hw/cam_ife_csid_core.c | 6 ++- drivers/cam_req_mgr/cam_req_mgr_core.c | 6 +-- drivers/cam_req_mgr/cam_req_mgr_dev.c | 2 +- 4 files changed, 36 insertions(+), 22 deletions(-) diff --git a/drivers/cam_isp/cam_isp_context.c b/drivers/cam_isp/cam_isp_context.c index b967dad7c9f6..3ddf1cbd9719 100644 --- a/drivers/cam_isp/cam_isp_context.c +++ b/drivers/cam_isp/cam_isp_context.c @@ -1467,8 +1467,9 @@ static int __cam_isp_ctx_reg_upd_in_epoch_bubble_state( __cam_isp_ctx_substate_val_to_type( ctx_isp->substate_activated)); else - CAM_WARN(CAM_ISP, - "Unexpected reg update in activated Substate[%s] for frame_id:%lld", + CAM_WARN_RATE_LIMIT(CAM_ISP, + "ctx_id:%d Unexpected reg update in activated Substate[%s] for frame_id:%lld", + ctx_isp->base->ctx_id, __cam_isp_ctx_substate_val_to_type( ctx_isp->substate_activated), ctx_isp->frame_id); @@ -1761,7 +1762,7 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp, req_isp->bubble_detected = true; req_isp->reapply = true; - CAM_INFO(CAM_ISP, "ctx:%d Report Bubble flag %d req id:%lld", + CAM_INFO_RATE_LIMIT(CAM_ISP, "ctx:%d Report Bubble flag %d req id:%lld", ctx->ctx_id, req_isp->bubble_report, req->request_id); if (req_isp->bubble_report && ctx->ctx_crm_intf && ctx->ctx_crm_intf->notify_err) { @@ -1776,7 +1777,7 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp, notify.trigger = CAM_TRIGGER_POINT_SOF; notify.frame_id = ctx_isp->frame_id; notify.sof_timestamp_val = ctx_isp->sof_timestamp_val; - CAM_WARN(CAM_ISP, + CAM_WARN_RATE_LIMIT(CAM_ISP, "Notify CRM about Bubble req %lld frame %lld, ctx %u", req->request_id, ctx_isp->frame_id, ctx->ctx_id); trace_cam_log_event("Bubble", "Rcvd epoch in applied state", @@ -1965,7 +1966,7 @@ static int __cam_isp_ctx_epoch_in_bubble_applied( list); req_isp = (struct cam_isp_ctx_req *)req->req_priv; req_isp->bubble_detected = true; - CAM_INFO(CAM_ISP, "Ctx:%d Report Bubble flag %d req id:%lld", + CAM_INFO_RATE_LIMIT(CAM_ISP, "Ctx:%d Report Bubble flag %d req id:%lld", ctx->ctx_id, req_isp->bubble_report, req->request_id); req_isp->reapply = true; @@ -1982,7 +1983,7 @@ static int __cam_isp_ctx_epoch_in_bubble_applied( notify.trigger = CAM_TRIGGER_POINT_SOF; notify.frame_id = ctx_isp->frame_id; notify.sof_timestamp_val = ctx_isp->sof_timestamp_val; - CAM_WARN(CAM_REQ, + CAM_WARN_RATE_LIMIT(CAM_REQ, "Notify CRM about Bubble req_id %llu frame %lld, ctx %u", req->request_id, ctx_isp->frame_id, ctx->ctx_id); ctx->ctx_crm_intf->notify_err(¬ify); @@ -2790,7 +2791,9 @@ static int __cam_isp_ctx_apply_req_in_activated_state( struct cam_hw_config_args cfg = {0}; if (list_empty(&ctx->pending_req_list)) { - CAM_ERR(CAM_ISP, "No available request for Apply id %lld", + CAM_ERR_RATE_LIMIT(CAM_ISP, + "ctx_id:%d No available request for Apply id %lld", + ctx->ctx_id, apply->request_id); rc = -EFAULT; goto end; @@ -2805,8 +2808,9 @@ static int __cam_isp_ctx_apply_req_in_activated_state( ctx_isp = (struct cam_isp_context *) ctx->ctx_priv; if (atomic_read(&ctx_isp->process_bubble)) { - CAM_INFO(CAM_ISP, - "Processing bubble cannot apply Request Id %llu", + CAM_INFO_RATE_LIMIT(CAM_ISP, + "ctx_id:%d Processing bubble cannot apply Request Id %llu", + ctx->ctx_id, apply->request_id); rc = -EAGAIN; goto end; @@ -2814,8 +2818,9 @@ static int __cam_isp_ctx_apply_req_in_activated_state( if (apply->re_apply) if (apply->request_id <= ctx_isp->last_applied_req_id) { - CAM_INFO(CAM_ISP, - "Trying to reapply the same request %llu again", + CAM_INFO_RATE_LIMIT(CAM_ISP, + "ctx_id:%d Trying to reapply the same request %llu again", + ctx->ctx_id, apply->request_id); return 0; } @@ -2831,7 +2836,8 @@ static int __cam_isp_ctx_apply_req_in_activated_state( */ if (req->request_id != apply->request_id) { CAM_ERR_RATE_LIMIT(CAM_ISP, - "Invalid Request Id asking %llu existing %llu", + "ctx_id:%d Invalid Request Id asking %llu existing %llu", + ctx->ctx_id, apply->request_id, req->request_id); rc = -EFAULT; goto end; @@ -2844,7 +2850,7 @@ static int __cam_isp_ctx_apply_req_in_activated_state( req_isp = (struct cam_isp_ctx_req *) req->req_priv; if (ctx_isp->active_req_cnt >= 2) { - CAM_WARN(CAM_ISP, + CAM_WARN_RATE_LIMIT(CAM_ISP, "Reject apply request (id %lld) due to congestion(cnt = %d) ctx %u", req->request_id, ctx_isp->active_req_cnt, @@ -2884,7 +2890,9 @@ static int __cam_isp_ctx_apply_req_in_activated_state( rc = ctx->hw_mgr_intf->hw_config(ctx->hw_mgr_intf->hw_mgr_priv, &cfg); if (rc) { - CAM_ERR_RATE_LIMIT(CAM_ISP, "Can not apply the configuration"); + CAM_ERR_RATE_LIMIT(CAM_ISP, + "ctx_id:%d ,Can not apply the configuration", + ctx->ctx_id); } else { spin_lock_bh(&ctx->lock); ctx_isp->substate_activated = next_state; @@ -3599,7 +3607,7 @@ static int __cam_isp_ctx_rdi_only_sof_in_bubble_applied( list); req_isp = (struct cam_isp_ctx_req *)req->req_priv; req_isp->bubble_detected = true; - CAM_INFO(CAM_ISP, "Ctx:%d Report Bubble flag %d req id:%lld", + CAM_INFO_RATE_LIMIT(CAM_ISP, "Ctx:%d Report Bubble flag %d req id:%lld", ctx->ctx_id, req_isp->bubble_report, req->request_id); req_isp->reapply = true; @@ -3616,7 +3624,7 @@ static int __cam_isp_ctx_rdi_only_sof_in_bubble_applied( notify.trigger = CAM_TRIGGER_POINT_SOF; notify.frame_id = ctx_isp->frame_id; notify.sof_timestamp_val = ctx_isp->sof_timestamp_val; - CAM_WARN(CAM_ISP, + CAM_WARN_RATE_LIMIT(CAM_ISP, "Notify CRM about Bubble req %lld frame %lld ctx %u", req->request_id, ctx_isp->frame_id, @@ -3914,7 +3922,9 @@ static int __cam_isp_ctx_rdi_only_apply_req_top_state( ctx_isp->substate_activated)); if (rc) - CAM_ERR(CAM_ISP, "Apply failed in Substate[%s], rc %d", + CAM_ERR_RATE_LIMIT(CAM_ISP, + "ctx_id:%d Apply failed in Substate[%s], rc %d", + ctx->ctx_id, __cam_isp_ctx_substate_val_to_type( ctx_isp->substate_activated), rc); diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c index 1f9749b2b34a..f6f641259fd0 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c @@ -3261,7 +3261,11 @@ static int cam_ife_csid_get_time_stamp( time_stamp->boot_timestamp = csid_hw->prev_boot_timestamp + time_delta; if (time_delta == 0) - CAM_WARN(CAM_ISP, "No qtimer update"); + CAM_WARN_RATE_LIMIT(CAM_ISP, + "CSID:%d No qtimer update ts: %lld prev ts:%lld", + csid_hw->hw_intf->hw_idx, + time_stamp->time_stamp_val, + csid_hw->prev_qtimer_ts); } csid_hw->prev_qtimer_ts = time_stamp->time_stamp_val; csid_hw->prev_boot_timestamp = time_stamp->boot_timestamp; diff --git a/drivers/cam_req_mgr/cam_req_mgr_core.c b/drivers/cam_req_mgr/cam_req_mgr_core.c index ee3972096998..263d3320e774 100644 --- a/drivers/cam_req_mgr/cam_req_mgr_core.c +++ b/drivers/cam_req_mgr/cam_req_mgr_core.c @@ -320,7 +320,7 @@ static int __cam_req_mgr_notify_error_on_link( return -EINVAL; } - CAM_ERR(CAM_CRM, + CAM_ERR_RATE_LIMIT(CAM_CRM, "Notifying userspace to trigger recovery on link 0x%x for session %d", link->link_hdl, session->session_hdl); @@ -340,7 +340,7 @@ static int __cam_req_mgr_notify_error_on_link( V4L_EVENT_CAM_REQ_MGR_EVENT); if (rc) - CAM_ERR(CAM_CRM, + CAM_ERR_RATE_LIMIT(CAM_CRM, "Error in notifying recovery for session %d link 0x%x rc %d", session->session_hdl, link->link_hdl, rc); @@ -2826,7 +2826,7 @@ static int cam_req_mgr_process_trigger(void *priv, void *data) } if (link->state == CAM_CRM_LINK_STATE_ERR) - CAM_WARN(CAM_CRM, "Error recovery idx %d status %d", + CAM_WARN_RATE_LIMIT(CAM_CRM, "Error recovery idx %d status %d", in_q->rd_idx, in_q->slot[in_q->rd_idx].status); diff --git a/drivers/cam_req_mgr/cam_req_mgr_dev.c b/drivers/cam_req_mgr/cam_req_mgr_dev.c index 6043f2999323..bd5b04c923b5 100644 --- a/drivers/cam_req_mgr/cam_req_mgr_dev.c +++ b/drivers/cam_req_mgr/cam_req_mgr_dev.c @@ -240,7 +240,7 @@ static void cam_v4l2_event_queue_notify_error(const struct v4l2_event *old, ev_header->u.frame_msg.link_hdl); break; case V4L_EVENT_CAM_REQ_MGR_ERROR: - CAM_ERR(CAM_CRM, + CAM_ERR_RATE_LIMIT(CAM_CRM, "Failed to notify ERROR Sess %X ReqId %d Link %X Type %d", ev_header->session_hdl, ev_header->u.err_msg.request_id,