Skip to content

Commit efa557b

Browse files
drm/ttm: lock resv object during destruction
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 <[email protected]> Acked-by: Daniel Vetter <[email protected]> Acked-by: Sumit Semwal <[email protected]> Link: https://patchwork.freedesktop.org/patch/359288
1 parent 09606b5 commit efa557b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/drm/ttm/ttm_bo.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,8 @@ static void ttm_bo_release(struct kref *kref)
588588
ttm_mem_io_unlock(man);
589589
}
590590

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

623624
ttm_bo_cleanup_memtype_use(bo);
625+
dma_resv_unlock(bo->base.resv);
624626

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

0 commit comments

Comments
 (0)