drm/amdgpu/userq: actually invalidate userq BOs
Subsystems (2)
PATCH 1/1 drm/amdgpu/userq: actually invalidate userq BOs
This was supposed to loop over the individual evicted list, as the kernel and always_valid evicted lists were already handled in amdgpu_vm_validate.
Without this, BOs that were created and evicted before a userq was made would end up never end up in an eviction fence rearm.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +2 -2
@@ -993,8 +993,8 @@ amdgpu_userq_bo_validate(struct amdgpu_device *adev, struct drm_exec *exec,int ret;spin_lock (&vm->individual_lock); -while (!list_empty (&vm->always_valid.evicted)) { - bo_va =list_first_entry (&vm->always_valid.evicted, +while (!list_empty (&vm->individual.evicted)) { + bo_va =list_first_entry (&vm->individual.evicted, struct amdgpu_bo_va, base.vm_status);spin_unlock (&vm->individual_lock);
Signature · 1 line
2.55.0
Quoted 9 lines · Benjamin Cheng
This was supposed to loop over the individual evicted list, as the kernel and
always_validevicted lists were already handled inamdgpu_vm_validate.Without this, BOs that were created and evicted before a userq was made would end up never end up in an eviction fence rearm.
Fixes 4cdbba5a16aa ("drm/amdgpu: restructure VM state machine v4")Signed-off-by Benjamin Cheng <[email protected]>
Totally my fault, thanks for catching that.
Quoted 19 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +2
-2@@ -993,8 +993,8 @@ amdgpu_userq_bo_validate(struct amdgpu_device *adev, struct drm_exec *exec,int ret;spin_lock (&vm->individual_lock); -while (!list_empty (&vm->always_valid.evicted)) { - bo_va =list_first_entry (&vm->always_valid.evicted, +while (!list_empty (&vm->individual.evicted)) { + bo_va =list_first_entry (&vm->individual.evicted, struct amdgpu_bo_va, base.vm_status);spin_unlock (&vm->individual_lock);
PATCH v2 1/1 drm/amdgpu/userq: actually validate userq BOs
In reply to Benjamin ChengThis was supposed to loop over the individual evicted list, as the kernel and always_valid evicted lists were already handled in amdgpu_vm_validate.
Without this, BOs that were created and evicted before a userq was made would never end up in an eviction fence rearm.
Also add the missing ref to the BO before drm_exec locks and refs it.
---
v2:
- ref the BO before drm_exec locks it
- updated commit message (s/invalidate/validate/)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +6 -4
@@ -998,19 +998,21 @@ amdgpu_userq_bo_validate(struct amdgpu_device *adev, struct drm_exec *exec, {struct ttm_operation_ctx ctx = { false, false };struct amdgpu_bo_va *bo_va; -struct amdgpu_bo *bo; +struct amdgpu_bo *bo, *tmp;int ret;spin_lock (&vm->individual_lock); -while (!list_empty (&vm->always_valid.evicted)) { - bo_va =list_first_entry (&vm->always_valid.evicted, +while (!list_empty (&vm->individual.evicted)) { + bo_va =list_first_entry (&vm->individual.evicted, struct amdgpu_bo_va, base.vm_status); + bo = bo_va->base.bo; + tmp =amdgpu_bo_ref (bo);spin_unlock (&vm->individual_lock); - bo = bo_va->base.bo; ret =drm_exec_prepare_obj (exec, &bo->tbo.base,TTM_NUM_MOVE_FENCES +1 ); +amdgpu_bo_unref (&tmp);if (unlikely (ret))return ret;
Signature · 1 line
2.55.0
Re: [PATCH v2] drm/amdgpu/userq: actually validate userq BOs
Quoted 11 lines · Benjamin Cheng
This was supposed to loop over the individual evicted list, as the kernel and
always_validevicted lists were already handled inamdgpu_vm_validate.Without this, BOs that were created and evicted before a userq was made would never end up in an eviction fence rearm.
Also add the missing ref to the BO before
drm_execlocks and refs it.Fixes 4cdbba5a16aa ("drm/amdgpu: restructure VM state machine v4")Signed-off-by Benjamin Cheng <[email protected]>
Quoted 38 lines
---
v2:
- ref the BO beforedrm_execlocks it
- updated commit message (s/invalidate/validate/)--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +6
-4@@ -998,19 +998,21 @@ amdgpu_userq_bo_validate(struct amdgpu_device *adev, struct drm_exec *exec, {struct ttm_operation_ctx ctx = { false, false };struct amdgpu_bo_va *bo_va; -struct amdgpu_bo *bo; +struct amdgpu_bo *bo, *tmp;int ret;spin_lock (&vm->individual_lock); -while (!list_empty (&vm->always_valid.evicted)) { - bo_va =list_first_entry (&vm->always_valid.evicted, +while (!list_empty (&vm->individual.evicted)) { + bo_va =list_first_entry (&vm->individual.evicted, struct amdgpu_bo_va, base.vm_status); + bo = bo_va->base.bo; + tmp =amdgpu_bo_ref (bo);spin_unlock (&vm->individual_lock); - bo = bo_va->base.bo; ret =drm_exec_prepare_obj (exec, &bo->tbo.base,TTM_NUM_MOVE_FENCES +1 ); +amdgpu_bo_unref (&tmp);if (unlikely (ret))return ret;