All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nouveau/fence: handle cross device fences properly.
@ 2025-01-07  5:58 Dave Airlie
  2025-01-07  6:16 ` Ben Skeggs
  2025-01-07 16:02 ` Danilo Krummrich
  0 siblings, 2 replies; 6+ messages in thread
From: Dave Airlie @ 2025-01-07  5:58 UTC (permalink / raw)
  To: dri-devel; +Cc: nouveau, dakr

From: Dave Airlie <airlied@redhat.com>

If we have two nouveau controlled devices and one passes a dma-fence
to the other, when we hit the sync path it can cause the second device
to try and put a sync wait in it's pushbuf for the seqno of the context
on the first device.

Since fence contexts are vmm bound, check the if vmm's match between
both users, this should ensure that fence seqnos don't get used wrongly
on incorrect channels.

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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c
index ee5e9d40c166f..5743c82f4094b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -370,7 +370,8 @@ nouveau_fence_sync(struct nouveau_bo *nvbo, struct nouveau_channel *chan,
 
 				rcu_read_lock();
 				prev = rcu_dereference(f->channel);
-				if (prev && (prev == chan ||
+				if (prev && (prev->vmm == chan->vmm) &&
+				    (prev == chan ||
 					     fctx->sync(f, prev, chan) == 0))
 					must_wait = false;
 				rcu_read_unlock();
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-01-08  7:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-07  5:58 [PATCH] nouveau/fence: handle cross device fences properly Dave Airlie
2025-01-07  6:16 ` Ben Skeggs
2025-01-07 16:02 ` Danilo Krummrich
2025-01-08  1:04   ` Dave Airlie
2025-01-08  1:49     ` Ben Skeggs
2025-01-08  7:39     ` Danilo Krummrich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.