From: Christian König Date: Wed, 15 Nov 2017 10:05:17 +0000 (+0100) Subject: drm/ttm: fix ttm_mem_evict_first once more X-Git-Tag: v5.15~9430^2~33^2~104 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=090528639321ab09c150603c0da3c38c26aa5ea9;p=platform%2Fkernel%2Flinux-starfive.git drm/ttm: fix ttm_mem_evict_first once more The code path isn't hit at the moment, but we need to take the lock to add the BO back to the LRU. Signed-off-by: Christian König Reviewed-and-Tested-by: Michel Dänzer Reviewed-by: Roger He Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 07d9c6e..7c1eac4 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -793,10 +793,13 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev, spin_unlock(&glob->lru_lock); ret = ttm_bo_evict(bo, interruptible, no_wait_gpu); - if (locked) + if (locked) { ttm_bo_unreserve(bo); - else + } else { + spin_lock(&glob->lru_lock); ttm_bo_add_to_lru(bo); + spin_unlock(&glob->lru_lock); + } kref_put(&bo->list_kref, ttm_bo_release_list); return ret;