[PATCH] nouveau/fence: handle cross cli fences properly.

Dave Airlie airlied at gmail.com
Wed Jan 8 22:49:29 UTC 2025


From: Dave Airlie <airlied at redhat.com>

The fence sync logic doesn't properly account for cases where
the syncing is between two different client spaces, whether
this be on a single device or multi-device.

In the pre-nv84 case this code might work, but post nv84
the fence context vma is used to work out the addr, which means
the vmm would have to match for the sync to work properly, it
should be fine to always just check if the vmm's match before
using the sync path.

This seems to happen fairly spuriously and I found it tracking down
a multi-card regression report, that seems to work by luck before this.

Signed-off-by: Dave Airlie <airlied at redhat.com>
Cc: stable at vger.kernel.org
---
 drivers/gpu/drm/nouveau/nouveau_fence.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c
index ee5e9d40c166f..7b55ede567d84 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -367,11 +367,13 @@ nouveau_fence_sync(struct nouveau_bo *nvbo, struct nouveau_channel *chan,
 			if (f) {
 				struct nouveau_channel *prev;
 				bool must_wait = true;
+				bool local;
 
 				rcu_read_lock();
 				prev = rcu_dereference(f->channel);
-				if (prev && (prev == chan ||
-					     fctx->sync(f, prev, chan) == 0))
+				local = prev && prev->vmm == chan->vmm;
+				if (local && (prev == chan ||
+					      fctx->sync(f, prev, chan) == 0))
 					must_wait = false;
 				rcu_read_unlock();
 				if (!must_wait)
-- 
2.43.0



More information about the dri-devel mailing list