Skip to contentSkip to conversation

drm/amdgpu: release parent fence reference

PATCH In review Grazvydas Ignotas 5 participants 6 messages Oct 23, 2016 – Oct 28, 2016 3 messages not in the archive

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

PATCH 1/1 drm/amdgpu: release parent fence reference

It's done in amd_sched_hw_job_reset(), but not in normal job processing. Leak reported by CONFIG_SLUB_DEBUG.

---
CONFIG_SLUB_DEBUG reports more leaks related to ioctls, but I was unable to track them down...

 drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +2 -0
index 910b8d5..cfb686e 100644
@@ -522,6 +522,8 @@ static void amd_sched_process_job(struct fence *f, struct fence_cb *cb)
 
 	trace_amd_sched_process_job(s_fence);
 	fence_put(&s_fence->finished);
+	fence_put(s_fence->parent);
+	s_fence->parent = NULL;
 	wake_up_interruptible(&sched->wake_up_worker);
 }
 
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): 1477247507-11378-4-git-send-email-notasas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw
Quoted 16 lines · Grazvydas Ignotas

It's done in amd_sched_hw_job_reset(), but not in normal job processing. Leak reported by CONFIG_SLUB_DEBUG.

---
CONFIG_SLUB_DEBUG reports more leaks related to ioctls, but I was unable to track them down...

  drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +0 -0
index 910b8d5..cfb686e 100644

drivers/gpu/drm/amd/scheduler/gpu_scheduler.c static void amd_sched_process_job(struct fence *f, struct fence_cb *cb) · line 525

Quoted 4 lines
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +1 -0
@@ -522,6 +522,8 @@ static void amd_sched_process_job(struct fence *f, struct fence_cb *cb)
 
  	trace_amd_sched_process_job(s_fence);
  	fence_put(&s_fence->finished);
+	fence_put(s_fence->parent);

If I remember correctly, parent was put in sched fence release.

Regards,
David Zhou

drivers/gpu/drm/amd/scheduler/gpu_scheduler.c static void amd_sched_process_job(struct fence *f, struct fence_cb *cb) · line 529

Quoted 4 lines
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +1 -0
+	s_fence->parent = NULL;
  	wake_up_interruptible(&sched->wake_up_worker);
  }
 

_______________________________________________
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]

#4 lore raw

Am 24.10.2016 um 04:25 schrieb zhoucm1:

Quoted 14 lines · Grazvydas Ignotas
Quoted 11 lines

It's done in amd_sched_hw_job_reset(), but not in normal job processing. Leak reported by CONFIG_SLUB_DEBUG.

---
CONFIG_SLUB_DEBUG reports more leaks related to ioctls, but I was unable to track them down...

  drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 2 ++
  1 file changed, 2 insertions(+)
Quoted 10 lines

drivers/gpu/drm/amd/scheduler/gpu_scheduler.c static void amd_sched_process_job(struct fence · line 525

Quoted 9 lines
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +1 -0
index 910b8d5..cfb686e 100644
@@ -522,6 +522,8 @@ static void amd_sched_process_job(struct fence 
 *f, struct fence_cb *cb)
        trace_amd_sched_process_job(s_fence);
      fence_put(&s_fence->finished);
+    fence_put(s_fence->parent);

If I remember correctly, parent was put in sched fence release.

Yes, exactly. It's only released in amd_sched_hw_job_reset() because we want to assign a new parent fence.

So this is a clear NAK.

Regards,
Christian.

Quoted 11 lines

Regards,
David Zhou

drivers/gpu/drm/amd/scheduler/gpu_scheduler.c static void amd_sched_process_job(struct fence *f, struct fence_cb *cb) · line 528

Quoted 3 lines
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +1 -0
+    s_fence->parent = NULL;
      wake_up_interruptible(&sched->wake_up_worker);
  }

_______________________________________________
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

#5 lore raw
Quoted 31 lines · Christian König

Am 24.10.2016 um 04:25 schrieb zhoucm1:

Quoted 16 lines · Grazvydas Ignotas
Quoted 12 lines

It's done in amd_sched_hw_job_reset(), but not in normal job processing. Leak reported by CONFIG_SLUB_DEBUG.

---
CONFIG_SLUB_DEBUG reports more leaks related to ioctls, but I was unable to track them down...

  drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 2 ++
  1 file changed, 2 insertions(+)
Quoted 12 lines

drivers/gpu/drm/amd/scheduler/gpu_scheduler.c static void amd_sched_process_job(struct fence *f, · line 525

Quoted 10 lines
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +1 -0
index 910b8d5..cfb686e 100644
@@ -522,6 +522,8 @@ static void amd_sched_process_job(struct fence *f,
 struct fence_cb *cb)
        trace_amd_sched_process_job(s_fence);
      fence_put(&s_fence->finished);
+    fence_put(s_fence->parent);

If I remember correctly, parent was put in sched fence release.

Quoted 2 lines

Yes, exactly. It's only released in amd_sched_hw_job_reset() because we want to assign a new parent fence.

Well then it doesn't work, SLUB_DEBUG detects leaks on teardown, and with my patch they're gone.
Perhaps the problem is that when new parent fence is assigned, the old one is not put? I won't be able to check until the weekend, so if anybody else can do it, please go ahead.

Gražvydas
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

Am 24.10.2016 um 11:43 schrieb Grazvydas Ignotas:

Quoted 29 lines
Quoted 27 lines · Christian König

Am 24.10.2016 um 04:25 schrieb zhoucm1:

Quoted 25 lines · Grazvydas Ignotas
Quoted 17 lines

It's done in amd_sched_hw_job_reset(), but not in normal job processing. Leak reported by CONFIG_SLUB_DEBUG.

---
CONFIG_SLUB_DEBUG reports more leaks related to ioctls, but I was unable to track them down...

   drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 2 ++
   1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +0 -0
index 910b8d5..cfb686e 100644

drivers/gpu/drm/amd/scheduler/gpu_scheduler.c static void amd_sched_process_job(struct fence *f, · line 525

Quoted 4 lines
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +1 -0
@@ -522,6 +522,8 @@ static void amd_sched_process_job(struct fence *f,
 struct fence_cb *cb)
         trace_amd_sched_process_job(s_fence);
       fence_put(&s_fence->finished);
+    fence_put(s_fence->parent);

If I remember correctly, parent was put in sched fence release.

Quoted 7 lines
Quoted 2 lines

Yes, exactly. It's only released in amd_sched_hw_job_reset() because we want to assign a new parent fence.

Well then it doesn't work, SLUB_DEBUG detects leaks on teardown, and with my patch they're gone.
Perhaps the problem is that when new parent fence is assigned, the old one is not put? I won't be able to check until the weekend, so if anybody else can do it, please go ahead.

Mhm, what steps do you do to reproduce this?

I'm looking into this a bit and it sounds like we just doesn't correctly tear down the scheduler on driver unload.

Regards,
Christian.

Quoted 2 lines

Gražvydas

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

A message that is not in the archive (sent off-list or not yet received): 35ee2288-e34c-071c-38af-42e6d35ce48e-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#8 lore raw

Am 28.10.2016 um 13:47 schrieb Christian König:

Quoted 33 lines

Am 24.10.2016 um 11:43 schrieb Grazvydas Ignotas:

Quoted 32 lines
Quoted 30 lines · Christian König

Am 24.10.2016 um 04:25 schrieb zhoucm1:

Quoted 14 lines · Grazvydas Ignotas
Quoted 11 lines

It's done in amd_sched_hw_job_reset(), but not in normal job processing. Leak reported by CONFIG_SLUB_DEBUG.

---
CONFIG_SLUB_DEBUG reports more leaks related to ioctls, but I was unable to track them down...

   drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 2 ++
   1 file changed, 2 insertions(+)
Quoted 12 lines

drivers/gpu/drm/amd/scheduler/gpu_scheduler.c static void amd_sched_process_job(struct fence · line 526

Quoted 11 lines
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +1 -0
index 910b8d5..cfb686e 100644
@@ -522,6 +522,8 @@ static void amd_sched_process_job(struct fence 
 *f,
 struct fence_cb *cb)
         trace_amd_sched_process_job(s_fence);
       fence_put(&s_fence->finished);
+    fence_put(s_fence->parent);

If I remember correctly, parent was put in sched fence release.

Yes, exactly. It's only released in amd_sched_hw_job_reset() because we want to assign a new parent fence.

Quoted 7 lines
Quoted 5 lines

Well then it doesn't work, SLUB_DEBUG detects leaks on teardown, and with my patch they're gone.
Perhaps the problem is that when new parent fence is assigned, the old one is not put? I won't be able to check until the weekend, so if anybody else can do it, please go ahead.

Mhm, what steps do you do to reproduce this?

Never mind, I was able to figure out how to trigger it. You actually have to create a fence to leak it :)

Regards,
Christian.

Quoted 10 lines

I'm looking into this a bit and it sounds like we just doesn't correctly tear down the scheduler on driver unload.

Regards,
Christian.

Quoted 2 lines

Gražvydas

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