public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: add a missing lock for AMDGPU_SCHED
@ 2023-04-26  0:48 Chia-I Wu
  2023-04-26  2:27 ` Chen, Guchun
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Chia-I Wu @ 2023-04-26  0:48 UTC (permalink / raw)
  To: dri-devel
  Cc: stable, Alex Deucher, Christian König, Pan, Xinhui,
	David Airlie, Daniel Vetter, amd-gfx, linux-kernel

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.0.634.g4ca3ef3211-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-04-26 10:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-26  0:48 [PATCH] drm/amdgpu: add a missing lock for AMDGPU_SCHED Chia-I Wu
2023-04-26  2:27 ` Chen, Guchun
2023-04-26  2:48   ` Chia-I Wu
2023-04-26  4:58 ` Greg KH
2023-04-26  6:31   ` Chia-I Wu
2023-04-26 10:29 ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox