From: "Christian König" <christian.koenig@amd.com>
To: Wentao Liang <vulab@iscas.ac.cn>,
Alex Deucher <alexander.deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v3] drm/amdgpu: fix scheduler entity leak in cleaner shader job
Date: Mon, 22 Jun 2026 17:52:57 +0200 [thread overview]
Message-ID: <ae4a5845-b46b-475b-9f7c-06a6798c9407@amd.com> (raw)
In-Reply-To: <20260622153543.50169-1-vulab@iscas.ac.cn>
On 6/22/26 17:35, Wentao Liang wrote:
> In amdgpu_gfx_run_cleaner_shader_job(), if amdgpu_job_alloc_with_ib()
> fails, the function returns without destroying the scheduler entity,
> causing a resource leak.
>
> Fix this by adding drm_sched_entity_destroy() to the error path.
>
> Also remove the unnecessary error check for dma_fence_wait() since
> it never fails with intr=false and infinite timeout.
>
> Cc: stable@vger.kernel.org
> Fixes: 559a285816af ("drm/amdgpu: Replace 'amdgpu_job_submit_direct' with 'drm_sched_entity' in cleaner shader")
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index b8ca876694ff..523b681d0da9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -1658,7 +1658,7 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring)
> &sched, 1, NULL);
> if (r) {
> dev_err(adev->dev, "Failed setting up GFX kernel entity.\n");
> - goto err;
> + return r;
> }
>
> /*
> @@ -1685,9 +1685,7 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring)
>
> f = amdgpu_job_submit(job);
>
> - r = dma_fence_wait(f, false);
> - if (r)
> - goto err;
> + dma_fence_wait(f, false);
>
> dma_fence_put(f);
>
> @@ -1696,6 +1694,8 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring)
> return 0;
>
> err:
> + /* Clean up the scheduler entity */
> + drm_sched_entity_destroy(&entity);
That is actually redundant. The err label should just be a few more lines up and the "return 0;" changed to "return r;".
Regards,
Christian.
> return r;
> }
>
prev parent reply other threads:[~2026-06-22 15:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 15:35 Wentao Liang
2026-06-22 15:52 ` Christian König [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ae4a5845-b46b-475b-9f7c-06a6798c9407@amd.com \
--to=christian.koenig@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=vulab@iscas.ac.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®