• Maarten Lankhorst's avatar
    drm/ttm: cope with reserved buffers on lru list in ttm_mem_evict_first, v2 · e7ab2019
    Maarten Lankhorst authored
    Replace the goto loop with a simple for each loop, and only run the
    delayed destroy cleanup if we can reserve the buffer first.
    
    No race occurs, since lru lock is never dropped any more. An empty list
    and a list full of unreservable buffers both cause -EBUSY to be returned,
    which is identical to the previous situation, because previously buffers
    on the lru list were always guaranteed to be reservable.
    
    This should work since currently ttm guarantees items on the lru are
    always reservable, and reserving items blockingly with some bo held
    are enough to cause you to run into a deadlock.
    
    Currently this is not a concern since removal off the lru list and
    reservations are always done with atomically, but when this guarantee
    no longer holds, we have to handle this situation or end up with
    possible deadlocks.
    Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@canonical.com>
    Reviewed-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
    Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
    e7ab2019
ttm_bo.c 45.4 KB