@@ -476,9 +476,9 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all)
drm_mm_put_block(bo->mem.mm_node);
bo->mem.mm_node = NULL;
}
- spin_unlock(&glob->lru_lock);
atomic_set(&bo->reserved, 0);
+ spin_unlock(&glob->lru_lock);
while (put_count--)
kref_put(&bo->list_kref, ttm_bo_ref_bug);
@@ -1707,8 +1707,12 @@ EXPORT_SYMBOL(ttm_bo_wait);
void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo)
{
+ struct ttm_bo_global *glob = bo->glob;
+
+ spin_lock(&glob->lru_lock);
atomic_set(&bo->reserved, 0);
wake_up_all(&bo->event_queue);
+ spin_unlock(&glob->lru_lock);
}
int ttm_bo_block_reservation(struct ttm_buffer_object *bo, bool interruptible,
@@ -1849,8 +1853,10 @@ out:
* already swapped buffer.
*/
+ spin_lock(&glob->lru_lock);
atomic_set(&bo->reserved, 0);
wake_up_all(&bo->event_queue);
+ spin_unlock(&glob->lru_lock);
kref_put(&bo->list_kref, ttm_bo_release_list);
return ret;
}