Skip to content

Commit 0bb2b5a

Browse files
airliedopsiff
authored andcommitted
nouveau/fence: handle cross device fences properly
commit 1f9910b upstream. The fence sync logic doesn't handle a fence sync across devices as it tries to write to a channel offset from one device into the fence bo from a different device, which won't work so well. This patch fixes that to avoid using the sync path in the case where the fences come from different nouveau drm devices. This works fine on a single device as the fence bo is shared across the devices, and mapped into each channels vma space, the channel offsets are therefore okay to pass between sides, so one channel can sync on the seqnos from the other by using the offset into it's vma. Signed-off-by: Dave Airlie <airlied@redhat.com> Cc: stable@vger.kernel.org Reviewed-by: Ben Skeggs <bskeggs@nvidia.com> [ Fix compilation issue; remove version log from commit messsage. - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20250109005553.623947-1-airlied@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 7ef28366be721b0ed790948004bbd16a2751b836)
1 parent 6a157b6 commit 0bb2b5a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/gpu/drm/nouveau/nouveau_fence.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,11 +386,13 @@ nouveau_fence_sync(struct nouveau_bo *nvbo, struct nouveau_channel *chan,
386386
if (f) {
387387
struct nouveau_channel *prev;
388388
bool must_wait = true;
389+
bool local;
389390

390391
rcu_read_lock();
391392
prev = rcu_dereference(f->channel);
392-
if (prev && (prev == chan ||
393-
fctx->sync(f, prev, chan) == 0))
393+
local = prev && prev->cli->drm == chan->cli->drm;
394+
if (local && (prev == chan ||
395+
fctx->sync(f, prev, chan) == 0))
394396
must_wait = false;
395397
rcu_read_unlock();
396398
if (!must_wait)

0 commit comments

Comments
 (0)