All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: fix "move PD/PT bos on LRU again""
@ 2018-08-30 11:51 Christian König
       [not found] ` <20180830115116.85557-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2018-08-30 11:51 UTC (permalink / raw
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 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(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index dd734970e167..349dcc37ee64 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -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;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 72f8c750e128..d74c331893f0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -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)
-- 
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] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: fix "move PD/PT bos on LRU again""
       [not found] ` <20180830115116.85557-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
@ 2018-08-30 14:10   ` Christian König
  2018-08-30 14:48   ` Michel Dänzer
  1 sibling, 0 replies; 3+ messages in thread
From: Christian König @ 2018-08-30 14:10 UTC (permalink / raw
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Daenzer, Michel

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:
> Fixes the LRU corruption, we accidentially tried to move things on the
> LRU after dropping the reservation lock.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>   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(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index dd734970e167..349dcc37ee64 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -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;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 72f8c750e128..d74c331893f0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -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
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH] drm/amdgpu: fix "move PD/PT bos on LRU again""
       [not found] ` <20180830115116.85557-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
  2018-08-30 14:10   ` Christian König
@ 2018-08-30 14:48   ` Michel Dänzer
  1 sibling, 0 replies; 3+ messages in thread
From: Michel Dänzer @ 2018-08-30 14:48 UTC (permalink / raw
  To: Christian König; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

[-- Attachment #1: Type: text/plain, Size: 928 bytes --]

On 2018-08-30 1:51 p.m., Christian König wrote:
> Fixes the LRU corruption, we accidentially tried to move things on the
> LRU after dropping the reservation lock.
> 
> Signed-off-by: Christian König <christian.koenig-5C7GfCeVMHo@public.gmane.org>

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.

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

[-- Attachment #2: kern.log.gz --]
[-- Type: application/gzip, Size: 65461 bytes --]

[-- Attachment #3: Type: text/plain, Size: 154 bytes --]

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

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

end of thread, other threads:[~2018-08-30 14:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-30 11:51 [PATCH] drm/amdgpu: fix "move PD/PT bos on LRU again"" Christian König
     [not found] ` <20180830115116.85557-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-30 14:10   ` Christian König
2018-08-30 14:48   ` Michel Dänzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.