Commit 2397e3d8 authored by Chia-I Wu's avatar Chia-I Wu Committed by Alex Deucher

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: default avatarChia-I Wu <olvaffe@gmail.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Fixes: 52c6a62c ("drm/amdgpu: add interface for editing a foreign process's priority v3")
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 922a76ba
...@@ -38,6 +38,7 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev, ...@@ -38,6 +38,7 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev,
{ {
struct fd f = fdget(fd); struct fd f = fdget(fd);
struct amdgpu_fpriv *fpriv; struct amdgpu_fpriv *fpriv;
struct amdgpu_ctx_mgr *mgr;
struct amdgpu_ctx *ctx; struct amdgpu_ctx *ctx;
uint32_t id; uint32_t id;
int r; int r;
...@@ -51,8 +52,11 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev, ...@@ -51,8 +52,11 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev,
return r; 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); amdgpu_ctx_priority_override(ctx, priority);
mutex_unlock(&mgr->lock);
fdput(f); fdput(f);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment