]> git.hungrycats.org Git - linux/commit
drm/xe: Wait on external BO kernel fences in exec IOCTL
authorMatthew Brost <matthew.brost@intel.com>
Thu, 2 Jul 2026 21:58:05 +0000 (14:58 -0700)
committerMatthew Brost <matthew.brost@intel.com>
Fri, 3 Jul 2026 18:04:14 +0000 (11:04 -0700)
commita6b842acf3ddd1efc53a56de9260cfa718fb35e7
tree5920d5ec88cd5c890881f7bdb1a1f51056d3df4a
parent820de07bba7b7c97e0f52e1d66bf6147a25ab67f
drm/xe: Wait on external BO kernel fences in exec IOCTL

Before arming a user job, xe_exec_ioctl() only added the VM's
dma-resv KERNEL slot as a dependency. That slot covers rebinds and
the kernel operations of the VM's private BOs, but not external BOs
(bo->vm == NULL), which carry their kernel operations (evictions,
moves, ...) in their own dma-resv KERNEL slot.

The DMA_RESV_USAGE_KERNEL slot is the cross-driver contract for
memory management operations that must complete before the BO or its
backing store may be used: any accessor is required to wait on the
KERNEL fences before touching the resv. By skipping the external BOs'
KERNEL slots, the exec path violated that contract and could schedule
a user job while a kernel operation on an external BO mapped by the VM
was still in flight, racing against it and potentially reading or
writing memory that was being moved.

Replace the VM-only dependency with an iteration over every object
locked by the exec, adding each object's KERNEL slot as a job
dependency. This covers the VM resv (rebinds and private BOs) as well
as every external BO, mirroring the drm_gpuvm_resv_add_fence() call
that later publishes the job fence to the same set of objects.
Long-running mode continues to skip this, as before.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: stable@vger.kernel.org
Assisted-by: GitHub_Copilot:claude-opus-4.8
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patch.msgid.link/20260702215805.4011228-1-matthew.brost@intel.com
drivers/gpu/drm/xe/xe_exec.c