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.