Skip to contentSkip to conversation

drm/amdgpu: simplify bo_va list when vm bo update

PATCH Superseded Junwei Zhang 2 participants 3 messages Apr 19, 2018 2 messages not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: simplify bo_va list when vm bo update

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +9 -12
index 8c34060..93ad925 100644
@@ -1561,19 +1561,16 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 	}
 
 	spin_lock(&vm->status_lock);
-	if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) {
-		unsigned mem_type = bo->tbo.mem.mem_type;
+	list_del_init(&bo_va->base.vm_status);
 
-		/* 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.
-		 */
-		list_del_init(&bo_va->base.vm_status);
-		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);
-	}
+	/* 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.
+	 */
+	unsigned mem_type = bo->tbo.mem.mem_type;
+	if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv &&
+		!(bo->preferred_domains & amdgpu_mem_type_to_domain(mem_type)))
+		list_add_tail(&bo_va->base.vm_status, &vm->evicted);
 	spin_unlock(&vm->status_lock);
 
 	list_splice_init(&bo_va->invalids, &bo_va->valids);
Signature · 6 lines
1.9.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): 1524115892-22616-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 22 lines · Junwei Zhang
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 21 +++++++++------------
  1 file changed, 9 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -7
index 8c34060..93ad925 100644
@@ -1561,19 +1561,16 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
  	}
 
  	spin_lock(&vm->status_lock);
-	if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) {
-		unsigned mem_type = bo->tbo.mem.mem_type;
+	list_del_init(&bo_va->base.vm_status);
 
-		/* 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.
-		 */
-		list_del_init(&bo_va->base.vm_status);

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 1570

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5 -5
-		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);
-	}
+	/* 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.
+	 */
+	unsigned mem_type = bo->tbo.mem.mem_type;

Don't you get compiling warning for defining var between code?

Regards,
David Zhou

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 1576

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +3 -0
+	if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv &&
+		!(bo->preferred_domains & amdgpu_mem_type_to_domain(mem_type)))
+		list_add_tail(&bo_va->base.vm_status, &vm->evicted);
  	spin_unlock(&vm->status_lock);
 
  	list_splice_init(&bo_va->invalids, &bo_va->valids);

_______________________________________________
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): 5c9f7bf7-df86-4201-24f2-7adadef1f1c1-5C7GfCeVMHo@public.gmane.org

#4 lore raw
Quoted 27 lines · On 04/19/2018 02:26 PM, zhoucm1 wrote:
Quoted 24 lines · Junwei Zhang
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 21 +++++++++------------
  1 file changed, 9 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -10
index 8c34060..93ad925 100644
@@ -1561,19 +1561,16 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
      }
      spin_lock(&vm->status_lock);
-    if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) {
-        unsigned mem_type = bo->tbo.mem.mem_type;
+    list_del_init(&bo_va->base.vm_status);
-        /* 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.
-         */
-        list_del_init(&bo_va->base.vm_status);
-        if (!(bo->preferred_domains & amdgpu_mem_type_to_domain(mem_type)))
-            list_add_tail(&bo_va->base.vm_status, &vm->evicted);
-    } else {
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 1570

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5 -2
-        list_del_init(&bo_va->base.vm_status);
-    }
+    /* 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.
+     */
+    unsigned mem_type = bo->tbo.mem.mem_type;

Don't you get compiling warning for defining var between code?

Thanks to reminder that.
Fixed in v2.

Jerry

Quoted 9 lines

Regards,
David Zhou

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c int amdgpu_vm_bo_update(struct amdgpu_device *adev, · line 1576

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +3 -0
+    if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv &&
+        !(bo->preferred_domains & amdgpu_mem_type_to_domain(mem_type)))
+        list_add_tail(&bo_va->base.vm_status, &vm->evicted);
      spin_unlock(&vm->status_lock);
      list_splice_init(&bo_va->invalids, &bo_va->valids);
Quoted 4 lines

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

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