Skip to content

Commit 59e4405

Browse files
ChristianKoenigAMDalexdeucher
authored andcommitted
drm/amdgpu: revert to old status lock handling v3
It turned out that protecting the status of each bo_va with a spinlock was just hiding problems instead of solving them. Revert the whole approach, add a separate stats_lock and lockdep assertions that the correct reservation lock is held all over the place. This not only allows for better checks if a state transition is properly protected by a lock, but also switching back to using list macros to iterate over the state of lists protected by the dma_resv lock of the root PD. v2: re-add missing check v3: split into two patches Signed-off-by: Christian König <[email protected]> Acked-by: Sunil Khatri <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 0aa09d8 commit 59e4405

File tree

4 files changed

+93
-102
lines changed

4 files changed

+93
-102
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -724,12 +724,12 @@ amdgpu_userq_bo_validate(struct amdgpu_device *adev, struct drm_exec *exec,
724724
struct amdgpu_bo *bo;
725725
int ret;
726726

727-
spin_lock(&vm->status_lock);
727+
spin_lock(&vm->invalidated_lock);
728728
while (!list_empty(&vm->invalidated)) {
729729
bo_va = list_first_entry(&vm->invalidated,
730730
struct amdgpu_bo_va,
731731
base.vm_status);
732-
spin_unlock(&vm->status_lock);
732+
spin_unlock(&vm->invalidated_lock);
733733

734734
bo = bo_va->base.bo;
735735
ret = drm_exec_prepare_obj(exec, &bo->tbo.base, 2);
@@ -746,9 +746,9 @@ amdgpu_userq_bo_validate(struct amdgpu_device *adev, struct drm_exec *exec,
746746
if (ret)
747747
return ret;
748748

749-
spin_lock(&vm->status_lock);
749+
spin_lock(&vm->invalidated_lock);
750750
}
751-
spin_unlock(&vm->status_lock);
751+
spin_unlock(&vm->invalidated_lock);
752752

753753
return 0;
754754
}

0 commit comments

Comments
 (0)