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 Auld <matthew.auld@intel.com>
Subject: [PATCH v2] drm/xe/ufence: Kick ufence immediately when possible
Date: Thu, 17 Oct 2024 11:42:37 +0200	[thread overview]
Message-ID: <20241017094237.279327-1-nirmoy.das@intel.com> (raw)

If the backing fence is signaled then signal ufence soon with
system_wq. This should reduce load from the xe ordered_wq and also
won't block signaling a ufence which doesn't require any serialization.

v2: fix system_wq typo

Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1630
Cc: Matthew Auld <matthew.auld@intel.com>
gc: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
---
 drivers/gpu/drm/xe/xe_sync.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_sync.c b/drivers/gpu/drm/xe/xe_sync.c
index c6cf227ead40..1a7907293088 100644
--- a/drivers/gpu/drm/xe/xe_sync.c
+++ b/drivers/gpu/drm/xe/xe_sync.c
@@ -89,10 +89,14 @@ static void user_fence_worker(struct work_struct *w)
 	user_fence_put(ufence);
 }
 
-static void kick_ufence(struct xe_user_fence *ufence, struct dma_fence *fence)
+static void kick_ufence(struct xe_user_fence *ufence, struct dma_fence *fence,
+			bool signaled)
 {
 	INIT_WORK(&ufence->worker, user_fence_worker);
-	queue_work(ufence->xe->ordered_wq, &ufence->worker);
+	if (signaled)
+		queue_work(system_wq, &ufence->worker);
+	else
+		queue_work(ufence->xe->ordered_wq, &ufence->worker);
 	dma_fence_put(fence);
 }
 
@@ -100,7 +104,7 @@ static void user_fence_cb(struct dma_fence *fence, struct dma_fence_cb *cb)
 {
 	struct xe_user_fence *ufence = container_of(cb, struct xe_user_fence, cb);
 
-	kick_ufence(ufence, fence);
+	kick_ufence(ufence, fence, false);
 }
 
 int xe_sync_entry_parse(struct xe_device *xe, struct xe_file *xef,
@@ -236,7 +240,7 @@ void xe_sync_entry_signal(struct xe_sync_entry *sync, struct dma_fence *fence)
 		err = dma_fence_add_callback(fence, &sync->ufence->cb,
 					     user_fence_cb);
 		if (err == -ENOENT) {
-			kick_ufence(sync->ufence, fence);
+			kick_ufence(sync->ufence, fence, true);
 		} else if (err) {
 			XE_WARN_ON("failed to add user fence");
 			user_fence_put(sync->ufence);
-- 
2.46.0


             reply	other threads:[~2024-10-17 10:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17  9:42 Nirmoy Das [this message]
2024-10-17 10:29 ` ✓ CI.Patch_applied: success for drm/xe/ufence: Kick ufence immediately when possible (rev2) Patchwork
2024-10-17 10:29 ` ✓ CI.checkpatch: " Patchwork
2024-10-17 10:30 ` ✓ CI.KUnit: " Patchwork
2024-10-17 10:42 ` ✓ CI.Build: " Patchwork
2024-10-17 10:44 ` ✓ CI.Hooks: " Patchwork
2024-10-17 10:45 ` ✓ CI.checksparse: " Patchwork
2024-10-17 11:09 ` ✓ CI.BAT: " Patchwork
2024-10-17 20:55 ` ✗ CI.FULL: failure " Patchwork
2024-10-17 23:53 ` [PATCH v2] drm/xe/ufence: Kick ufence immediately when possible Matthew Brost
2024-10-17 23:58   ` Matthew Brost
2024-10-18 13:32   ` Nirmoy Das
2024-10-21 12:32 ` Jani Nikula
2024-10-21 14:08   ` 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=20241017094237.279327-1-nirmoy.das@intel.com \
    --to=nirmoy.das@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@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