static int ttm_eu_wait_unreserved_locked(struct list_head *list, struct ttm_buffer_object *bo) { int ret; ttm_eu_del_from_lru_locked(list); ret = ttm_bo_wait_unreserved_locked(bo, true); if (unlikely(ret != 0)) ttm_eu_backoff_reservation_locked(list); return ret; }
static int ttm_eu_wait_unreserved_locked(struct list_head *list, struct ttm_buffer_object *bo) { struct ttm_bo_global *glob = bo->glob; int ret; ttm_eu_del_from_lru_locked(list); spin_unlock(&glob->lru_lock); ret = ttm_bo_wait_unreserved(bo, true); spin_lock(&glob->lru_lock); if (unlikely(ret != 0)) ttm_eu_backoff_reservation_locked(list); return ret; }
void ttm_eu_backoff_reservation(struct list_head *list) { struct ttm_validate_buffer *entry; struct ttm_bo_global *glob; if (list_empty(list)) return; entry = list_first_entry(list, struct ttm_validate_buffer, head); glob = entry->bo->glob; spin_lock(&glob->lru_lock); ttm_eu_backoff_reservation_locked(list); spin_unlock(&glob->lru_lock); }
void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket, struct list_head *list) { struct ttm_validate_buffer *entry; struct ttm_bo_global *glob; if (list_empty(list)) return; entry = list_first_entry(list, struct ttm_validate_buffer, head); glob = entry->bo->glob; lockmgr(&glob->lru_lock, LK_EXCLUSIVE); ttm_eu_backoff_reservation_locked(list, ticket); ww_acquire_fini(ticket); lockmgr(&glob->lru_lock, LK_RELEASE); }