Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Nirmoy Das <nirmoy.das@intel.com>,
	Matthew Brost <matthew.brost@intel.com>
Subject: [PATCH] drm/xe: Take job list lock in xe_sched_first_pending_job
Date: Tue,  5 Nov 2024 17:03:27 +0100	[thread overview]
Message-ID: <20241105160327.2970277-1-nirmoy.das@intel.com> (raw)

Access to the pending_list should always happens under job_list_lock.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
---
 drivers/gpu/drm/xe/xe_gpu_scheduler.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_gpu_scheduler.h b/drivers/gpu/drm/xe/xe_gpu_scheduler.h
index 64b2ae6839db..c250ea773491 100644
--- a/drivers/gpu/drm/xe/xe_gpu_scheduler.h
+++ b/drivers/gpu/drm/xe/xe_gpu_scheduler.h
@@ -71,8 +71,14 @@ static inline void xe_sched_add_pending_job(struct xe_gpu_scheduler *sched,
 static inline
 struct xe_sched_job *xe_sched_first_pending_job(struct xe_gpu_scheduler *sched)
 {
-	return list_first_entry_or_null(&sched->base.pending_list,
-					struct xe_sched_job, drm.list);
+	struct xe_sched_job *job;
+
+	spin_lock(&sched->base.job_list_lock);
+	job = list_first_entry_or_null(&sched->base.pending_list,
+				       struct xe_sched_job, drm.list);
+	spin_unlock(&sched->base.job_list_lock);
+
+	return job;
 }
 
 static inline int
-- 
2.46.0


             reply	other threads:[~2024-11-05 16:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05 16:03 Nirmoy Das [this message]
2024-11-05 16:50 ` ✓ CI.Patch_applied: success for drm/xe: Take job list lock in xe_sched_first_pending_job Patchwork
2024-11-05 16:50 ` ✓ CI.checkpatch: " Patchwork
2024-11-05 16:52 ` ✓ CI.KUnit: " Patchwork
2024-11-05 17:03 ` ✓ CI.Build: " Patchwork
2024-11-05 17:05 ` ✓ CI.Hooks: " Patchwork
2024-11-05 17:07 ` ✓ CI.checksparse: " Patchwork
2024-11-05 17:33 ` ✓ CI.BAT: " Patchwork
2024-11-05 17:50 ` [PATCH] " Matthew Brost
2024-11-05 21:56   ` Nirmoy Das
2024-11-06 21:36 ` ✗ CI.FULL: failure for " Patchwork
2024-11-07  0:38 ` ✓ CI.Patch_applied: success for drm/xe: Take job list lock in xe_sched_first_pending_job (rev2) Patchwork
2024-11-07  0:38 ` ✓ CI.checkpatch: " Patchwork
2024-11-07  0:39 ` ✓ CI.KUnit: " Patchwork
2024-11-07  0:51 ` ✓ CI.Build: " Patchwork
2024-11-07  0:53 ` ✓ CI.Hooks: " Patchwork
2024-11-07  0:55 ` ✓ CI.checksparse: " Patchwork
2024-11-07  1:19 ` ✓ CI.BAT: " Patchwork
2024-11-08  6:22 ` ✗ CI.FULL: failure " Patchwork
2024-11-12 10:04   ` Nirmoy Das

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241105160327.2970277-1-nirmoy.das@intel.com \
    --to=nirmoy.das@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox