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

Commit 89610654 authored by Ramesh V's avatar Ramesh V
Browse files

msm: camera: avoid race condition while configuring ping pong buffer



Issue) Deadlock occur when cfg_ping_pong function called from
two different cores, since one core is trying to acquire the
lock for vfe1 which is hold by anoter core and another core
is trying to acquire the vfe0 lock hold by actual core, which
leads deadlock.
Resolution) To avoid this will make a common lock for both
vfe.

Change-Id: I2d2480154f1c9e00910620e1a749bb49b5eca955
Signed-off-by: default avatarRamesh V <ramev@codeaurora.org>
parent 02f0c5a1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -499,6 +499,7 @@ static int vfe_probe(struct platform_device *pdev)
	vfe_parent_dev->common_sd->common_data = &vfe_common_data;
	memset(&vfe_common_data, 0, sizeof(vfe_common_data));
	spin_lock_init(&vfe_common_data.common_dev_data_lock);
	spin_lock_init(&vfe_common_data.common_dev_axi_lock);

	of_property_read_u32(pdev->dev.of_node,
		"num_child", &vfe_parent_dev->num_hw_sd);
+1 −0
Original line number Diff line number Diff line
@@ -682,6 +682,7 @@ struct master_slave_resource_info {

struct msm_vfe_common_dev_data {
	spinlock_t common_dev_data_lock;
	spinlock_t common_dev_axi_lock;
	struct dual_vfe_resource *dual_vfe_res;
	struct master_slave_resource_info ms_resource;
};
+4 −8
Original line number Diff line number Diff line
@@ -1870,10 +1870,8 @@ static int msm_isp_cfg_ping_pong_address(struct vfe_device *vfe_dev,
			for (vfe_id = 0; vfe_id < MAX_VFE; vfe_id++) {
				if (vfe_id != vfe_dev->pdev->id)
					spin_lock_irqsave(
						&dual_vfe_res->
						axi_data[vfe_id]->
						stream_info[stream_idx].
						lock, flags);
						&vfe_dev->common_data->
						common_dev_axi_lock, flags);

				if (buf)
					vfe_dev->hw_info->vfe_ops.axi_ops.
@@ -1902,10 +1900,8 @@ static int msm_isp_cfg_ping_pong_address(struct vfe_device *vfe_dev,
				}
				if (vfe_id != vfe_dev->pdev->id)
					spin_unlock_irqrestore(
						&dual_vfe_res->
						axi_data[vfe_id]->
						stream_info[stream_idx].
						lock, flags);
						&vfe_dev->common_data->
						common_dev_axi_lock, flags);
			}
		} else {
			if (buf)