Skip to content

Commit

Permalink
drm/ttm: lock resv object during destruction
Browse files Browse the repository at this point in the history
Calling ttm_bo_cleanup_memtype_use() destroys the TT object
which in turn could result in warnings without this.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/359288
  • Loading branch information
Christian König committed Apr 1, 2020
1 parent 09606b5 commit efa557b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/gpu/drm/ttm/ttm_bo.c
Original file line number Diff line number Diff line change
@@ -588,7 +588,8 @@ static void ttm_bo_release(struct kref *kref)
ttm_mem_io_unlock(man);
}

if (!dma_resv_test_signaled_rcu(bo->base.resv, true)) {
if (!dma_resv_test_signaled_rcu(bo->base.resv, true) ||
!dma_resv_trylock(bo->base.resv)) {
/* The BO is not idle, resurrect it for delayed destroy */
ttm_bo_flush_all_fences(bo);
bo->deleted = true;
@@ -621,6 +622,7 @@ static void ttm_bo_release(struct kref *kref)
spin_unlock(&ttm_bo_glob.lru_lock);

ttm_bo_cleanup_memtype_use(bo);
dma_resv_unlock(bo->base.resv);

BUG_ON(bo->mem.mm_node != NULL);
atomic_dec(&ttm_bo_glob.bo_count);

0 comments on commit efa557b

Please sign in to comment.