diff mbox

[2/2] drm/ttm: Don't unreserve swapped BOs that were previously reserved

Message ID MWHPR1201MB01273D02F9392B227C7BECA9FDEF0@MWHPR1201MB0127.namprd12.prod.outlook.com (mailing list archive)
State New, archived
Headers show

Commit Message

He, Hongbo Jan. 19, 2018, 3:19 a.m. UTC
good catch! 

Thanks
Roger(Hongbo.He)
-----Original Message-----
From: Kuehling, Felix 
Sent: Friday, January 19, 2018 12:56 AM
To: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; Koenig, Christian <Christian.Koenig@amd.com>; He, Roger <Hongbo.He@amd.com>
Cc: Kuehling, Felix <Felix.Kuehling@amd.com>
Subject: [PATCH 2/2] drm/ttm: Don't unreserve swapped BOs that were previously reserved

If ttm_bo_swapout doesn't own the lock, don't release it. Someone else probably depends on it still being locked.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.7.4
diff mbox

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 62518b6..893003f 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1780,8 +1780,8 @@  int ttm_bo_swapout(struct ttm_bo_global *glob, struct ttm_operation_ctx *ctx)
 	 * Unreserve without putting on LRU to avoid swapping out an
 	 * already swapped buffer.
 	 */
-
-	reservation_object_unlock(bo->resv);
+	if (locked)
+		reservation_object_unlock(bo->resv);
 	kref_put(&bo->list_kref, ttm_bo_release_list);
 	return ret;
 }