msm: kgsl: Check whether context is detached before updating timestamp
When context is detached there is a wait for the last timestamp used by the context. This is done under the assumption that after this timestamp there will be no commands in the pipeline that are submitted on behalf of this context. However, the dispatcher can still dispatch commands from the detached context because there is a time gap between the context being detached and the dispatcher checking whether the context is detached. Hence, guard the last timestamp by holding the context mutex and checking if the context is detached or not before updating it. Trying to guard internal_timestamp with drawctxt->mutex could lead to a locking order inversion and possibly deadlock. This variable is set in adreno_ringbuffer_addcmds(), and used in kgsl_context_detach(). Both of these calls hold device->mutex, so it is safe to access this variable without an additional mutex. Change-Id: Idc1a867de94e071a3128a164724d26dd9cb29a0a Signed-off-by:Shubhraprakash Das <sadas@codeaurora.org> Signed-off-by:
Jeremy Gebben <jgebben@codeaurora.org>
Loading
Please register or sign in to comment