Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: <gregkh@linuxfoundation.org>
To: junjia.chen@intel.com,airlied@redhat.com,matthew.brost@intel.com
Cc: <stable@vger.kernel.org>
Subject: FAILED: patch "[PATCH] drm/xe: Unwrap sync fences before adding them as job" failed to apply to 7.3-stable tree
Date: Wed, 02 Dec 2026 11:54:32 +0100	[thread overview]
Message-ID: <2026120232-dragonfly-active-f474@gregkh> (raw)


The patch below does not apply to the 7.3-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.3.y
git checkout FETCH_HEAD
git cherry-pick -x e2cdad51ec53dd0f48e7f767cc1390dec69d54d4
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026120232-dragonfly-active-f474@gregkh' --subject-prefix 'PATCH 7.3.y' 'HEAD^..'

Possible dependencies:



thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From e2cdad51ec53dd0f48e7f767cc1390dec69d54d4 Mon Sep 17 00:00:00 2001
From: "Chen, Junjia" <junjia.chen@intel.com>
Date: Thu, 29 Oct 2026 00:13:58 +0800
Subject: [PATCH] drm/xe: Unwrap sync fences before adding them as job
 dependencies

A timeline syncobj point is a dma_fence_chain node that carries its own
fence context, separate from the contexts of the fences it wraps.
xe_sync_entry_add_deps() passed that container straight to
drm_sched_job_add_dependency().

drm_sched_entity_add_dependency_cb() only drops a dependency when the
fence context is one of the entity's own (fence_context or
fence_context + 1). A chain node never matches, so a wait on a point
whose inner fence is the finished fence of an earlier job on the same
exec queue is treated like a cross-queue dependency: the job is held
until the previous job has completed on the GPU. Every job queued
behind it waits too, and the ring drains before the next batch of jobs
is released.

Unwrap the fence with dma_fence_unwrap_for_each() and add each
unsignaled underlying fence as a dependency, so drm_sched sees the real
fence contexts and ignores same-entity fences. Dependencies on other
exec queues still wait for completion. drm_sched_job_add_dependency()
keeps only the latest fence per context, so the dependency array does
not grow with the length of the chain.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: stable@vger.kernel.org
Signed-off-by: Chen, Junjia <junjia.chen@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Link: https://lore.kernel.org/intel-xe/20261028161358.1917359-1-junjia.chen@intel.com/
(cherry picked from commit 3b8860fe2581a8db796150728687ba1c6b78ddab)
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

diff --git a/drivers/gpu/drm/xe/xe_sync.c b/drivers/gpu/drm/xe/xe_sync.c
index a3268465868e..48a38d64a42a 100644
--- a/drivers/gpu/drm/xe/xe_sync.c
+++ b/drivers/gpu/drm/xe/xe_sync.c
@@ -6,6 +6,7 @@
 #include "xe_sync.h"
 
 #include <linux/dma-fence-array.h>
+#include <linux/dma-fence-unwrap.h>
 #include <linux/error-injection.h>
 #include <linux/kthread.h>
 #include <linux/sched/mm.h>
@@ -234,11 +235,35 @@ ALLOW_ERROR_INJECTION(xe_sync_entry_parse, ERRNO);
 
 int xe_sync_entry_add_deps(struct xe_sync_entry *sync, struct xe_sched_job *job)
 {
-	if (sync->fence)
-		return  drm_sched_job_add_dependency(&job->drm,
-						     dma_fence_get(sync->fence));
+	struct dma_fence_unwrap iter;
+	struct dma_fence *fence;
+	int err = 0;
 
-	return 0;
+	if (!sync->fence)
+		return 0;
+
+	/*
+	 * Unwrap fence containers (e.g. dma_fence_chain from a timeline
+	 * syncobj) so the scheduler sees the underlying fences. That lets it
+	 * drop dependencies on jobs from the same entity and only wait for
+	 * jobs on the same scheduler to be scheduled, rather than waiting for
+	 * the container, which forces a full GPU completion wait and drains
+	 * the queue.
+	 */
+	dma_fence_unwrap_for_each(fence, &iter, sync->fence) {
+		/*
+		 * There is no dma_fence_unwrap_stop() helper to drop the
+		 * reference the iterator holds, so keep iterating without
+		 * doing anything once an error has occurred.
+		 */
+		if (err || dma_fence_is_signaled(fence))
+			continue;
+
+		err = drm_sched_job_add_dependency(&job->drm,
+						   dma_fence_get(fence));
+	}
+
+	return err;
 }
 
 /**


                 reply	other threads:[~2026-12-02 10:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=2026120232-dragonfly-active-f474@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=airlied@redhat.com \
    --cc=junjia.chen@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=stable@vger.kernel.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