diff mbox series

nouveau/fence: handle cross cli fences properly.

Message ID 20250108224930.596928-1-airlied@gmail.com (mailing list archive)
State New
Headers show
Series nouveau/fence: handle cross cli fences properly. | expand

Commit Message

Dave Airlie Jan. 8, 2025, 10:49 p.m. UTC
From: Dave Airlie <airlied@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@redhat.com>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/nouveau/nouveau_fence.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

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)