]> www.infradead.org Git - linux.git/commitdiff
drm/xe: Use bookkeep slots for external BO's in exec IOCTL
authorMatthew Brost <matthew.brost@intel.com>
Wed, 11 Sep 2024 15:26:22 +0000 (08:26 -0700)
committerMatthew Brost <matthew.brost@intel.com>
Fri, 11 Oct 2024 22:59:11 +0000 (15:59 -0700)
Fix external BO's dma-resv usage in exec IOCTL using bookkeep slots
rather than write slots. This leaves syncing to user space rather than
the KMD blindly enforcing write semantics on every external BO.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Kenneth Graunke <kenneth.w.graunke@intel.com>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reported-by: Simona Vetter <simona.vetter@ffwll.ch>
Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2673
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240911152622.903058-1-matthew.brost@intel.com
drivers/gpu/drm/xe/xe_exec.c

index 7b38485817dcb44913bb46a389d8e464986cf242..f23ac1e2ed88c4026aced9c737ebd9dbd8165924 100644 (file)
  * user knows an exec writes to a BO and reads from the BO in the next exec, it
  * is the user's responsibility to pass in / out fence between the two execs).
  *
- * Implicit dependencies for external BOs are handled by using the dma-buf
- * implicit dependency uAPI (TODO: add link). To make this works each exec must
- * install the job's fence into the DMA_RESV_USAGE_WRITE slot of every external
- * BO mapped in the VM.
- *
  * We do not allow a user to trigger a bind at exec time rather we have a VM
  * bind IOCTL which uses the same in / out fence interface as exec. In that
  * sense, a VM bind is basically the same operation as an exec from the user
@@ -59,8 +54,8 @@
  * behind any pending kernel operations on any external BOs in VM or any BOs
  * private to the VM. This is accomplished by the rebinds waiting on BOs
  * DMA_RESV_USAGE_KERNEL slot (kernel ops) and kernel ops waiting on all BOs
- * slots (inflight execs are in the DMA_RESV_USAGE_BOOKING for private BOs and
- * in DMA_RESV_USAGE_WRITE for external BOs).
+ * slots (inflight execs are in the DMA_RESV_USAGE_BOOKKEEP for private BOs and
+ * for external BOs).
  *
  * Rebinds / dma-resv usage applies to non-compute mode VMs only as for compute
  * mode VMs we use preempt fences and a rebind worker (TODO: add link).
@@ -304,7 +299,8 @@ retry:
        xe_sched_job_arm(job);
        if (!xe_vm_in_lr_mode(vm))
                drm_gpuvm_resv_add_fence(&vm->gpuvm, exec, &job->drm.s_fence->finished,
-                                        DMA_RESV_USAGE_BOOKKEEP, DMA_RESV_USAGE_WRITE);
+                                        DMA_RESV_USAGE_BOOKKEEP,
+                                        DMA_RESV_USAGE_BOOKKEEP);
 
        for (i = 0; i < num_syncs; i++) {
                xe_sync_entry_signal(&syncs[i], &job->drm.s_fence->finished);