diff options
author | Dmitry Osipenko <digetx@gmail.com> | 2018-08-07 09:07:11 -0400 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2019-02-07 12:30:24 -0500 |
commit | e8bad659381e9d63164f61e3bdf37e1c12274016 (patch) | |
tree | 40d5e046c57613b2688f74541048f8e7477a6163 | |
parent | 6d6c815daad8ec3469135c310ed39849cbe7752c (diff) |
gpu: host1x: Cancel only job that actually got stuck
Host1x doesn't have information about jobs inter-dependency, that is
something that will become available once host1x will get a proper
jobs scheduler implementation. Currently a hang job causes other unrelated
jobs to be canceled, that is a relic from downstream driver which is
irrelevant to upstream. Let's cancel only the hanging job and not to touch
other jobs in queue.
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r-- | drivers/gpu/host1x/cdma.c | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c index 07df85b92ebf..2314f37cb735 100644 --- a/drivers/gpu/host1x/cdma.c +++ b/drivers/gpu/host1x/cdma.c | |||
@@ -408,13 +408,11 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, | |||
408 | } | 408 | } |
409 | 409 | ||
410 | /* | 410 | /* |
411 | * Walk the sync_queue, first incrementing with the CPU syncpts that | 411 | * Increment with CPU the remaining syncpts of a partially executed job. |
412 | * are partially executed (the first buffer) or fully skipped while | ||
413 | * still in the current context (slots are also NOP-ed). | ||
414 | * | 412 | * |
415 | * At the point contexts are interleaved, syncpt increments must be | 413 | * Syncpt increments must be done inline with the pushbuffer from a |
416 | * done inline with the pushbuffer from a GATHER buffer to maintain | 414 | * GATHER buffer to maintain the order (slots are modified to be a |
417 | * the order (slots are modified to be a GATHER of syncpt incrs). | 415 | * GATHER of syncpt incrs). |
418 | * | 416 | * |
419 | * Note: save in restart_addr the location where the timed out buffer | 417 | * Note: save in restart_addr the location where the timed out buffer |
420 | * started in the PB, so we can start the refetch from there (with the | 418 | * started in the PB, so we can start the refetch from there (with the |
@@ -422,20 +420,15 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, | |||
422 | * properly for this buffer and resources are freed. | 420 | * properly for this buffer and resources are freed. |
423 | */ | 421 | */ |
424 | 422 | ||
425 | dev_dbg(dev, "%s: perform CPU incr on pending same ctx buffers\n", | 423 | dev_dbg(dev, "%s: perform CPU incr on pending buffers\n", __func__); |
426 | __func__); | ||
427 | 424 | ||
428 | if (!list_empty(&cdma->sync_queue)) | 425 | if (!list_empty(&cdma->sync_queue)) |
429 | restart_addr = job->first_get; | 426 | restart_addr = job->first_get; |
430 | else | 427 | else |
431 | restart_addr = cdma->last_pos; | 428 | restart_addr = cdma->last_pos; |
432 | 429 | ||
433 | /* do CPU increments as long as this context continues */ | 430 | /* do CPU increments for the remaining syncpts */ |
434 | list_for_each_entry_from(job, &cdma->sync_queue, list) { | 431 | if (job) { |
435 | /* different context, gets us out of this loop */ | ||
436 | if (job->client != cdma->timeout.client) | ||
437 | break; | ||
438 | |||
439 | /* won't need a timeout when replayed */ | 432 | /* won't need a timeout when replayed */ |
440 | job->timeout = 0; | 433 | job->timeout = 0; |
441 | 434 | ||
@@ -448,20 +441,8 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, | |||
448 | host1x_hw_cdma_timeout_cpu_incr(host1x, cdma, job->first_get, | 441 | host1x_hw_cdma_timeout_cpu_incr(host1x, cdma, job->first_get, |
449 | syncpt_incrs, job->syncpt_end, | 442 | syncpt_incrs, job->syncpt_end, |
450 | job->num_slots); | 443 | job->num_slots); |
451 | |||
452 | syncpt_val += syncpt_incrs; | ||
453 | } | 444 | } |
454 | 445 | ||
455 | /* | ||
456 | * The following sumbits from the same client may be dependent on the | ||
457 | * failed submit and therefore they may fail. Force a small timeout | ||
458 | * to make the queue cleanup faster. | ||
459 | */ | ||
460 | |||
461 | list_for_each_entry_from(job, &cdma->sync_queue, list) | ||
462 | if (job->client == cdma->timeout.client) | ||
463 | job->timeout = min_t(unsigned int, job->timeout, 500); | ||
464 | |||
465 | dev_dbg(dev, "%s: finished sync_queue modification\n", __func__); | 446 | dev_dbg(dev, "%s: finished sync_queue modification\n", __func__); |
466 | 447 | ||
467 | /* roll back DMAGET and start up channel again */ | 448 | /* roll back DMAGET and start up channel again */ |