From d14dbe68668bc33621bb70b0616b7b219ab1146a Mon Sep 17 00:00:00 2001 From: Akhil P Oommen Date: Fri, 7 Feb 2020 15:56:41 +0530 Subject: [PATCH] msm: kgsl: Fix gdsc disable timeout during reset Smmu driver takes a vote on CX gdsc before calling the kgsl pagefault handler. If there is contention for device mutex in this path and the dispatcher fault handler is holding this lock, trying to turn off CX gdsc will fail during the reset. So to avoid blocking here, try to lock device mutex and return if it fails. Change-Id: Idf1726960071d66b9112f6b4abdf19a49afacefd Signed-off-by: Akhil P Oommen Signed-off-by: Urvashi Agrawal --- drivers/gpu/msm/adreno_a6xx.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/msm/adreno_a6xx.c b/drivers/gpu/msm/adreno_a6xx.c index 508d99c73e4a..507bc290a6a9 100644 --- a/drivers/gpu/msm/adreno_a6xx.c +++ b/drivers/gpu/msm/adreno_a6xx.c @@ -1272,7 +1272,15 @@ static const char *a6xx_fault_block_uche(struct kgsl_device *device, unsigned int uche_client_id = 0; static char str[40]; - mutex_lock(&device->mutex); + /* + * Smmu driver takes a vote on CX gdsc before calling the kgsl + * pagefault handler. If there is contention for device mutex in this + * path and the dispatcher fault handler is holding this lock, trying + * to turn off CX gdsc will fail during the reset. So to avoid blocking + * here, try to lock device mutex and return if it fails. + */ + if (!mutex_trylock(&device->mutex)) + return "UCHE: unknown"; if (!kgsl_state_is_awake(device)) { mutex_unlock(&device->mutex);