Skip to contentSkip to conversation

drm/scheduler: Fix job cleanup without timeout handler

PATCH In review Erico Nunes 4 participants 7 messages May 20, 2019 – May 21, 2019

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

PATCH v2 1/1 drm/scheduler: Fix job cleanup without timeout handler

After "5918045c4ed4 drm/scheduler: rework job destruction", jobs are only deleted when the timeout handler is able to be cancelled successfully.

In case no timeout handler is running (timeout == MAX_SCHEDULE_TIMEOUT), job cleanup would be skipped which may result in memory leaks.

Add the handling for the (timeout == MAX_SCHEDULE_TIMEOUT) case in drm_sched_cleanup_jobs.

Cc Christian König <[email protected]>
---
 drivers/gpu/drm/scheduler/sched_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/scheduler/sched_main.c +2 -1
index f8f0e1c19002..10d1d37e644a 100644
@@ -630,7 +630,8 @@ static void drm_sched_cleanup_jobs(struct drm_gpu_scheduler *sched)
 	unsigned long flags;
 
 	/* Don't destroy jobs while the timeout worker is running */
-	if (!cancel_delayed_work(&sched->work_tdr))
+	if (sched->timeout != MAX_SCHEDULE_TIMEOUT &&
+	    !cancel_delayed_work(&sched->work_tdr))
 		return;
 
 
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v2 1/1
#1 lore raw

Am 21.05.19 um 01:16 schrieb Erico Nunes:

Quoted 6 lines

[CAUTION: External Email]

After "5918045c4ed4 drm/scheduler: rework job destruction", jobs are only deleted when the timeout handler is able to be cancelled successfully.

Quoted 8 lines

In case no timeout handler is running (timeout == MAX_SCHEDULE_TIMEOUT), job cleanup would be skipped which may result in memory leaks.

Add the handling for the (timeout == MAX_SCHEDULE_TIMEOUT) case in drm_sched_cleanup_jobs.

Cc Christian König <[email protected]>

Going to pick that up later today into our internal branch.

Thanks for the help,
Christian.

Quoted 19 lines
---
  drivers/gpu/drm/scheduler/sched_main.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/scheduler/sched_main.c +2 -2
index f8f0e1c19002..10d1d37e644a 100644
@@ -630,7 +630,8 @@ static void drm_sched_cleanup_jobs(struct drm_gpu_scheduler *sched)
         unsigned long flags;
 
         /* Don't destroy jobs while the timeout worker is running */
-       if (!cancel_delayed_work(&sched->work_tdr))
+       if (sched->timeout != MAX_SCHEDULE_TIMEOUT &&
+           !cancel_delayed_work(&sched->work_tdr))
                 return;
 
 
--
Quoted 2 lines

2.20.1

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

#2 lore raw
Quoted 14 lines · Christian

Am 21.05.19 um 01:16 schrieb Erico Nunes:

Quoted 12 lines

[CAUTION: External Email]

After "5918045c4ed4 drm/scheduler: rework job destruction", jobs are only deleted when the timeout handler is able to be cancelled successfully.

In case no timeout handler is running (timeout == MAX_SCHEDULE_TIMEOUT), job cleanup would be skipped which may result in memory leaks.

Add the handling for the (timeout == MAX_SCHEDULE_TIMEOUT) case in drm_sched_cleanup_jobs.

Quoted 6 lines
Quoted 2 lines
Cc Christian König <[email protected]>

Going to pick that up later today into our internal branch.

Thanks. I also posted one to set lima to use a real default timeout.

Is it possible for us to still get at least one of these into a tree that goes to a linux 5.2-rc?
This issue may make lima unusable as the system runs out of memory quickly if many opengl programs are launched.

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

#3 lore raw

Am 21.05.19 um 14:16 schrieb Erico Nunes:

Quoted 21 lines

[CAUTION: External Email]

Quoted 17 lines · Christian

Am 21.05.19 um 01:16 schrieb Erico Nunes:

Quoted 6 lines

[CAUTION: External Email]

After "5918045c4ed4 drm/scheduler: rework job destruction", jobs are only deleted when the timeout handler is able to be cancelled successfully.

Quoted 8 lines

In case no timeout handler is running (timeout == MAX_SCHEDULE_TIMEOUT), job cleanup would be skipped which may result in memory leaks.

Add the handling for the (timeout == MAX_SCHEDULE_TIMEOUT) case in drm_sched_cleanup_jobs.

Cc Christian König <[email protected]>
Quoted 7 lines
Quoted 1 line

Going to pick that up later today into our internal branch.

Thanks. I also posted one to set lima to use a real default timeout.

Is it possible for us to still get at least one of these into a tree that goes to a linux 5.2-rc?
This issue may make lima unusable as the system runs out of memory quickly if many opengl programs are launched.

Alex should pick it up for his next -fixes pull this week.

Christian.

Quoted 2 lines

Erico

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

#4 lore raw
In reply to Erico Nunes
Quoted 22 lines · Erico Nunes
Quoted 19 lines · Christian

Am 21.05.19 um 01:16 schrieb Erico Nunes:

Quoted 6 lines

[CAUTION: External Email]

After "5918045c4ed4 drm/scheduler: rework job destruction", jobs are only deleted when the timeout handler is able to be cancelled successfully.

Quoted 8 lines

In case no timeout handler is running (timeout == MAX_SCHEDULE_TIMEOUT), job cleanup would be skipped which may result in memory leaks.

Add the handling for the (timeout == MAX_SCHEDULE_TIMEOUT) case in drm_sched_cleanup_jobs.

Cc Christian König <[email protected]>
Quoted 9 lines
Quoted 1 line

Going to pick that up later today into our internal branch.

Thanks. I also posted one to set lima to use a real default timeout.

Is it possible for us to still get at least one of these into a tree that goes to a linux 5.2-rc?
This issue may make lima unusable as the system runs out of memory quickly if many opengl programs are launched.

The "drm/scheduler: rework job destruction" commit is not in 5.2-rc. So no need to pick any fix to that place.

It would be better that run some tests on 5.2-rc for other possible fixes indeed.

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

#5 lore raw
In reply to Koenig, Christian
Quoted 14 lines · Christian

Am 21.05.19 um 01:16 schrieb Erico Nunes:

Quoted 12 lines

[CAUTION: External Email]

After "5918045c4ed4 drm/scheduler: rework job destruction", jobs are only deleted when the timeout handler is able to be cancelled successfully.

In case no timeout handler is running (timeout == MAX_SCHEDULE_TIMEOUT), job cleanup would be skipped which may result in memory leaks.

Add the handling for the (timeout == MAX_SCHEDULE_TIMEOUT) case in drm_sched_cleanup_jobs.

Quoted 6 lines
Quoted 2 lines
Cc Christian König <[email protected]>

Going to pick that up later today into our internal branch.

Please apply it to drm-misc-next. that is where the other gpu scheduler changes are. They are not in 5.2.

Alex

Quoted 22 lines

Thanks for the help,
Christian.

Quoted 18 lines
---
  drivers/gpu/drm/scheduler/sched_main.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/scheduler/sched_main.c +2 -1
index f8f0e1c19002..10d1d37e644a 100644
@@ -630,7 +630,8 @@ static void drm_sched_cleanup_jobs(struct drm_gpu_scheduler *sched)
         unsigned long flags;
 
         /* Don't destroy jobs while the timeout worker is running */
-       if (!cancel_delayed_work(&sched->work_tdr))
+       if (sched->timeout != MAX_SCHEDULE_TIMEOUT &&
+           !cancel_delayed_work(&sched->work_tdr))
                 return;
 
 
Quoted 8 lines
Quoted 3 lines

--
2.20.1

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

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

#6 lore raw

Am 21.05.19 um 16:13 schrieb Alex Deucher:

Quoted 17 lines

[CAUTION: External Email]

Quoted 13 lines · Christian

Am 21.05.19 um 01:16 schrieb Erico Nunes:

Quoted 12 lines

[CAUTION: External Email]

After "5918045c4ed4 drm/scheduler: rework job destruction", jobs are only deleted when the timeout handler is able to be cancelled successfully.

In case no timeout handler is running (timeout == MAX_SCHEDULE_TIMEOUT), job cleanup would be skipped which may result in memory leaks.

Add the handling for the (timeout == MAX_SCHEDULE_TIMEOUT) case in drm_sched_cleanup_jobs.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Cc Christian König <[email protected]>

Going to pick that up later today into our internal branch.

Please apply it to drm-misc-next. that is where the other gpu scheduler changes are. They are not in 5.2.

Ah! Now that makes sense again, thanks for the reminder.

Christian.

Quoted 31 lines

Alex

Quoted 28 lines

Thanks for the help,
Christian.

Quoted 19 lines
---
   drivers/gpu/drm/scheduler/sched_main.c | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/scheduler/sched_main.c +2 -2
index f8f0e1c19002..10d1d37e644a 100644
@@ -630,7 +630,8 @@ static void drm_sched_cleanup_jobs(struct drm_gpu_scheduler *sched)
          unsigned long flags;
 
          /* Don't destroy jobs while the timeout worker is running */
-       if (!cancel_delayed_work(&sched->work_tdr))
+       if (sched->timeout != MAX_SCHEDULE_TIMEOUT &&
+           !cancel_delayed_work(&sched->work_tdr))
                  return;
 
 
--
Quoted 2 lines

2.20.1

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

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