[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b76af325-0b4d-25bf-a009-fbbbb3f99146@amd.com>
Date: Wed, 26 Apr 2023 12:29:32 +0200
From: Christian König <christian.koenig@....com>
To: Chia-I Wu <olvaffe@...il.com>, dri-devel@...ts.freedesktop.org
Cc: stable@...r.kernel.org, Alex Deucher <alexander.deucher@....com>,
"Pan, Xinhui" <Xinhui.Pan@....com>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>, amd-gfx@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/amdgpu: add a missing lock for AMDGPU_SCHED
Am 26.04.23 um 02:48 schrieb Chia-I Wu:
Good catch, but you need some commit message here. Something like "Need
to hold the lock while iterating the idr to make sure no context is
destroyed." should be sufficient.
Apart from that looks good to me.
Regards,
Christian.
> Signed-off-by: Chia-I Wu <olvaffe@...il.com>
> Cc: stable@...r.kernel.org
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
> index e9b45089a28a6..863b2a34b2d64 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
> @@ -38,6 +38,7 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev,
> {
> struct fd f = fdget(fd);
> struct amdgpu_fpriv *fpriv;
> + struct amdgpu_ctx_mgr *mgr;
> struct amdgpu_ctx *ctx;
> uint32_t id;
> int r;
> @@ -51,8 +52,11 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev,
> return r;
> }
>
> - idr_for_each_entry(&fpriv->ctx_mgr.ctx_handles, ctx, id)
> + mgr = &fpriv->ctx_mgr;
> + mutex_lock(&mgr->lock);
> + idr_for_each_entry(&mgr->ctx_handles, ctx, id)
> amdgpu_ctx_priority_override(ctx, priority);
> + mutex_unlock(&mgr->lock);
>
> fdput(f);
> return 0;
Powered by blists - more mailing lists