msm: kgsl: Add a flag to context struct for bad timestamp waits
If the userspace calls the waittimestamp ioctl with an invalid
timestamp for a context then set a flag indicating that the ioctl
was called with an invalid ts. If the flag is set then do not
print error message about this ioctl being called with an invalid
timestamp. This is required to prevent the kernel log from
spamming with error messages and causing a watchdog.
CRs-fixed: 374586
Change-Id: Iffa5c13d74ed90b78f88aba5c4c0e0f908eeaa19
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c
index 33013f5..72108f0 100644
--- a/drivers/gpu/msm/adreno.c
+++ b/drivers/gpu/msm/adreno.c
@@ -1440,6 +1440,11 @@
} else {
adreno_context = context->devctxt;
adreno_context->flags |= CTXT_FLAGS_GPU_HANG;
+ /*
+ * set the invalid ts flag to 0 for this context since we have
+ * detected a hang for it
+ */
+ context->wait_on_invalid_ts = false;
}
/* Extract valid contents from rb which can still be executed after
@@ -2306,14 +2311,24 @@
*/
if (timestamp_cmp(timestamp, ts_issued) > 0) {
if (!(adreno_ctx->flags & CTXT_FLAGS_USER_GENERATED_TS)) {
- KGSL_DRV_ERR(device,
+ if (context && !context->wait_on_invalid_ts) {
+ KGSL_DRV_ERR(device,
"Cannot wait for invalid ts <%d:0x%x>, "
"last issued ts <%d:0x%x>\n",
context_id, timestamp, context_id, ts_issued);
+ /*
+ * Prevent the above message from spamming the
+ * kernel logs and causing a watchdog
+ */
+ context->wait_on_invalid_ts = true;
+ }
status = -EINVAL;
goto done;
} else
retry_ts_cmp = 1;
+ } else if (context && context->wait_on_invalid_ts) {
+ /* Once we wait for a valid ts reset the invalid wait flag */
+ context->wait_on_invalid_ts = false;
}
/*
@@ -2389,13 +2404,19 @@
ts_issued =
adreno_dev->ringbuffer.timestamp[context_id];
if (timestamp_cmp(timestamp, ts_issued) > 0) {
- KGSL_DRV_ERR(device,
- "Cannot wait for user-generated ts <%d:0x%x>, "
- "not submitted within server timeout period. "
- "last issued ts <%d:0x%x>\n",
- context_id, timestamp, context_id, ts_issued);
+ if (context && !context->wait_on_invalid_ts) {
+ KGSL_DRV_ERR(device,
+ "Cannot wait for user-generated ts <%d:0x%x>, "
+ "not submitted within server timeout period. "
+ "last issued ts <%d:0x%x>\n",
+ context_id, timestamp, context_id,
+ ts_issued);
+ context->wait_on_invalid_ts = true;
+ }
status = -EINVAL;
goto done;
+ } else if (context && context->wait_on_invalid_ts) {
+ context->wait_on_invalid_ts = false;
}
retry_ts_cmp = 0;
}
diff --git a/drivers/gpu/msm/kgsl_device.h b/drivers/gpu/msm/kgsl_device.h
index f38885a..7acfd96 100644
--- a/drivers/gpu/msm/kgsl_device.h
+++ b/drivers/gpu/msm/kgsl_device.h
@@ -240,7 +240,8 @@
* context was responsible for causing it
*/
unsigned int reset_status;
-
+ /* Flag indicating if we tried to wait for bad timestamp for this ctx */
+ bool wait_on_invalid_ts;
/*
* Timeline used to create fences that can be signaled when a
* sync_pt timestamp expires.