summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarshdeep Dhatt <hdhatt@codeaurora.org>2016-03-04 15:58:01 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-25 16:03:31 -0700
commitf981563fa0685e35b1be8bcbcfba6a670d9ff75b (patch)
tree6a2b3873996f481f6e7b9e2fc1e4daf4660daba2
parent02e71b3dfd5a89b5a1ace3c1dbcd4b553fa4a919 (diff)
msm: kgsl: Do not switch pagetable if context is detached
This is done to avoid a race condition between a context getting detached and destroyed before the GPU has executed the pt switch commands. CRs-Fixed: 987587 Change-Id: I5c485e41a23b288f27e607b3e3ed5bf66cbad98a Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
-rw-r--r--drivers/gpu/msm/adreno_drawctxt.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/msm/adreno_drawctxt.c b/drivers/gpu/msm/adreno_drawctxt.c
index 0b8e35ec1ea6..cef4bb4db3a0 100644
--- a/drivers/gpu/msm/adreno_drawctxt.c
+++ b/drivers/gpu/msm/adreno_drawctxt.c
@@ -576,6 +576,15 @@ int adreno_drawctxt_switch(struct adreno_device *adreno_dev,
if (rb->drawctxt_active == drawctxt)
return ret;
+ /*
+ * Submitting pt switch commands from a detached context can
+ * lead to a race condition where the pt is destroyed before
+ * the pt switch commands get executed by the GPU, leading to
+ * pagefaults.
+ */
+ if (drawctxt != NULL && kgsl_context_detached(&drawctxt->base))
+ return -ENOENT;
+
trace_adreno_drawctxt_switch(rb,
drawctxt, flags);