Skip to contentSkip to conversation

drm/amdgpu: fix list not initialized

PATCH In review Chunming Zhou 4 participants 5 messages Apr 18, 2018 – Apr 19, 2018 3 messages not in the archive

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

PATCH 1/1 drm/amdgpu: fix list not initialized

Otherwise, cpu stuck for 22s with kernel panic.

Change-Id I5b87cde662a4658c9ab253ba88d009c9628a44ca
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -2
index f0fbc331aa30..7131ad13c5b5 100644
@@ -1563,10 +1563,9 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 		 * 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);
 	} else {
 		list_del_init(&bo_va->base.vm_status);
 	}
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): [email protected]

#2 lore raw

Am 18.04.2018 um 12:37 schrieb Chunming Zhou:

Quoted 13 lines

Otherwise, cpu stuck for 22s with kernel panic.

Change-Id I5b87cde662a4658c9ab253ba88d009c9628a44ca
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index f0fbc331aa30..7131ad13c5b5 100644

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

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -2
@@ -1563,10 +1563,9 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
  		 * 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);

Good catch, but I think I would prefer to replace list_add_tail() with list_move_tail() instead of moving the list_del_init().

But just a nit pick. Either way the patch is Reviewed-by: Christian König <[email protected]>.

Regards,
Christian.

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

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
  	} else {
  		list_del_init(&bo_va->base.vm_status);
  	}

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

#3 lore raw
In reply to a message not in the archive
Quoted 14 lines · Chunming Zhou

Otherwise, cpu stuck for 22s with kernel panic.

Change-Id I5b87cde662a4658c9ab253ba88d009c9628a44ca
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index f0fbc331aa30..7131ad13c5b5 100644
@@ -1563,10 +1563,9 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
  		 * the evicted list so that it gets validated again on the

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

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -2
  		 * 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);
  	} else {
  		list_del_init(&bo_va->base.vm_status);
  	}

We may simplify the logic as below.
How do you think?

        list_del_init(&bo_va->base.vm_status);
        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 && 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);

Jerry

Quoted 1 line

_______________________________________________
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): [email protected]

#5 lore raw
Quoted 29 lines · Jerry (Junwei)
Quoted 24 lines · Chunming Zhou

Otherwise, cpu stuck for 22s with kernel panic.

Change-Id I5b87cde662a4658c9ab253ba88d009c9628a44ca

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 +--

  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -2
index f0fbc331aa30..7131ad13c5b5 100644
@@ -1563,10 +1563,9 @@ int amdgpu_vm_bo_update(struct amdgpu_device 
 *adev,
            * 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);
       } else {
           list_del_init(&bo_va->base.vm_status);
Quoted 1 line

      }

We may simplify the logic as below.
How do you think?

Quoted 9 lines

        list_del_init(&bo_va->base.vm_status);
        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 && 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);

Looks good, but I already pushed that patch just now. if you like, you can make a simplify patch with your idea.

Regards,
David Zhou

Quoted 8 lines

Jerry

Quoted 1 line

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): 337da6ff-3950-2dad-4c06-b5d72b3ff397-5C7GfCeVMHo@public.gmane.org

#7 lore raw
Quoted 41 lines · On 04/19/2018 10:30 AM, zhoucm1 wrote:
Quoted 37 lines · Jerry (Junwei)
Quoted 15 lines · Chunming Zhou

Otherwise, cpu stuck for 22s with kernel panic.

Change-Id I5b87cde662a4658c9ab253ba88d009c9628a44ca
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index f0fbc331aa30..7131ad13c5b5 100644
@@ -1563,10 +1563,9 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
           * the evicted list so that it gets validated again on the

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

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -2
           * 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);
      } else {
          list_del_init(&bo_va->base.vm_status);
      }

We may simplify the logic as below.
How do you think?

        list_del_init(&bo_va->base.vm_status);
        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 && bo->tbo.resv == vm->root.base.bo->tbo.resv) &&
                (!(bo->preferred_domains & amdgpu_mem_type_to_domain(mem_type))))
Quoted 1 line

list_add_tail(&bo_va->base.vm_status, &vm->evicted);

Quoted 2 lines

Looks good, but I already pushed that patch just now. if you like, you can make a simplify patch with your idea.

Sure, I will.

Jerry

Quoted 12 lines

Regards,
David Zhou

Quoted 8 lines

Jerry

Quoted 1 line

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

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