AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/amdgpu: make all per vm BOs list
@ 2018-03-27 10:16 Chunming Zhou
       [not found] ` <20180327101654.1118-1-david1.zhou-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Chunming Zhou @ 2018-03-27 10:16 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Chunming Zhou

the list decides the lru order.

Change-Id: I8baf85aefd5781501599ff672949a9b71099a30e
Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index e9a41dd05345..5e35e23511cf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1866,6 +1866,7 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
 	}
 	bo_va->base.vm = vm;
 	bo_va->base.bo = bo;
+	INIT_LIST_HEAD(&bo_va->base.vm_bo);
 	INIT_LIST_HEAD(&bo_va->base.bo_list);
 	INIT_LIST_HEAD(&bo_va->base.vm_status);
 
@@ -1881,6 +1882,10 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
 	if (bo->tbo.resv != vm->root.base.bo->tbo.resv)
 		return bo_va;
 
+	spin_lock(&vm->status_lock);
+	list_add_tail(&bo_va->base.vm_bo, &vm->vm_bo_list);
+	spin_unlock(&vm->status_lock);
+
 	if (bo->preferred_domains &
 	    amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type))
 		return bo_va;
@@ -2237,6 +2242,7 @@ void amdgpu_vm_bo_rmv(struct amdgpu_device *adev,
 
 	spin_lock(&vm->status_lock);
 	list_del(&bo_va->base.vm_status);
+	list_del(&bo_va->base.vm_bo);
 	spin_unlock(&vm->status_lock);
 
 	list_for_each_entry_safe(mapping, next, &bo_va->valids, list) {
@@ -2409,6 +2415,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	for (i = 0; i < AMDGPU_MAX_VMHUBS; i++)
 		vm->reserved_vmid[i] = NULL;
 	spin_lock_init(&vm->status_lock);
+	INIT_LIST_HEAD(&vm->vm_bo_list);
 	INIT_LIST_HEAD(&vm->evicted);
 	INIT_LIST_HEAD(&vm->relocated);
 	INIT_LIST_HEAD(&vm->moved);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
index cf2c667ee538..1886a561c84e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
@@ -144,6 +144,9 @@ struct amdgpu_vm_bo_base {
 	struct amdgpu_vm		*vm;
 	struct amdgpu_bo		*bo;
 
+	/* protected by vm status lock */
+	struct list_head		vm_bo;
+
 	/* protected by bo being reserved */
 	struct list_head		bo_list;
 
@@ -177,6 +180,9 @@ struct amdgpu_vm {
 	/* protecting invalidated */
 	spinlock_t		status_lock;
 
+	/* protected by status lock */
+	struct list_head	vm_bo_list;
+
 	/* BOs who needs a validation */
 	struct list_head	evicted;
 
-- 
2.14.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-03-29 12:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-27 10:16 [PATCH 1/3] drm/amdgpu: make all per vm BOs list Chunming Zhou
     [not found] ` <20180327101654.1118-1-david1.zhou-5C7GfCeVMHo@public.gmane.org>
2018-03-27 10:16   ` [PATCH 2/3] drm/amdgpu: refresh per vm bo lru Chunming Zhou
     [not found]     ` <20180327101654.1118-2-david1.zhou-5C7GfCeVMHo@public.gmane.org>
2018-03-27 10:50       ` Christian König
     [not found]         ` <6afa6cca-d59c-9e64-f891-c43a741069d4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-03-27 11:56           ` Zhou, David(ChunMing)
2018-03-27 13:44           ` Christian König
     [not found]             ` <a9d42a8a-b9b5-1d89-f95e-e678829a8260-5C7GfCeVMHo@public.gmane.org>
2018-03-28  8:13               ` zhoucm1
2018-03-29  8:37                 ` zhoucm1
     [not found]                   ` <14672700-82d7-c9d8-1086-84a4d8a711bc-5C7GfCeVMHo@public.gmane.org>
2018-03-29  8:59                     ` Christian König
     [not found]                       ` <d7dad640-edd0-5aa3-9165-b19d44525a5b-5C7GfCeVMHo@public.gmane.org>
2018-03-29 12:46                         ` Chunming Zhou
2018-03-27 10:16   ` [PATCH 3/3] drm/amdgpu: re-validate per VM BOs if required v2 Chunming Zhou
2018-03-27 10:52   ` [PATCH 1/3] drm/amdgpu: make all per vm BOs list Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox