All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/ttm: make ttm_bo_unpin more defensive
@ 2021-03-12  9:38 Christian König
  2021-03-12 10:32 ` Matthew Auld
  2021-03-13 18:29 ` Thomas Hellström (Intel)
  0 siblings, 2 replies; 17+ messages in thread
From: Christian König @ 2021-03-12  9:38 UTC (permalink / raw)
  To: dri-devel

We seem to have some more driver bugs than thought.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 include/drm/ttm/ttm_bo_api.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 4fb523dfab32..df9fe596e7c5 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -603,9 +603,11 @@ static inline void ttm_bo_pin(struct ttm_buffer_object *bo)
 static inline void ttm_bo_unpin(struct ttm_buffer_object *bo)
 {
 	dma_resv_assert_held(bo->base.resv);
-	WARN_ON_ONCE(!bo->pin_count);
 	WARN_ON_ONCE(!kref_read(&bo->kref));
-	--bo->pin_count;
+	if (bo->pin_count)
+		--bo->pin_count;
+	else
+		WARN_ON_ONCE(true);
 }
 
 int ttm_mem_evict_first(struct ttm_device *bdev,
-- 
2.25.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-03-16 18:58 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12  9:38 [PATCH] drm/ttm: make ttm_bo_unpin more defensive Christian König
2021-03-12 10:32 ` Matthew Auld
2021-03-13 18:29 ` Thomas Hellström (Intel)
2021-03-15  7:48   ` Thomas Zimmermann
2021-03-15 17:10     ` Thomas Hellström (Intel)
2021-03-15 10:26   ` Christian König
2021-03-15 17:08     ` Thomas Hellström (Intel)
2021-03-15 18:47       ` Christian König
2021-03-15 19:00         ` Thomas Hellström (Intel)
2021-03-16  9:27           ` Daniel Vetter
2021-03-16 10:38             ` Thomas Hellström (Intel)
2021-03-16 11:06               ` Daniel Vetter
2021-03-16 11:23                 ` Thomas Hellström (Intel)
2021-03-16 14:07                   ` Daniel Vetter
2021-03-16 18:18                     ` Thomas Hellström (Intel)
2021-03-16 18:28                       ` Daniel Vetter
2021-03-16 18:58                         ` Thomas Hellström (Intel)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.