From: "Christian König" <christian.koenig@amd.com>
To: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>,
alexander.deucher@amd.com, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm/amdgpu: don't access invalid sched
Date: Thu, 12 Dec 2024 10:28:44 +0100 [thread overview]
Message-ID: <6084d74a-e565-46ba-97a5-e54120b808fb@amd.com> (raw)
In-Reply-To: <20241211171238.805137-1-pierre-eric.pelloux-prayer@amd.com>
Am 11.12.24 um 18:10 schrieb Pierre-Eric Pelloux-Prayer:
> Since 2320c9e6a768 ("drm/sched: memset() 'job' in drm_sched_job_init()")
> accessing job->base.sched can produce unexpected results as the initialisation
> of (*job)->base.sched done in amdgpu_job_alloc is overwritten by the
> memset.
>
> This commit fixes an issue when a CS would fail validation and would
> be rejected after job->num_ibs is incremented. In this case,
> amdgpu_ib_free(ring->adev, ...) will be called, which would crash the
> machine because the ring value is bogus.
>
> To fix this, pass a NULL pointer to amdgpu_ib_free(): we can do this
> because the device is actually not used in this function.
>
> The next commit will remove the ring argument completely.
>
> Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
I would squash patch #1 and #2 together, but that isn't a must have.
We should look out for potential issues with patch #3, but I still hope
that we cleaned up all users of this pointer.
Series is Reviewed-by: Christian König <christian.koenig@amd.com>
Regards,
Christian.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> index 9b322569255e..9ec8d5a8e48c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> @@ -256,7 +256,6 @@ void amdgpu_job_set_resources(struct amdgpu_job *job, struct amdgpu_bo *gds,
>
> void amdgpu_job_free_resources(struct amdgpu_job *job)
> {
> - struct amdgpu_ring *ring = to_amdgpu_ring(job->base.sched);
> struct dma_fence *f;
> unsigned i;
>
> @@ -269,7 +268,7 @@ void amdgpu_job_free_resources(struct amdgpu_job *job)
> f = NULL;
>
> for (i = 0; i < job->num_ibs; ++i)
> - amdgpu_ib_free(ring->adev, &job->ibs[i], f);
> + amdgpu_ib_free(NULL, &job->ibs[i], f);
> }
>
> static void amdgpu_job_free_cb(struct drm_sched_job *s_job)
prev parent reply other threads:[~2024-12-12 9:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-11 17:10 [PATCH 1/3] drm/amdgpu: don't access invalid sched Pierre-Eric Pelloux-Prayer
2024-12-11 17:10 ` [PATCH 2/3] drm/amdgpu: drop the amdgpu_device argument from amdgpu_ib_free Pierre-Eric Pelloux-Prayer
2024-12-11 17:10 ` [PATCH 3/3] drm/amdgpu: remove useless init from amdgpu_job_alloc Pierre-Eric Pelloux-Prayer
2024-12-11 17:27 ` [PATCH 1/3] drm/amdgpu: don't access invalid sched Alex Deucher
2024-12-12 9:28 ` 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=6084d74a-e565-46ba-97a5-e54120b808fb@amd.com \
--to=christian.koenig@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=pierre-eric.pelloux-prayer@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 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.