Revert "drm/amdgpu: revert to old status lock handling v3"
Subsystems (2)
Alex Deucher
maintainerPATCH 1/1 Revert "drm/amdgpu: revert to old status lock handling v3"
This reverts commit 59e4405e9ee2b318342d252422a82dd863b89ef4.
This results in various warnings.
Cc Christian König <[email protected]>
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 8 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 166 ++++++++++++---------- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 15 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 4 + 4 files changed, 102 insertions(+), 91 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +4 -4
@@ -724,12 +724,12 @@ amdgpu_userq_bo_validate(struct amdgpu_device *adev, struct drm_exec *exec,struct amdgpu_bo *bo;int ret; -spin_lock (&vm->invalidated_lock); +spin_lock (&vm->status_lock);while (!list_empty (&vm->invalidated)) { bo_va =list_first_entry (&vm->invalidated, struct amdgpu_bo_va, base.vm_status); -spin_unlock (&vm->invalidated_lock); +spin_unlock (&vm->status_lock); bo = bo_va->base.bo; 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,if (ret)return ret; -spin_lock (&vm->invalidated_lock); +spin_lock (&vm->status_lock); } -spin_unlock (&vm->invalidated_lock); +spin_unlock (&vm->status_lock);return 0 ; }
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +88 -78
443 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +6 -9
@@ -203,11 +203,11 @@ struct amdgpu_vm_bo_base {/* protected by bo being reserved */ struct amdgpu_vm_bo_base *next; -/* protected by vm reservation and invalidated_lock */ +/* protected by vm status_lock */ struct list_head vm_status;/* if the bo is counted as shared in mem stats -* protected by vm BO being reserved */ +* protected by vm status_lock */ bool shared;/* protected by the BO being reserved */
@@ -343,8 +343,10 @@ struct amdgpu_vm {bool evicting;unsigned int saved_flags; -/* Memory statistics for this vm, protected by stats_lock */ -spinlock_t stats_lock; +/* Lock to protect vm_bo add/del/move on all lists of vm */ +spinlock_t status_lock; + +/* Memory statistics for this vm, protected by status_lock */ struct amdgpu_mem_stats stats[__AMDGPU_PL_NUM];/*
@@ -352,8 +354,6 @@ struct amdgpu_vm {* PDs, PTs or per VM BOs. The state transits are: * * evicted -> relocated (PDs, PTs) or moved (per VM BOs) -> idle -* -* Lists are protected by the root PD dma_resv lock. */ /* Per-VM and PT BOs who needs a validation */
@@ -374,10 +374,7 @@ struct amdgpu_vm {* state transits are: * * evicted_user or invalidated -> done -* -* Lists are protected by the invalidated_lock. */ -spinlock_t invalidated_lock;/* BOs for user mode queues that need a validation */ struct list_head evicted_user;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +4 -0
@@ -541,7 +541,9 @@ static void amdgpu_vm_pt_free(struct amdgpu_vm_bo_base *entry) entry->bo->vm_bo =NULL ;ttm_bo_set_bulk_move (&entry->bo->tbo,NULL ); +spin_lock (&entry->vm->status_lock);list_del (&entry->vm_status); +spin_unlock (&entry->vm->status_lock);amdgpu_bo_unref (&entry->bo); }
@@ -585,6 +587,7 @@ static void amdgpu_vm_pt_add_list(struct amdgpu_vm_update_params *params,struct amdgpu_vm_pt_cursor seek;struct amdgpu_vm_bo_base *entry; +spin_lock (¶ms->vm->status_lock);for_each_amdgpu_vm_pt_dfs_safe (params->adev, params->vm, cursor, seek, entry) {if (entry && entry->bo)list_move (&entry->vm_status, ¶ms->tlb_flush_waitlist);
@@ -592,6 +595,7 @@ static void amdgpu_vm_pt_add_list(struct amdgpu_vm_update_params *params,/* enter start node now */ list_move (&cursor->entry->vm_status, ¶ms->tlb_flush_waitlist); +spin_unlock (¶ms->vm->status_lock); }/**
Signature · 1 line
2.51.0