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

Commit 07de3bdd authored by Shravya Samala's avatar Shravya Samala Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: req_mgr: Thread switch delay detection mechanisms



Added timestamp logic incase of thread switch.
Difference between thread scheduled and thread
triggered is compared with a threshold value.
If this difference is more than threshold value
then, thread switch delay is detected.

CRs-Fixed: 2686338
Change-Id: Icbfbd0db4600cef2e5d74d39faabff1744f88b69
Signed-off-by: default avatarShravya Samala <shravyas@codeaurora.org>
parent 588b9cbc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -434,6 +434,7 @@ struct cam_cdm_work_payload {
	uint32_t irq_status;
	uint32_t irq_data;
	int fifo_idx;
	ktime_t workq_scheduled_ts;
	struct work_struct work;
};

+6 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include "cam_cdm_hw_reg_1_2.h"
#include "cam_cdm_hw_reg_2_0.h"
#include "cam_trace.h"
#include "cam_req_mgr_workq.h"

#define CAM_CDM_BL_FIFO_WAIT_TIMEOUT 2000
#define CAM_CDM_DBG_GEN_IRQ_USR_DATA 0xff
@@ -1105,6 +1106,9 @@ static void cam_hw_cdm_work(struct work_struct *work)
			payload = NULL;
			return;
		}
		cam_req_mgr_thread_switch_delay_detect(
			payload->workq_scheduled_ts);

		CAM_DBG(CAM_CDM, "IRQ status=0x%x", payload->irq_status);
		if (payload->irq_status &
			CAM_CDM_IRQ_STATUS_INLINE_IRQ_MASK) {
@@ -1342,6 +1346,8 @@ irqreturn_t cam_hw_cdm_irq(int irq_num, void *data)
			cdm_hw->soc_info.index);

		cdm_core->bl_fifo[i].work_record++;
		payload[i]->workq_scheduled_ts = ktime_get();

		work_status = queue_work(
				cdm_core->bl_fifo[i].work_queue,
				&payload[i]->work);
+9 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/delay.h>
@@ -19,6 +19,7 @@
#include "cam_cdm_core_common.h"
#include "cam_cdm_soc.h"
#include "cam_io_util.h"
#include "cam_req_mgr_workq.h"

#define CAM_CDM_VIRTUAL_NAME "qcom,cam_virtual_cdm"

@@ -32,6 +33,10 @@ static void cam_virtual_cdm_work(struct work_struct *work)
	if (payload) {
		cdm_hw = payload->hw;
		core = (struct cam_cdm *)cdm_hw->core_info;

		cam_req_mgr_thread_switch_delay_detect(
			payload->workq_scheduled_ts);

		if (payload->irq_status & 0x2) {
			struct cam_cdm_bl_cb_request_entry *node;

@@ -183,6 +188,8 @@ int cam_virtual_cdm_submit_bl(struct cam_hw_info *cdm_hw,
					INIT_WORK((struct work_struct *)
						&payload->work,
						cam_virtual_cdm_work);
					payload->workq_scheduled_ts =
						ktime_get();
					queue_work(core->work_queue,
						&payload->work);
				}
+1 −0
Original line number Diff line number Diff line
@@ -5,5 +5,6 @@ ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_utils
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_core
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_cpas/include
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_cpas
ccflags-y += -I$(srctree)/techpack/camera/drivers/cam_req_mgr

obj-$(CONFIG_SPECTRA_CAMERA) += cam_cpastop_hw.o
+5 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include "cpastop_v480_100.h"
#include "cpastop_v540_100.h"
#include "cpastop_v520_100.h"
#include "cam_req_mgr_workq.h"

struct cam_camnoc_info *camnoc_info;

@@ -415,6 +416,9 @@ static void cam_cpastop_work(struct work_struct *work)
		return;
	}

	cam_req_mgr_thread_switch_delay_detect(
			payload->workq_scheduled_ts);

	cpas_hw = payload->hw;
	cpas_core = (struct cam_cpas *) cpas_hw->core_info;
	soc_info = &cpas_hw->soc_info;
@@ -514,6 +518,7 @@ static irqreturn_t cam_cpastop_handle_irq(int irq_num, void *data)

	cam_cpastop_reset_irq(cpas_hw);

	payload->workq_scheduled_ts = ktime_get();
	queue_work(cpas_core->work_queue, &payload->work);
done:
	atomic_dec(&cpas_core->irq_count);
Loading