Skip to contentSkip to conversation

drm/amdgpu: re-validate per VM BOs if required v2

PATCH New Christian König 1 participant 2 messages Apr 5, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amdgpu: re-validate per VM BOs if required v2

If a per VM BO ends up in a allowed domain it never moves back into the prefered domain.

v2: move the extra handling into amdgpu_vm_bo_update when we exit the
state machine. Make memory type handling generic.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +14 -1
index 24474294c92a..a2f8b57838ff 100644
@@ -1555,7 +1555,20 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 	}
 
 	spin_lock(&vm->status_lock);
-	list_del_init(&bo_va->base.vm_status);
+	if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) {
+		unsigned mem_type = bo->tbo.mem.mem_type;
+
+		/* If the BO is not in its preferred location add it back to
+		 * the evicted list so that it gets validated again on the
+		 * next command submission.
+		 */
+		if (!(bo->preferred_domains & amdgpu_mem_type_to_domain(mem_type)))
+			list_add_tail(&bo_va->base.vm_status, &vm->evicted);
+		else
+			list_del_init(&bo_va->base.vm_status);
+	} else {
+		list_del_init(&bo_va->base.vm_status);
+	}
 	spin_unlock(&vm->status_lock);
 
 	list_splice_init(&bo_va->invalids, &bo_va->valids);
Signature · 6 lines
2.14.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20180405121904.1604-1-christian.koenig-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 2/2 drm/amdgpu: keep per VM BOs together on the LRU

When one VM BOs validated move all of them them to the end of the LRU to keep them together.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 82 +++++++++++++++++++++++++++++++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h |  3 +-
 3 files changed, 78 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
index d7d7ce1507ec..f8f2471d8606 100644
@@ -638,7 +638,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 				       struct amdgpu_bo_list_entry,
 				       tv.head);
 
-	r = amdgpu_vm_validate_pt_bos(p->adev, &fpriv->vm,
+	r = amdgpu_vm_validate_pt_bos(p->adev, p->filp, &fpriv->vm,
 				      amdgpu_cs_validate, p);
 	if (r) {
 		DRM_ERROR("amdgpu_vm_validate_pt_bos() failed.\n");
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +75 -7

120 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +2 -1
index fabf44b262be..a43a493f5c08 100644
@@ -257,7 +257,8 @@ void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm,
 			 struct list_head *validated,
 			 struct amdgpu_bo_list_entry *entry);
 bool amdgpu_vm_ready(struct amdgpu_vm *vm);
-int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
+int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct drm_file *filp,
+			      struct amdgpu_vm *vm,
 			      int (*callback)(void *p, struct amdgpu_bo *bo),
 			      void *param);
 int amdgpu_vm_alloc_pts(struct amdgpu_device *adev,
Signature · 6 lines
2.14.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx