drm/amdgpu: add a missing lock for AMDGPU_SCHED
Subsystems (2)
PATCH v3 1/1 drm/amdgpu: add a missing lock for AMDGPU_SCHED
mgr->ctx_handles should be protected by mgr->lock.
v2: improve commit message
v3: add a Fixes tag
Signed-off-by Chia-I Wu <[email protected]>
Reviewed-by Christian König <[email protected]>
Fixes 52c6a62c64fac ("drm/amdgpu: add interface for editing a foreign process's priority v3")
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c +5 -1
@@ -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 ;
Signature · 1 line
2.40.1.495.gc816e09b53d-goog
Alex Deucher
AppliedApplied. Thanks!
Alex
Quoted 41 lines · Chia-I Wu
mgr->ctx_handlesshould be protected bymgr->lock.v2: improve commit message
v3: add a Fixes tagSigned-off-by Chia-I Wu <[email protected]>Reviewed-by Christian König <[email protected]>Fixes 52c6a62c64fac ("drm/amdgpu: add interface for editing a foreign process's priority v3")--- drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c +5
-2@@ -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