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

Skip to content
Commit ad3d4f51 authored by Shubhraprakash Das's avatar Shubhraprakash Das Committed by Gerrit - the friendly Code Review server
Browse files

msm: kgsl: Prevent spin lock deadlock



A spinlock deadlock can occur between the spinlock in drawctxt
and the spinlock in cmdbatch. Two thread traces that can cause
deadlock are:

1. _kgsl_cmdbatch_timer(gets spin_lock(&cmdbatch->lock))-
>kgsl_sync_fence_log->sync_fence_log->sync_pt_log-
>kgsl_sync_pt_log->kgsl_context_dump-
>adreno_drawctxt_dump(gets spin_lock(&drawctxt->lock))

2. sync_fence_wait->sync_fence_log->sync_pt_log->kgsl_sync_pt_log-
>kgsl_context_dump-
>adreno_drawctxt_dump(gets spin_lock(&drawctxt->lock) and
then tries to get spin_lock(&cmdbatch->lock))

In thread 1 above it gets spin_lock(&cmdbatch->lock) first and then
spin_lock(&drawctxt->lock) where as thread 2 takes
spin_lock(&drawctxt->lock) first followed by spin_lock(&cmdbatch->lock)
which can cause a deadlock since the 2 threads are not taking the
locks in same order.

Fix is to make thread 1 take spin_lock(&drawctxt->lock) before
spin_lock(&cmdbatch->lock).

Change-Id: I50304f3db31466ca9b7acc910d66228c53bb30a8
CRs-Fixed: 786667
Signed-off-by: default avatarShubhraprakash Das <sadas@codeaurora.org>
parent 1e4518fa
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment