소스 검색

msm: camera: reqmgr: Do not add session lock for sending req

The process_req is locked by session lock, then sub devices
on different links can't apply setting concurrently, it will
affect the performance for per frame req applying on bokeh
mode. This change removes the session lock for sending req
and adds it only for checking req ready.

CRs-Fixed: 3292804
Change-Id: I97025774ddb5f89fcc3a3d596921e1240a2d464c
Signed-off-by: Depeng Shao <[email protected]>
Depeng Shao 2 년 전
부모
커밋
5f27447b24
2개의 변경된 파일14개의 추가작업 그리고 3개의 파일을 삭제
  1. 13 3
      drivers/cam_req_mgr/cam_req_mgr_core.c
  2. 1 0
      drivers/cam_req_mgr/cam_req_mgr_core.h

+ 13 - 3
drivers/cam_req_mgr/cam_req_mgr_core.c

@@ -69,6 +69,7 @@ void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link)
 	link->last_sof_trigger_jiffies = 0;
 	link->wq_congestion = false;
 	link->try_for_internal_recovery = false;
+	link->is_sending_req = false;
 	atomic_set(&link->eof_event_cnt, 0);
 	link->properties_mask = CAM_LINK_PROPERTY_NONE;
 	__cam_req_mgr_reset_apply_data(link);
@@ -1760,8 +1761,8 @@ static int __cam_req_mgr_check_sync_req_is_ready(
 				"sync link %x too quickly, skip next frame of sync link",
 				sync_link->link_hdl);
 			link->sync_link_sof_skip = true;
-		} else if (sync_link->req.in_q->slot[sync_slot_idx].status !=
-			CRM_SLOT_STATUS_REQ_APPLIED) {
+		} else if ((sync_link->req.in_q->slot[sync_slot_idx].status !=
+			CRM_SLOT_STATUS_REQ_APPLIED) && !sync_link->is_sending_req) {
 			CAM_DBG(CAM_CRM,
 				"link %x other not applied", link->link_hdl);
 			return -EAGAIN;
@@ -2125,20 +2126,24 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
 			spin_unlock_bh(&link->link_state_spin_lock);
 			__cam_req_mgr_notify_frame_skip(link, trigger);
 			__cam_req_mgr_validate_crm_wd_timer(link);
-			goto end;
+			mutex_unlock(&session->lock);
+			return rc;
 		} else {
 			slot->status = CRM_SLOT_STATUS_REQ_READY;
+			link->is_sending_req = true;
 			CAM_DBG(CAM_REQ,
 				"linx_hdl %x Req[%lld] idx %d ready to apply",
 				link->link_hdl, in_q->slot[in_q->rd_idx].req_id,
 				in_q->rd_idx);
 		}
 	}
+	mutex_unlock(&session->lock);
 
 	rc = __cam_req_mgr_send_req(link, link->req.in_q, trigger, &dev);
 	if (rc < 0) {
 		/* Apply req failed retry at next sof */
 		slot->status = CRM_SLOT_STATUS_REQ_PENDING;
+		link->is_sending_req = false;
 
 		if (!link->wq_congestion && dev) {
 			if (rc != -EAGAIN)
@@ -2234,7 +2239,11 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
 				in_q->num_slots);
 			__cam_req_mgr_reset_req_slot(link, idx);
 		}
+		link->is_sending_req = false;
 	}
+
+	return rc;
+
 end:
 	mutex_unlock(&session->lock);
 	return rc;
@@ -2659,6 +2668,7 @@ static struct cam_req_mgr_core_link *__cam_req_mgr_reserve_link(
 	in_q->num_slots = 0;
 	link->state = CAM_CRM_LINK_STATE_IDLE;
 	link->parent = (void *)session;
+	link->is_sending_req = false;
 
 	for (i = 0; i < MAXIMUM_LINKS_PER_SESSION - 1; i++)
 		link->sync_link[i] = NULL;

+ 1 - 0
drivers/cam_req_mgr/cam_req_mgr_core.h

@@ -450,6 +450,7 @@ struct cam_req_mgr_core_link {
 	uint64_t                             last_sof_trigger_jiffies;
 	bool                                 wq_congestion;
 	bool                                 try_for_internal_recovery;
+	bool                                 is_sending_req;
 	uint32_t                             properties_mask;
 };