From: "Christian König" <christian.koenig@amd.com>
To: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>,
Alex Deucher <alexander.deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: Fix Manual Execution of Cleaner Shader in Gang Submissions
Date: Wed, 26 Mar 2025 09:02:46 +0100 [thread overview]
Message-ID: <b30810ba-3e16-4f52-8b4a-070bda1bc129@amd.com> (raw)
In-Reply-To: <20250325152407.2543116-1-srinivasan.shanmugam@amd.com>
Am 25.03.25 um 16:24 schrieb Srinivasan Shanmugam:
> This commit addresses the issue where the cleaner shader was not
> correctly executed during gang submissions due to improper handling of
> the isolation spearhead.
>
> - Enhanced the `amdgpu_gfx_run_cleaner_shader_job` function to
> initialize `isolation->spearhead` with the job's scheduled fence for
> cleaner shader calls.
> - Updated the `amdgpu_vm_flush` function to properly initialize
> `isolation->spearhead` to the job's scheduled fence when the cleaner
> shader is required.
>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 ++++
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 +++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index 72af5e5a894a..807f17093006 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -1436,6 +1436,7 @@ static ssize_t amdgpu_gfx_get_available_compute_partition(struct device *dev,
> static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring)
> {
> struct amdgpu_device *adev = ring->adev;
> + struct amdgpu_isolation *isolation = &adev->isolation[ring->xcp_id];
> struct drm_gpu_scheduler *sched = &ring->sched;
> struct drm_sched_entity entity;
> struct dma_fence *f;
> @@ -1464,6 +1465,9 @@ static int amdgpu_gfx_run_cleaner_shader_job(struct amdgpu_ring *ring)
> ib->ptr[i] = ring->funcs->nop;
> ib->length_dw = ring->funcs->align_mask + 1;
>
> + if (job->base.s_fence)
> + isolation->spearhead = dma_fence_get(&job->base.s_fence->scheduled);
> +
Apart from being very risky because of not grabbing locks that will leak the previous isolation->spearhead fence.
> f = amdgpu_job_submit(job);
>
> r = dma_fence_wait(f, false);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index b5ddfcbbc9fc..e23400b53489 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -692,8 +692,10 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,
> if (need_pipe_sync)
> amdgpu_ring_emit_pipeline_sync(ring);
>
> - if (cleaner_shader_needed)
> + if (cleaner_shader_needed) {
> + isolation->spearhead = dma_fence_get(&job->base.s_fence->scheduled);
Same here.
Over all this change doesn't seem to make much sense to me.
Why exactly is isolation->spearhead not pointing to the dummy kernel job we submit?
Regards,
Christian.
> ring->funcs->emit_cleaner_shader(ring);
> + }
>
> if (vm_flush_needed) {
> trace_amdgpu_vm_flush(ring, job->vmid, job->vm_pd_addr);
next prev parent reply other threads:[~2025-03-26 8:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-25 15:24 [PATCH] drm/amdgpu: Fix Manual Execution of Cleaner Shader in Gang Submissions Srinivasan Shanmugam
2025-03-26 8:02 ` Christian König [this message]
2025-03-26 13:55 ` Alex Deucher
2025-03-26 13:58 ` Christian König
2025-03-27 9:24 ` Christian König
2025-03-27 9:37 ` SRINIVASAN SHANMUGAM
2025-03-27 13:21 ` Alex Deucher
2025-03-27 13:50 ` Christian König
2025-03-28 14:58 ` Alex Deucher
2025-03-28 15:26 ` SRINIVASAN SHANMUGAM
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=b30810ba-3e16-4f52-8b4a-070bda1bc129@amd.com \
--to=christian.koenig@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=srinivasan.shanmugam@amd.com \
/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