msm: kgsl: Fix hang detection to be 50ms or more
In current design waittimestamp can trigger hang detection
in less than 50ms. Check if hang detection was called less than
50ms ago, if true do no attempt hang detection.
Change-Id: Iaeb2501316c4194957fbe211b6023eeb869bd0d5
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c
index 93db37d..d6b6b82 100644
--- a/drivers/gpu/msm/adreno.c
+++ b/drivers/gpu/msm/adreno.c
@@ -2261,6 +2261,7 @@
unsigned int curr_reg_val[hang_detect_regs_count];
unsigned int hang_detected = 1;
unsigned int i;
+ static unsigned long next_hang_detect_time;
if (!adreno_dev->fast_hang_detect)
return 0;
@@ -2284,6 +2285,18 @@
return 0;
}
+ /*
+ * Time interval between hang detection should be KGSL_TIMEOUT_PART
+ * or more, if next hang detection is requested < KGSL_TIMEOUT_PART
+ * from the last time do nothing.
+ */
+ if ((next_hang_detect_time) &&
+ (time_before(jiffies, next_hang_detect_time)))
+ return 0;
+ else
+ next_hang_detect_time = (jiffies +
+ msecs_to_jiffies(KGSL_TIMEOUT_PART-1));
+
for (i = 0; i < hang_detect_regs_count; i++) {
if (hang_detect_regs[i] == 0)