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:
Shubhraprakash Das <sadas@codeaurora.org>
Loading
Please register or sign in to comment