Skip to contentSkip to conversation

drm/amdgpu: fix "move PD/PT bos on LRU again""

PATCH In review Christian König 2 participants 3 messages Aug 30, 2018 1 message not in the archive

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

PATCH 1/1 drm/amdgpu: fix "move PD/PT bos on LRU again""

Fixes the LRU corruption, we accidentially tried to move things on the LRU after dropping the reservation lock.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 5 ++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -3
index dd734970e167..349dcc37ee64 100644
@@ -1237,6 +1237,8 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
 	ring = to_amdgpu_ring(entity->rq->sched);
 	amdgpu_ring_priority_get(ring, priority);
 
+	amdgpu_vm_move_to_lru_tail(p->adev, &fpriv->vm);
+
 	ttm_eu_fence_buffer_objects(&p->ticket, &p->validated, p->fence);
 	amdgpu_mn_unlock(p->mn);
 
@@ -1258,7 +1260,6 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 	union drm_amdgpu_cs *cs = data;
 	struct amdgpu_cs_parser parser = {};
 	bool reserved_buffers = false;
-	struct amdgpu_fpriv *fpriv;
 	int i, r;
 
 	if (!adev->accel_working)
@@ -1303,8 +1304,6 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 
 	r = amdgpu_cs_submit(&parser, cs);
 
-	fpriv = filp->driver_priv;
-	amdgpu_vm_move_to_lru_tail(adev, &fpriv->vm);
 out:
 	amdgpu_cs_parser_fini(&parser, r, reserved_buffers);
 	return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index 72f8c750e128..d74c331893f0 100644
@@ -1120,7 +1120,7 @@ int amdgpu_vm_update_directories(struct amdgpu_device *adev,
 					   struct amdgpu_vm_bo_base,
 					   vm_status);
 		bo_base->moved = false;
-		list_del_init(&bo_base->vm_status);
+		list_move(&bo_base->vm_status, &vm->idle);
 
 		bo = bo_base->bo->parent;
 		if (!bo)
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): 20180830115116.85557-1-christian.koenig-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Michel can you give this one a try as well?

If I'm not completely mistaken it should fix the LRU problems.

Christian.

Am 30.08.2018 um 13:51 schrieb Christian König:

Quoted 44 lines

Fixes the LRU corruption, we accidentially tried to move things on the LRU after dropping the reservation lock.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 5 ++---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
  2 files changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -3
index dd734970e167..349dcc37ee64 100644
@@ -1237,6 +1237,8 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
  	ring = to_amdgpu_ring(entity->rq->sched);
  	amdgpu_ring_priority_get(ring, priority);
 
+	amdgpu_vm_move_to_lru_tail(p->adev, &fpriv->vm);
+
  	ttm_eu_fence_buffer_objects(&p->ticket, &p->validated, p->fence);
  	amdgpu_mn_unlock(p->mn);
 
@@ -1258,7 +1260,6 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
  	union drm_amdgpu_cs *cs = data;
  	struct amdgpu_cs_parser parser = {};
  	bool reserved_buffers = false;
-	struct amdgpu_fpriv *fpriv;
  	int i, r;
 
  	if (!adev->accel_working)
@@ -1303,8 +1304,6 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 
  	r = amdgpu_cs_submit(&parser, cs);
 
-	fpriv = filp->driver_priv;
-	amdgpu_vm_move_to_lru_tail(adev, &fpriv->vm);
  out:
  	amdgpu_cs_parser_fini(&parser, r, reserved_buffers);
  	return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -0
index 72f8c750e128..d74c331893f0 100644

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

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
@@ -1120,7 +1120,7 @@ int amdgpu_vm_update_directories(struct amdgpu_device *adev,
  					   struct amdgpu_vm_bo_base,
  					   vm_status);
  		bo_base->moved = false;
-		list_del_init(&bo_base->vm_status);
+		list_move(&bo_base->vm_status, &vm->idle);
 
  		bo = bo_base->bo->parent;
  		if (!bo)

_______________________________________________
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 4 lines · Christian König

Fixes the LRU corruption, we accidentially tried to move things on the LRU after dropping the reservation lock.

While this patch survived piglit significantly longer than before, it doesn't fully fix the problem. See the attached dmesg output.

P.S. It's also a bit confusing for the shortlog to reference the "move PD/PT bos on LRU again" commit, which probably wouldn't exist before this patch upstream (because it's been reverted in amd-staging-drm-next), while including the code change of that commit in this patch. Probably better to wait until all the bugs have been fixed, then re-apply the "move PD/PT bos on LRU again" patch.

Signature · 2 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

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