drm/ttm: Fix a theoretical race
authorThomas Hellstrom <thellstrom@vmware.com>
Mon, 22 Oct 2012 12:51:25 +0000 (12:51 +0000)
committerDave Airlie <airlied@redhat.com>
Tue, 23 Oct 2012 00:15:17 +0000 (10:15 +1000)
The ttm_mem_evict_first function could theoretically drop the
lru lock without retrying if a reservation from off the LRU list
ended up waiting.
However, since currently there are no users that could cause a wait
in that situation so this is not suitable for stable

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/ttm/ttm_bo.c

index 402ab69..d42631c 100644 (file)
@@ -817,11 +817,11 @@ retry:
                goto retry;
        }
 
-       ret = ttm_bo_reserve_locked(bo, false, no_wait_reserve, false, 0);
+       ret = ttm_bo_reserve_locked(bo, false, true, false, 0);
 
        if (unlikely(ret == -EBUSY)) {
                spin_unlock(&glob->lru_lock);
-               if (likely(!no_wait_gpu))
+               if (likely(!no_wait_reserve))
                        ret = ttm_bo_wait_unreserved(bo, interruptible);
 
                kref_put(&bo->list_kref, ttm_bo_release_list);