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

Commit c81ab14e authored by Harshdeep Dhatt's avatar Harshdeep Dhatt Committed by Gerrit - the friendly Code Review server
Browse files

msm: kgsl: Don't call del_timer_sync() with spinlock



If timer handler is executing on another core and
del_timer_sync() is called then it waits for the timer
handler to finish executing. Calling this function while
holding a lock which the timer handler might also need can
lead to a deadlock.

CRs-Fixed: 883016
Change-Id: Ibb408d403f1252a184f331bb5798e85df097f6bc
Signed-off-by: default avatarHarshdeep Dhatt <hdhatt@codeaurora.org>
parent 65bdd3d2
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -428,12 +428,6 @@ static struct kgsl_cmdbatch *_get_cmdbatch(struct adreno_context *drawctxt)
		return ERR_PTR(-EAGAIN);
	}

	/*
	 * Otherwise, delete the timer to make sure it is good
	 * and dead before queuing the buffer
	 */
	del_timer_sync(&cmdbatch->timer);

	_pop_cmdbatch(drawctxt);
	return cmdbatch;
}
@@ -453,6 +447,14 @@ static struct kgsl_cmdbatch *adreno_dispatcher_get_cmdbatch(
	cmdbatch = _get_cmdbatch(drawctxt);
	spin_unlock(&drawctxt->lock);

	/*
	 * Delete the timer and wait for timer handler to finish executing
	 * on another core before queueing the buffer. We must do this
	 * without holding any spin lock that the timer handler might be using
	 */
	if (!IS_ERR_OR_NULL(cmdbatch))
		del_timer_sync(&cmdbatch->timer);

	return cmdbatch;
}