Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb0072c0 authored by Harsh Shah's avatar Harsh Shah
Browse files

msm: camera: Rate limit several potential frequent logs



Some logs can happen frequently under certain conditions causing
CPU lockup and crash. Ratelimit these logs to avoid a crash.

Change-Id: Ib9faffc70b072d2a231083994d42f49e7660d18b
Signed-off-by: default avatarHarsh Shah <harshs@codeaurora.org>
parent 3628cce6
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -256,7 +256,7 @@ static int __cam_isp_ctx_notify_sof_in_actived_state(
		__cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id,
			CAM_REQ_MGR_SOF_EVENT_SUCCESS);
	} else {
		CAM_ERR(CAM_ISP, "Can not notify SOF to CRM");
		CAM_ERR_RATE_LIMIT(CAM_ISP, "Can not notify SOF to CRM");
		rc = -EFAULT;
	}

@@ -574,7 +574,8 @@ static int __cam_isp_ctx_handle_error(struct cam_isp_context *ctx_isp,
	 */

	if (list_empty(&ctx->active_req_list)) {
		CAM_ERR(CAM_ISP, "handling error with no active request");
		CAM_ERR_RATE_LIMIT(CAM_ISP,
			"handling error with no active request");
		rc = -EINVAL;
		goto end;
	}
@@ -588,10 +589,10 @@ static int __cam_isp_ctx_handle_error(struct cam_isp_context *ctx_isp,
		notify.req_id = req->request_id;

		ctx->ctx_crm_intf->notify_err(&notify);
		CAM_ERR(CAM_ISP, "Notify CRM about ERROR frame %lld",
		CAM_ERR_RATE_LIMIT(CAM_ISP, "Notify CRM about ERROR frame %lld",
			ctx_isp->frame_id);
	} else {
		CAM_ERR(CAM_ISP, "Can not notify ERRROR to CRM");
		CAM_ERR_RATE_LIMIT(CAM_ISP, "Can not notify ERRROR to CRM");
		rc = -EFAULT;
	}

@@ -724,7 +725,7 @@ 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(CAM_ISP, "Can not apply the configuration");
		CAM_ERR_RATE_LIMIT(CAM_ISP, "Can not apply the configuration");
	} else {
		spin_lock_bh(&ctx->lock);
		ctx_isp->substate_activated = next_state;
@@ -964,7 +965,7 @@ static int __cam_isp_ctx_rdi_only_sof_in_top_state(
		__cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id,
			CAM_REQ_MGR_SOF_EVENT_SUCCESS);
	} else {
		CAM_ERR(CAM_ISP, "Can not notify SOF to CRM");
		CAM_ERR_RATE_LIMIT(CAM_ISP, "Can not notify SOF to CRM");
	}

	if (list_empty(&ctx->active_req_list))
@@ -1883,13 +1884,15 @@ static int __cam_isp_ctx_apply_req(struct cam_context *ctx,
		rc = ctx_isp->substate_machine[ctx_isp->substate_activated].
			crm_ops.apply_req(ctx, apply);
	} else {
		CAM_ERR(CAM_ISP, "No handle function in activated substate %d",
		CAM_ERR_RATE_LIMIT(CAM_ISP,
			"No handle function in activated substate %d",
			ctx_isp->substate_activated);
		rc = -EFAULT;
	}

	if (rc)
		CAM_ERR(CAM_ISP, "Apply failed in active substate %d",
		CAM_ERR_RATE_LIMIT(CAM_ISP,
			"Apply failed in active substate %d",
			ctx_isp->substate_activated);
	return rc;
}
+15 −7
Original line number Diff line number Diff line
@@ -414,7 +414,7 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
		}
	}
	if (rc < 0) {
		CAM_ERR(CAM_CRM, "APPLY FAILED pd %d req_id %lld",
		CAM_ERR_RATE_LIMIT(CAM_CRM, "APPLY FAILED pd %d req_id %lld",
			dev->dev_info.p_delay, apply_req.request_id);
		/* Apply req failed notify already applied devs */
		for (; i >= 0; i--) {
@@ -525,7 +525,8 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,

	if (trigger == CAM_TRIGGER_POINT_SOF) {
		if (link->trigger_mask) {
			CAM_ERR(CAM_CRM, "Applying for last EOF fails");
			CAM_ERR_RATE_LIMIT(CAM_CRM,
				"Applying for last EOF fails");
			return -EINVAL;
		}
		rc = __cam_req_mgr_check_link_is_ready(link, slot->idx);
@@ -542,7 +543,7 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
				 * ready, don't expect to enter here.
				 * @TODO: gracefully handle if recovery fails.
				 */
				CAM_ERR(CAM_CRM,
				CAM_ERR_RATE_LIMIT(CAM_CRM,
					"FATAL recovery cant finish idx %d status %d",
					in_q->rd_idx,
					in_q->slot[in_q->rd_idx].status);
@@ -1178,7 +1179,7 @@ int cam_req_mgr_process_add_req(void *priv, void *data)
		}
	}
	if (!tbl) {
		CAM_ERR(CAM_CRM, "dev_hdl not found %x, %x %x",
		CAM_ERR_RATE_LIMIT(CAM_CRM, "dev_hdl not found %x, %x %x",
			add_req->dev_hdl,
			link->l_dev[0].dev_hdl,
			link->l_dev[1].dev_hdl);
@@ -1267,7 +1268,8 @@ int cam_req_mgr_process_error(void *priv, void *data)
	if (err_info->error == CRM_KMD_ERR_BUBBLE) {
		idx = __cam_req_mgr_find_slot_for_req(in_q, err_info->req_id);
		if (idx < 0) {
			CAM_ERR(CAM_CRM, "req_id %lld not found in input queue",
			CAM_ERR_RATE_LIMIT(CAM_CRM,
				"req_id %lld not found in input queue",
				err_info->req_id);
		} else {
			CAM_DBG(CAM_CRM, "req_id %lld found at idx %d",
@@ -1377,6 +1379,12 @@ static int cam_req_mgr_process_trigger(void *priv, void *data)
		__cam_req_mgr_inc_idx(&in_q->rd_idx, 1, in_q->num_slots);
	}
	rc = __cam_req_mgr_process_req(link, trigger_data->trigger);
	if (rc)
		CAM_ERR_RATE_LIMIT(CAM_CRM,
			"link_hdl %x frame_id %lld, trigger %x\n",
			trigger_data->link_hdl,
			trigger_data->frame_id,
			trigger_data->trigger);
	mutex_unlock(&link->req.lock);

end:
@@ -1430,7 +1438,7 @@ static int cam_req_mgr_cb_add_req(struct cam_req_mgr_add_request *add_req)

	task = cam_req_mgr_workq_get_task(link->workq);
	if (!task) {
		CAM_ERR(CAM_CRM, "no empty task dev %x req %lld",
		CAM_ERR_RATE_LIMIT(CAM_CRM, "no empty task dev %x req %lld",
			add_req->dev_hdl, add_req->req_id);
		rc = -EBUSY;
		goto end;
+5 −5
Original line number Diff line number Diff line
@@ -203,29 +203,29 @@ void *cam_get_device_priv(int32_t dev_hdl)

	spin_lock_bh(&hdl_tbl_lock);
	if (!hdl_tbl) {
		CAM_ERR(CAM_CRM, "Hdl tbl is NULL");
		CAM_ERR_RATE_LIMIT(CAM_CRM, "Hdl tbl is NULL");
		goto device_priv_fail;
	}

	idx = CAM_REQ_MGR_GET_HDL_IDX(dev_hdl);
	if (idx >= CAM_REQ_MGR_MAX_HANDLES) {
		CAM_ERR(CAM_CRM, "Invalid idx");
		CAM_ERR_RATE_LIMIT(CAM_CRM, "Invalid idx");
		goto device_priv_fail;
	}

	if (hdl_tbl->hdl[idx].state != HDL_ACTIVE) {
		CAM_ERR(CAM_CRM, "Invalid state");
		CAM_ERR_RATE_LIMIT(CAM_CRM, "Invalid state");
		goto device_priv_fail;
	}

	type = CAM_REQ_MGR_GET_HDL_TYPE(dev_hdl);
	if (HDL_TYPE_DEV != type && HDL_TYPE_SESSION != type) {
		CAM_ERR(CAM_CRM, "Invalid type");
		CAM_ERR_RATE_LIMIT(CAM_CRM, "Invalid type");
		goto device_priv_fail;
	}

	if (hdl_tbl->hdl[idx].hdl_value != dev_hdl) {
		CAM_ERR(CAM_CRM, "Invalid hdl");
		CAM_ERR_RATE_LIMIT(CAM_CRM, "Invalid hdl");
		goto device_priv_fail;
	}