All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/scheduler: Fix job cleanup without timeout handler
@ 2019-05-20 23:16 Erico Nunes
  2019-05-21  6:47 ` Koenig, Christian
  0 siblings, 1 reply; 7+ messages in thread
From: Erico Nunes @ 2019-05-20 23:16 UTC (permalink / raw)
  To: Qiang Yu, David Airlie, Daniel Vetter, Alex Deucher,
	christian.koenig, Nayan Deshmukh, Andrey Grodzovsky, Eric Anholt,
	Sharat Masetty, dri-devel, lima
  Cc: Erico Nunes

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.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Cc: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/scheduler/sched_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index f8f0e1c19002..10d1d37e644a 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -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;
 
 
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v2] drm/scheduler: Fix job cleanup without timeout handler
  2019-05-20 23:16 [PATCH v2] drm/scheduler: Fix job cleanup without timeout handler Erico Nunes
@ 2019-05-21  6:47 ` Koenig, Christian
  2019-05-21 12:16   ` Erico Nunes
  2019-05-21 14:13   ` Alex Deucher
  0 siblings, 2 replies; 7+ messages in thread
From: Koenig, Christian @ 2019-05-21  6:47 UTC (permalink / raw)
  To: Erico Nunes, Qiang Yu, David Airlie, Daniel Vetter, Deucher,
	Alexander, Nayan Deshmukh, Grodzovsky, Andrey, Eric Anholt,
	Sharat Masetty, dri-devel, lima

Am 21.05.19 um 01:16 schrieb Erico Nunes:
> [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.
>
> Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
> Cc: Christian König <christian.koenig@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

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

Thanks for the help,
Christian.

> ---
>   drivers/gpu/drm/scheduler/sched_main.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index f8f0e1c19002..10d1d37e644a 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -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;
>
>
> --
> 2.20.1
>

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v2] drm/scheduler: Fix job cleanup without timeout handler
  2019-05-21  6:47 ` Koenig, Christian
@ 2019-05-21 12:16   ` Erico Nunes
  2019-05-21 12:52     ` Koenig, Christian
  2019-05-21 13:03     ` Qiang Yu
  2019-05-21 14:13   ` Alex Deucher
  1 sibling, 2 replies; 7+ messages in thread
From: Erico Nunes @ 2019-05-21 12:16 UTC (permalink / raw)
  To: Koenig, Christian
  Cc: lima, David Airlie, Sharat Masetty, dri-devel, Nayan Deshmukh,
	Qiang Yu, Deucher, Alexander

On Tue, May 21, 2019 at 8:47 AM Koenig, Christian
<Christian.Koenig@amd.com> wrote:
>
> Am 21.05.19 um 01:16 schrieb Erico Nunes:
> > [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.
> >
> > Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
> > Cc: Christian König <christian.koenig@amd.com>
>
> Reviewed-by: Christian König <christian.koenig@amd.com>
>
> 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
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v2] drm/scheduler: Fix job cleanup without timeout handler
  2019-05-21 12:16   ` Erico Nunes
@ 2019-05-21 12:52     ` Koenig, Christian
  2019-05-21 13:03     ` Qiang Yu
  1 sibling, 0 replies; 7+ messages in thread
From: Koenig, Christian @ 2019-05-21 12:52 UTC (permalink / raw)
  To: Erico Nunes
  Cc: lima, David Airlie, Sharat Masetty, dri-devel, Nayan Deshmukh,
	Qiang Yu, Deucher, Alexander

Am 21.05.19 um 14:16 schrieb Erico Nunes:
> [CAUTION: External Email]
>
> On Tue, May 21, 2019 at 8:47 AM Koenig, Christian
> <Christian.Koenig@amd.com> wrote:
>> Am 21.05.19 um 01:16 schrieb Erico Nunes:
>>> [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.
>>>
>>> Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
>>> Cc: Christian König <christian.koenig@amd.com>
>> Reviewed-by: Christian König <christian.koenig@amd.com>
>>
>> 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.

>
> Erico

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v2] drm/scheduler: Fix job cleanup without timeout handler
  2019-05-21 12:16   ` Erico Nunes
  2019-05-21 12:52     ` Koenig, Christian
@ 2019-05-21 13:03     ` Qiang Yu
  1 sibling, 0 replies; 7+ messages in thread
From: Qiang Yu @ 2019-05-21 13:03 UTC (permalink / raw)
  To: Erico Nunes
  Cc: lima, David Airlie, Sharat Masetty, dri-devel, Nayan Deshmukh,
	Deucher, Alexander, Koenig, Christian

On Tue, May 21, 2019 at 8:17 PM Erico Nunes <nunes.erico@gmail.com> wrote:
>
> On Tue, May 21, 2019 at 8:47 AM Koenig, Christian
> <Christian.Koenig@amd.com> wrote:
> >
> > Am 21.05.19 um 01:16 schrieb Erico Nunes:
> > > [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.
> > >
> > > Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
> > > Cc: Christian König <christian.koenig@amd.com>
> >
> > Reviewed-by: Christian König <christian.koenig@amd.com>
> >
> > 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
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v2] drm/scheduler: Fix job cleanup without timeout handler
  2019-05-21  6:47 ` Koenig, Christian
  2019-05-21 12:16   ` Erico Nunes
@ 2019-05-21 14:13   ` Alex Deucher
  2019-05-21 14:15     ` Koenig, Christian
  1 sibling, 1 reply; 7+ messages in thread
From: Alex Deucher @ 2019-05-21 14:13 UTC (permalink / raw)
  To: Koenig, Christian
  Cc: lima, David Airlie, Sharat Masetty, dri-devel, Nayan Deshmukh,
	Qiang Yu, Deucher, Alexander, Erico Nunes

On Tue, May 21, 2019 at 2:48 AM Koenig, Christian
<Christian.Koenig@amd.com> wrote:
>
> Am 21.05.19 um 01:16 schrieb Erico Nunes:
> > [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.
> >
> > Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
> > Cc: Christian König <christian.koenig@amd.com>
>
> Reviewed-by: Christian König <christian.koenig@amd.com>
>
> 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

>
> Thanks for the help,
> Christian.
>
> > ---
> >   drivers/gpu/drm/scheduler/sched_main.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> > index f8f0e1c19002..10d1d37e644a 100644
> > --- a/drivers/gpu/drm/scheduler/sched_main.c
> > +++ b/drivers/gpu/drm/scheduler/sched_main.c
> > @@ -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;
> >
> >
> > --
> > 2.20.1
> >
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v2] drm/scheduler: Fix job cleanup without timeout handler
  2019-05-21 14:13   ` Alex Deucher
@ 2019-05-21 14:15     ` Koenig, Christian
  0 siblings, 0 replies; 7+ messages in thread
From: Koenig, Christian @ 2019-05-21 14:15 UTC (permalink / raw)
  To: Alex Deucher
  Cc: lima, David Airlie, Sharat Masetty, dri-devel, Nayan Deshmukh,
	Qiang Yu, Deucher, Alexander, Erico Nunes

Am 21.05.19 um 16:13 schrieb Alex Deucher:
> [CAUTION: External Email]
>
> On Tue, May 21, 2019 at 2:48 AM Koenig, Christian
> <Christian.Koenig@amd.com> wrote:
>> Am 21.05.19 um 01:16 schrieb Erico Nunes:
>>> [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.
>>>
>>> Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
>>> Cc: Christian König <christian.koenig@amd.com>
>> Reviewed-by: Christian König <christian.koenig@amd.com>
>>
>> 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.

>
> Alex
>
>> Thanks for the help,
>> Christian.
>>
>>> ---
>>>    drivers/gpu/drm/scheduler/sched_main.c | 3 ++-
>>>    1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
>>> index f8f0e1c19002..10d1d37e644a 100644
>>> --- a/drivers/gpu/drm/scheduler/sched_main.c
>>> +++ b/drivers/gpu/drm/scheduler/sched_main.c
>>> @@ -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;
>>>
>>>
>>> --
>>> 2.20.1
>>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2019-05-21 14:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20 23:16 [PATCH v2] drm/scheduler: Fix job cleanup without timeout handler Erico Nunes
2019-05-21  6:47 ` Koenig, Christian
2019-05-21 12:16   ` Erico Nunes
2019-05-21 12:52     ` Koenig, Christian
2019-05-21 13:03     ` Qiang Yu
2019-05-21 14:13   ` Alex Deucher
2019-05-21 14:15     ` Koenig, Christian

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.