]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe: Fix unbind of unaccessed VMA (fault mode)
authorBrian Welty <brian.welty@intel.com>
Thu, 2 Nov 2023 23:04:53 +0000 (16:04 -0700)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 21 Dec 2023 16:43:34 +0000 (11:43 -0500)
In fault mode, page table binding is deferred until fault handler.
Thus vma->tile_present will be unset unless the VMA is accessed by GPU.

During a later unbind, the logic doesn't account for the fact that local
fence variable will be NULL in this case, leading to pass NULL into
dma_fence_add_callback() and causing few WARN_ONs to print to console.
The fix is already present in the code, just hoist the fence variable
computation to be done earlier.

Resolves warnings seen with igt@xe_exec_fault_mode@once-invalid-fault

Signed-off-by: Brian Welty <brian.welty@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_vm.c

index 7aefa6aa66a15e385dc62bfa4f238311143f8207..b4a4ed28019c8e4605e51fff23d81ad6ddc7f0b3 100644 (file)
@@ -1740,14 +1740,14 @@ next:
                }
        }
 
+       fence = cf ? &cf->base : !fence ?
+               xe_exec_queue_last_fence_get(wait_exec_queue, vm) : fence;
        if (last_op) {
                for (i = 0; i < num_syncs; i++)
-                       xe_sync_entry_signal(&syncs[i], NULL,
-                                            cf ? &cf->base : fence);
+                       xe_sync_entry_signal(&syncs[i], NULL, fence);
        }
 
-       return cf ? &cf->base : !fence ?
-               xe_exec_queue_last_fence_get(wait_exec_queue, vm) : fence;
+       return fence;
 
 err_fences:
        if (fences) {