[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPaKu7SA5wWrwdP6MQvDu=3qH-QCH_iUFASmDY-VYxnrXn=2zg@mail.gmail.com>
Date: Tue, 25 Apr 2023 19:48:32 -0700
From: Chia-I Wu <olvaffe@...il.com>
To: "Chen, Guchun" <Guchun.Chen@....com>
Cc: "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"Pan, Xinhui" <Xinhui.Pan@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"stable@...r.kernel.org" <stable@...r.kernel.org>,
"amd-gfx@...ts.freedesktop.org" <amd-gfx@...ts.freedesktop.org>,
Daniel Vetter <daniel@...ll.ch>,
"Deucher, Alexander" <Alexander.Deucher@....com>,
David Airlie <airlied@...il.com>,
"Koenig, Christian" <Christian.Koenig@....com>
Subject: Re: [PATCH] drm/amdgpu: add a missing lock for AMDGPU_SCHED
On Tue, Apr 25, 2023 at 7:27 PM Chen, Guchun <Guchun.Chen@....com> wrote:
>
> From coding style's perspective, this lock/unlock handling should be put into amdgpu_ctx_priority_override.
The locking is to protect mgr->ctx_handles.
>
> Regards,
> Guchun
>
> > -----Original Message-----
> > From: amd-gfx <amd-gfx-bounces@...ts.freedesktop.org> On Behalf Of Chia-
> > I Wu
> > Sent: Wednesday, April 26, 2023 8:48 AM
> > To: dri-devel@...ts.freedesktop.org
> > Cc: Pan, Xinhui <Xinhui.Pan@....com>; linux-kernel@...r.kernel.org;
> > stable@...r.kernel.org; amd-gfx@...ts.freedesktop.org; Daniel Vetter
> > <daniel@...ll.ch>; Deucher, Alexander <Alexander.Deucher@....com>;
> > David Airlie <airlied@...il.com>; Koenig, Christian
> > <Christian.Koenig@....com>
> > Subject: [PATCH] drm/amdgpu: add a missing lock for AMDGPU_SCHED
> >
> > 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;
> > --
> > 2.40.0.634.g4ca3ef3211-goog
>
Powered by blists - more mailing lists