Re: [PATCH 3/5] drm/sched: Warn if pending list is not empty
From: Philipp Stanner
Date: Thu Apr 17 2025 - 03:46:01 EST
On Mon, 2025-04-07 at 17:22 +0200, Philipp Stanner wrote:
> drm_sched_fini() can leak jobs under certain circumstances.
>
> Warn if that happens.
>
> Signed-off-by: Philipp Stanner <phasta@xxxxxxxxxx>
> ---
> drivers/gpu/drm/scheduler/sched_main.c | 4 ++++
I hear a lot of amazed silence for this series ^_^
If there's no major pushback, my intention is to pull this in once the
blocking Nouveau-bug has been fixed (by pulling my patch).
In the mean time, let me review my own stuff:
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c
> b/drivers/gpu/drm/scheduler/sched_main.c
> index 6b72278c4b72..ae3152beca14 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -1465,6 +1465,10 @@ void drm_sched_fini(struct drm_gpu_scheduler
> *sched)
> sched->ready = false;
> kfree(sched->sched_rq);
> sched->sched_rq = NULL;
> +
> + if (!list_empty(&sched->pending_list))
> + dev_err(sched->dev, "%s: Tearing down scheduler
> while jobs are pending!\n",
> + __func__);
The "%s" here will be removed since dev_err() alreday prints the
function name.
I find this dev_err() print more useful than the stack a WARN_ON prints
(telling you about invalid_asm_exec_op or stuff like that).
Plus, I guess the places where drivers call drm_sched_fini() are very
well defined and known, so a callstack wouldn't really be useful in the
first place.
P.
> }
> EXPORT_SYMBOL(drm_sched_fini);
>