Skip to contentSkip to conversation

drm/amdgpu: fix moved list handling in the VM

PATCH In review Christian König 2 participants 2 messages Sep 1, 2017 1 message not in the archive

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

PATCH 1/1 drm/amdgpu: fix moved list handling in the VM

From: Christian König <[email protected]>

Only move BOs to the moved/relocated list when they aren't already on a list.

This prevents accidential removal from the evicted list.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +6 -3
index 8910e20..cfc8de8 100644
@@ -1177,7 +1177,8 @@ static void amdgpu_vm_invalidate_level(struct amdgpu_vm *vm,
 
 		entry->addr = ~0ULL;
 		spin_lock(&vm->status_lock);
-		list_move(&entry->base.vm_status, &vm->relocated);
+		if (list_empty(&entry->base.vm_status))
+			list_add(&entry->base.vm_status, &vm->relocated);
 		spin_unlock(&vm->status_lock);
 		amdgpu_vm_invalidate_level(vm, entry);
 	}
@@ -2090,7 +2091,8 @@ static void amdgpu_vm_bo_insert_map(struct amdgpu_device *adev,
 
 	if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) {
 		spin_lock(&vm->status_lock);
-		list_move(&bo_va->base.vm_status, &vm->moved);
+		if (list_empty(&bo_va->base.vm_status))
+			list_add(&bo_va->base.vm_status, &vm->moved);
 		spin_unlock(&vm->status_lock);
 	}
 	trace_amdgpu_vm_bo_map(bo_va, mapping);
@@ -2445,7 +2447,8 @@ void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev,
 		}
 
 		spin_lock(&bo_base->vm->status_lock);
-		list_move(&bo_base->vm_status, &bo_base->vm->moved);
+		if (list_empty(&bo_base->vm_status))
+			list_add(&bo_base->vm_status, &vm->moved);
 		spin_unlock(&bo_base->vm->status_lock);
 	}
 }
Signature · 6 lines
2.7.4

_______________________________________________
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): 1504271073-1129-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Reviewed-by Alex Deucher
#2 lore raw
Quoted 7 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Friday, September 01, 2017 9:05 AM
To: [email protected]
Subject: [PATCH] drm/amdgpu: fix moved list handling in the VM

Quoted 8 lines

From: Christian König <[email protected]>

Only move BOs to the moved/relocated list when they aren't already on a list.

This prevents accidential removal from the evicted list.

Quoted 45 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -1
index 8910e20..cfc8de8 100644
@@ -1177,7 +1177,8 @@ static void amdgpu_vm_invalidate_level(struct
 amdgpu_vm *vm,
 
 		entry->addr = ~0ULL;
 		spin_lock(&vm->status_lock);
-		list_move(&entry->base.vm_status, &vm->relocated);
+		if (list_empty(&entry->base.vm_status))
+			list_add(&entry->base.vm_status, &vm->relocated);
 		spin_unlock(&vm->status_lock);
 		amdgpu_vm_invalidate_level(vm, entry);
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -1
 	}
@@ -2090,7 +2091,8 @@ static void amdgpu_vm_bo_insert_map(struct
 amdgpu_device *adev,
 
 	if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) {
 		spin_lock(&vm->status_lock);
-		list_move(&bo_va->base.vm_status, &vm->moved);
+		if (list_empty(&bo_va->base.vm_status))
+			list_add(&bo_va->base.vm_status, &vm->moved);
 		spin_unlock(&vm->status_lock);
 	}
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -1
 	trace_amdgpu_vm_bo_map(bo_va, mapping);
@@ -2445,7 +2447,8 @@ void amdgpu_vm_bo_invalidate(struct
 amdgpu_device *adev,
 		}
 
 		spin_lock(&bo_base->vm->status_lock);
-		list_move(&bo_base->vm_status, &bo_base->vm->moved);
+		if (list_empty(&bo_base->vm_status))
+			list_add(&bo_base->vm_status, &vm->moved);
 		spin_unlock(&bo_base->vm->status_lock);
 	}

}
--
2.7.4

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