diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index c5bb36275e93..64b3a1ed04dc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |||
@@ -449,26 +449,28 @@ void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr) | |||
449 | struct amdgpu_ctx *ctx; | 449 | struct amdgpu_ctx *ctx; |
450 | struct idr *idp; | 450 | struct idr *idp; |
451 | uint32_t id, i; | 451 | uint32_t id, i; |
452 | long max_wait = MAX_WAIT_SCHED_ENTITY_Q_EMPTY; | ||
452 | 453 | ||
453 | idp = &mgr->ctx_handles; | 454 | idp = &mgr->ctx_handles; |
454 | 455 | ||
456 | mutex_lock(&mgr->lock); | ||
455 | idr_for_each_entry(idp, ctx, id) { | 457 | idr_for_each_entry(idp, ctx, id) { |
456 | 458 | ||
457 | if (!ctx->adev) | 459 | if (!ctx->adev) { |
460 | mutex_unlock(&mgr->lock); | ||
458 | return; | 461 | return; |
462 | } | ||
459 | 463 | ||
460 | for (i = 0; i < ctx->adev->num_rings; i++) { | 464 | for (i = 0; i < ctx->adev->num_rings; i++) { |
461 | 465 | ||
462 | if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring) | 466 | if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring) |
463 | continue; | 467 | continue; |
464 | 468 | ||
465 | if (kref_read(&ctx->refcount) == 1) | 469 | max_wait = drm_sched_entity_do_release(&ctx->adev->rings[i]->sched, |
466 | drm_sched_entity_do_release(&ctx->adev->rings[i]->sched, | 470 | &ctx->rings[i].entity, max_wait); |
467 | &ctx->rings[i].entity); | ||
468 | else | ||
469 | DRM_ERROR("ctx %p is still alive\n", ctx); | ||
470 | } | 471 | } |
471 | } | 472 | } |
473 | mutex_unlock(&mgr->lock); | ||
472 | } | 474 | } |
473 | 475 | ||
474 | void amdgpu_ctx_mgr_entity_cleanup(struct amdgpu_ctx_mgr *mgr) | 476 | void amdgpu_ctx_mgr_entity_cleanup(struct amdgpu_ctx_mgr *mgr) |