* [PATCH v2] drm/amdgpu: add a missing lock for AMDGPU_SCHED
@ 2023-04-26 6:17 Chia-I Wu
2023-04-26 6:42 ` Greg KH
2023-04-26 11:05 ` Christian König
0 siblings, 2 replies; 4+ messages in thread
From: Chia-I Wu @ 2023-04-26 6:17 UTC (permalink / raw)
To: dri-devel
Cc: stable, Alex Deucher, Christian König, Pan, Xinhui,
David Airlie, Daniel Vetter, amd-gfx, linux-kernel
mgr->ctx_handles should be protected by mgr->lock.
v2: improve commit message
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Cc: stable@vger.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.1.495.gc816e09b53d-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] drm/amdgpu: add a missing lock for AMDGPU_SCHED
2023-04-26 6:17 [PATCH v2] drm/amdgpu: add a missing lock for AMDGPU_SCHED Chia-I Wu
@ 2023-04-26 6:42 ` Greg KH
2023-04-26 11:05 ` Christian König
1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2023-04-26 6:42 UTC (permalink / raw)
To: Chia-I Wu
Cc: dri-devel, stable, Alex Deucher, Christian König, Pan,
Xinhui, David Airlie, Daniel Vetter, amd-gfx, linux-kernel
On Tue, Apr 25, 2023 at 11:17:14PM -0700, Chia-I Wu wrote:
> mgr->ctx_handles should be protected by mgr->lock.
>
> v2: improve commit message
>
> Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
> Cc: stable@vger.kernel.org
What commit id does this fix? How far back in stable kernels should
this go?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] drm/amdgpu: add a missing lock for AMDGPU_SCHED
2023-04-26 6:17 [PATCH v2] drm/amdgpu: add a missing lock for AMDGPU_SCHED Chia-I Wu
2023-04-26 6:42 ` Greg KH
@ 2023-04-26 11:05 ` Christian König
2023-04-26 22:56 ` Chia-I Wu
1 sibling, 1 reply; 4+ messages in thread
From: Christian König @ 2023-04-26 11:05 UTC (permalink / raw)
To: Chia-I Wu, dri-devel
Cc: stable, Alex Deucher, Pan, Xinhui, David Airlie, Daniel Vetter,
amd-gfx, linux-kernel
Am 26.04.23 um 08:17 schrieb Chia-I Wu:
> mgr->ctx_handles should be protected by mgr->lock.
>
> v2: improve commit message
>
> Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
> Cc: stable@vger.kernel.org
Please don't manually CC stable@vger.kernel.org while sending patches
out, let us maintainers push that upstream with the appropriate tag and
Greg picking it up from there.
A Fixes tag and figuring out to which stable versions this needs to be
backported are nice to have as well, but Alex and I can take care of
that as well.
Apart from that the technical side of the patch is Reviewed-by:
Christian König <christian.koenig@amd.com>.
Regards,
Christian.
> ---
> 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;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] drm/amdgpu: add a missing lock for AMDGPU_SCHED
2023-04-26 11:05 ` Christian König
@ 2023-04-26 22:56 ` Chia-I Wu
0 siblings, 0 replies; 4+ messages in thread
From: Chia-I Wu @ 2023-04-26 22:56 UTC (permalink / raw)
To: Christian König
Cc: dri-devel, stable, Alex Deucher, Pan, Xinhui, David Airlie,
Daniel Vetter, amd-gfx, linux-kernel
On Wed, Apr 26, 2023 at 4:05 AM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 26.04.23 um 08:17 schrieb Chia-I Wu:
> > mgr->ctx_handles should be protected by mgr->lock.
> >
> > v2: improve commit message
> >
> > Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
> > Cc: stable@vger.kernel.org
>
> Please don't manually CC stable@vger.kernel.org while sending patches
> out, let us maintainers push that upstream with the appropriate tag and
> Greg picking it up from there.
>
> A Fixes tag and figuring out to which stable versions this needs to be
> backported are nice to have as well, but Alex and I can take care of
> that as well.
>
> Apart from that the technical side of the patch is Reviewed-by:
> Christian König <christian.koenig@amd.com>.
All done. Thanks for clarifying the process and sorry for getting it
wrong in the first place :(
>
> Regards,
> Christian.
>
> > ---
> > 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;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-04-26 22:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-26 6:17 [PATCH v2] drm/amdgpu: add a missing lock for AMDGPU_SCHED Chia-I Wu
2023-04-26 6:42 ` Greg KH
2023-04-26 11:05 ` Christian König
2023-04-26 22:56 ` Chia-I Wu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).