Przeglądaj źródła

Merge "msm: camera: ope: Handle race while dumping ope req list" into camera-kernel.lnx.4.0

Camera Software Integration 4 lat temu
rodzic
commit
f65a144b8c
1 zmienionych plików z 8 dodań i 0 usunięć
  1. 8 0
      drivers/cam_ope/ope_hw_mgr/cam_ope_hw_mgr.c

+ 8 - 0
drivers/cam_ope/ope_hw_mgr/cam_ope_hw_mgr.c

@@ -43,6 +43,8 @@
 
 static struct cam_ope_hw_mgr *ope_hw_mgr;
 
+static int cam_ope_req_timer_reset(struct cam_ope_ctx *ctx_data);
+
 static int cam_ope_mgr_get_rsc_idx(struct cam_ope_ctx *ctx_data,
 	struct ope_io_buf_info *in_io_buf)
 {
@@ -125,6 +127,8 @@ static int cam_ope_mgr_process_cmd(void *priv, void *data)
 	if (task_data->req_id > ctx_data->last_flush_req)
 		ctx_data->last_flush_req = 0;
 
+	cam_ope_req_timer_reset(ctx_data);
+
 	rc = cam_cdm_submit_bls(ctx_data->ope_cdm.cdm_handle, cdm_cmd);
 
 	if (!rc)
@@ -3639,6 +3643,7 @@ static int cam_ope_mgr_hw_dump(void *hw_priv, void *hw_dump_args)
 	}
 
 	mutex_lock(&hw_mgr->hw_mgr_mutex);
+	mutex_lock(&ctx_data->ctx_mutex);
 
 	CAM_INFO(CAM_OPE, "Req %lld", dump_args->request_id);
 	for (idx = 0; idx < CAM_CTX_REQ_MAX; idx++) {
@@ -3652,6 +3657,7 @@ static int cam_ope_mgr_hw_dump(void *hw_priv, void *hw_dump_args)
 
 	/* no matching request found */
 	if (idx == CAM_CTX_REQ_MAX) {
+		mutex_unlock(&ctx_data->ctx_mutex);
 		mutex_unlock(&hw_mgr->hw_mgr_mutex);
 		return 0;
 	}
@@ -3669,6 +3675,7 @@ static int cam_ope_mgr_hw_dump(void *hw_priv, void *hw_dump_args)
 			req_ts.tv_nsec/NSEC_PER_USEC,
 			cur_ts.tv_sec,
 			cur_ts.tv_nsec/NSEC_PER_USEC);
+		mutex_unlock(&ctx_data->ctx_mutex);
 		mutex_unlock(&hw_mgr->hw_mgr_mutex);
 		return 0;
 	}
@@ -3680,6 +3687,7 @@ static int cam_ope_mgr_hw_dump(void *hw_priv, void *hw_dump_args)
 		cur_ts.tv_sec,
 		cur_ts.tv_nsec/NSEC_PER_USEC);
 
+	mutex_unlock(&ctx_data->ctx_mutex);
 	mutex_unlock(&hw_mgr->hw_mgr_mutex);
 	return 0;
 }