From d31dc032df503966ae151f0ba213925b32f671ec Mon Sep 17 00:00:00 2001 From: Rajeev Kulkarni Date: Fri, 14 Dec 2012 14:47:55 -0800 Subject: [PATCH] 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 Signed-off-by: Rajeev Kulkarni --- drivers/gpu/msm/adreno.c | 33 +++++++++++++++++++++++++++------ drivers/gpu/msm/kgsl_device.h | 3 ++- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c index 33013f58309..72108f0b39a 100644 --- a/drivers/gpu/msm/adreno.c +++ b/drivers/gpu/msm/adreno.c @@ -1440,6 +1440,11 @@ _adreno_recover_hang(struct kgsl_device *device, } 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 @@ static int adreno_waittimestamp(struct kgsl_device *device, */ 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 @@ static int adreno_waittimestamp(struct kgsl_device *device, 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 f38885a2a64..7acfd964280 100644 --- a/drivers/gpu/msm/kgsl_device.h +++ b/drivers/gpu/msm/kgsl_device.h @@ -240,7 +240,8 @@ struct kgsl_context { * 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.