Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tejas Upadhyay <tejas.upadhyay@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>,
	Tejas Upadhyay <tejas.upadhyay@intel.com>
Subject: [PATCH V2] drm/xe: Access port only after lock acquired
Date: Tue,  4 Jun 2024 16:15:16 +0530	[thread overview]
Message-ID: <20240604104516.766058-1-tejas.upadhyay@intel.com> (raw)

Currently, port is accessed before lock of port is acquired.
As followed at other places, lets acquire lock before accessing
for even better sync up.

V2:
  - Add port->active check under lock

Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
---
 drivers/gpu/drm/xe/xe_execlist.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_execlist.c b/drivers/gpu/drm/xe/xe_execlist.c
index db906117db6d..fcbc3bac1ebe 100644
--- a/drivers/gpu/drm/xe/xe_execlist.c
+++ b/drivers/gpu/drm/xe/xe_execlist.c
@@ -210,15 +210,16 @@ static void xe_execlist_port_wake_locked(struct xe_execlist_port *port,
 
 static void xe_execlist_make_active(struct xe_execlist_exec_queue *exl)
 {
-	struct xe_execlist_port *port = exl->port;
+	struct xe_execlist_port *port;
 	enum xe_exec_queue_priority priority = exl->q->sched_props.priority;
 
 	XE_WARN_ON(priority == XE_EXEC_QUEUE_PRIORITY_UNSET);
 	XE_WARN_ON(priority < 0);
-	XE_WARN_ON(priority >= ARRAY_SIZE(exl->port->active));
 
-	spin_lock_irq(&port->lock);
+	spin_lock_irq(&exl->port->lock);
 
+	XE_WARN_ON(priority >= ARRAY_SIZE(exl->port->active));
+	port = exl->port;
 	if (exl->active_priority != priority &&
 	    exl->active_priority != XE_EXEC_QUEUE_PRIORITY_UNSET) {
 		/* Priority changed, move it to the right list */
-- 
2.25.1


             reply	other threads:[~2024-06-04 10:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04 10:45 Tejas Upadhyay [this message]
2024-06-05  0:20 ` ✓ CI.Patch_applied: success for drm/xe: Access port only after lock acquired (rev2) Patchwork
2024-06-05  0:20 ` ✓ CI.checkpatch: " Patchwork
2024-06-05  0:21 ` ✓ CI.KUnit: " Patchwork
2024-06-05  0:32 ` ✓ CI.Build: " Patchwork
2024-06-05  0:33 ` ✗ CI.Hooks: failure " Patchwork
2024-06-05  0:34 ` ✓ CI.checksparse: success " Patchwork
2024-06-05  1:01 ` ✓ CI.BAT: " Patchwork
2024-06-05  8:43 ` [PATCH V2] drm/xe: Access port only after lock acquired Nirmoy Das
2024-06-05  9:44   ` Upadhyay, Tejas
2024-06-05  9:19 ` ✗ CI.FULL: failure for drm/xe: Access port only after lock acquired (rev2) Patchwork

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=20240604104516.766058-1-tejas.upadhyay@intel.com \
    --to=tejas.upadhyay@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /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