Commit 6c540317 authored by Christian König's avatar Christian König

drm/ttm: make ttm_bo_unpin more defensive

We seem to have some more driver bugs than thought.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Fixes: deb0814b ("drm/ttm: add ttm_bo_pin()/ttm_bo_unpin() v2")
Acked-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210312093810.2202-1-christian.koenig@amd.com
parent de066e11
...@@ -612,9 +612,11 @@ static inline void ttm_bo_pin(struct ttm_buffer_object *bo) ...@@ -612,9 +612,11 @@ static inline void ttm_bo_pin(struct ttm_buffer_object *bo)
static inline void ttm_bo_unpin(struct ttm_buffer_object *bo) static inline void ttm_bo_unpin(struct ttm_buffer_object *bo)
{ {
dma_resv_assert_held(bo->base.resv); dma_resv_assert_held(bo->base.resv);
WARN_ON_ONCE(!bo->pin_count);
WARN_ON_ONCE(!kref_read(&bo->kref)); WARN_ON_ONCE(!kref_read(&bo->kref));
if (bo->pin_count)
--bo->pin_count; --bo->pin_count;
else
WARN_ON_ONCE(true);
} }
int ttm_mem_evict_first(struct ttm_bo_device *bdev, int ttm_mem_evict_first(struct ttm_bo_device *bdev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment