Commit a17aceb3 authored by Nirmoy Das's avatar Nirmoy Das

drm/xe: Check empty pinned BO list with lock held.

Use lock that is meant to use for accessing the BO pin list.
Reviewed-by: default avatarMatthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240528115408.22094-1-nirmoy.das@intel.comSigned-off-by: default avatarNirmoy Das <nirmoy.das@intel.com>
parent fa171d49
...@@ -1758,11 +1758,10 @@ void xe_bo_unpin_external(struct xe_bo *bo) ...@@ -1758,11 +1758,10 @@ void xe_bo_unpin_external(struct xe_bo *bo)
xe_assert(xe, xe_bo_is_pinned(bo)); xe_assert(xe, xe_bo_is_pinned(bo));
xe_assert(xe, xe_bo_is_user(bo)); xe_assert(xe, xe_bo_is_user(bo));
if (bo->ttm.pin_count == 1 && !list_empty(&bo->pinned_link)) {
spin_lock(&xe->pinned.lock); spin_lock(&xe->pinned.lock);
if (bo->ttm.pin_count == 1 && !list_empty(&bo->pinned_link))
list_del_init(&bo->pinned_link); list_del_init(&bo->pinned_link);
spin_unlock(&xe->pinned.lock); spin_unlock(&xe->pinned.lock);
}
ttm_bo_unpin(&bo->ttm); ttm_bo_unpin(&bo->ttm);
...@@ -1785,9 +1784,8 @@ void xe_bo_unpin(struct xe_bo *bo) ...@@ -1785,9 +1784,8 @@ void xe_bo_unpin(struct xe_bo *bo)
struct ttm_place *place = &(bo->placements[0]); struct ttm_place *place = &(bo->placements[0]);
if (mem_type_is_vram(place->mem_type)) { if (mem_type_is_vram(place->mem_type)) {
xe_assert(xe, !list_empty(&bo->pinned_link));
spin_lock(&xe->pinned.lock); spin_lock(&xe->pinned.lock);
xe_assert(xe, !list_empty(&bo->pinned_link));
list_del_init(&bo->pinned_link); list_del_init(&bo->pinned_link);
spin_unlock(&xe->pinned.lock); spin_unlock(&xe->pinned.lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment