summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/ttm/ttm_bo.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2019-07-31 10:41:50 +0300
committerChristian König <christian.koenig@amd.com>2019-08-05 10:28:43 +0300
commit0dbd555a011c2d096a7b7e40c83c5776a7df367c (patch)
tree4399a2204760664daad1c91896aa3f8217744d43 /drivers/gpu/drm/ttm/ttm_bo.c
parent05103ea9a3159b9bb7004e9c0693948d4d6124f9 (diff)
downloadlinux-0dbd555a011c2d096a7b7e40c83c5776a7df367c.tar.xz
dma-buf: add more reservation object locking wrappers
Complete the abstraction of the ww_mutex inside the reservation object. This allows us to add more handling and debugging to the reservation object in the future. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/320761/
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_bo.c')
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 58c403eda04e..40d3e547c78e 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -850,8 +850,8 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev,
if (!ttm_bo_evict_swapout_allowable(bo, ctx, &locked,
&busy)) {
- if (busy && !busy_bo &&
- bo->resv->lock.ctx != ticket)
+ if (busy && !busy_bo && ticket !=
+ reservation_object_locking_ctx(bo->resv))
busy_bo = bo;
continue;
}
@@ -957,8 +957,10 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo,
{
struct ttm_bo_device *bdev = bo->bdev;
struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
+ struct ww_acquire_ctx *ticket;
int ret;
+ ticket = reservation_object_locking_ctx(bo->resv);
do {
ret = (*man->func->get_node)(man, bo, place, mem);
if (unlikely(ret != 0))
@@ -966,7 +968,7 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo,
if (mem->mm_node)
break;
ret = ttm_mem_evict_first(bdev, mem->mem_type, place, ctx,
- bo->resv->lock.ctx);
+ ticket);
if (unlikely(ret != 0))
return ret;
} while (1);
@@ -1963,7 +1965,7 @@ int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo)
ret = mutex_lock_interruptible(&bo->wu_mutex);
if (unlikely(ret != 0))
return -ERESTARTSYS;
- if (!ww_mutex_is_locked(&bo->resv->lock))
+ if (!reservation_object_is_locked(bo->resv))
goto out_unlock;
ret = reservation_object_lock_interruptible(bo->resv, NULL);
if (ret == -EINTR)