Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe: Don't use drm exec locking in SVM pagefaults
@ 2025-06-03 17:40 Matthew Brost
  2025-06-03 17:43 ` ✓ CI.Patch_applied: success for " Patchwork
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: Matthew Brost @ 2025-06-03 17:40 UTC (permalink / raw)
  To: intel-xe; +Cc: thomas.hellstrom, himal.prasad.ghimiray

Only the VM dma-resv lock is needed in SVM pagefaults so
xe_vm_lock/unlock can be used instead of drm exec. Micro optimization
but should save some CPU cycles in a critical path.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_svm.c | 36 +++++++++++++-----------------------
 1 file changed, 13 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
index f27fb9b588de..952b75a4264d 100644
--- a/drivers/gpu/drm/xe/xe_svm.c
+++ b/drivers/gpu/drm/xe/xe_svm.c
@@ -858,7 +858,6 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
 			vm->xe->atomic_svm_timeslice_ms : 0,
 	};
 	struct xe_svm_range *range;
-	struct drm_exec exec;
 	struct dma_fence *fence;
 	struct xe_tile *tile = gt_to_tile(gt);
 	int migrate_try_count = ctx.devmem_only ? 3 : 1;
@@ -933,30 +932,21 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
 	range_debug(range, "PAGE FAULT - BIND");
 
 retry_bind:
-	drm_exec_init(&exec, 0, 0);
-	drm_exec_until_all_locked(&exec) {
-		err = drm_exec_lock_obj(&exec, vm->gpuvm.r_obj);
-		drm_exec_retry_on_contention(&exec);
-		if (err) {
-			drm_exec_fini(&exec);
-			goto err_out;
-		}
-
-		fence = xe_vm_range_rebind(vm, vma, range, BIT(tile->id));
-		if (IS_ERR(fence)) {
-			drm_exec_fini(&exec);
-			err = PTR_ERR(fence);
-			if (err == -EAGAIN) {
-				ctx.timeslice_ms <<= 1;	/* Double timeslice if we have to retry */
-				range_debug(range, "PAGE FAULT - RETRY BIND");
-				goto retry;
-			}
-			if (xe_vm_validate_should_retry(&exec, err, &end))
-				goto retry_bind;
-			goto err_out;
+	xe_vm_lock(vm, false);
+	fence = xe_vm_range_rebind(vm, vma, range, BIT(tile->id));
+	if (IS_ERR(fence)) {
+		xe_vm_unlock(vm);
+		err = PTR_ERR(fence);
+		if (err == -EAGAIN) {
+			ctx.timeslice_ms <<= 1;	/* Double timeslice if we have to retry */
+			range_debug(range, "PAGE FAULT - RETRY BIND");
+			goto retry;
 		}
+		if (xe_vm_validate_should_retry(NULL, err, &end))
+			goto retry_bind;
+		goto err_out;
 	}
-	drm_exec_fini(&exec);
+	xe_vm_unlock(vm);
 
 	dma_fence_wait(fence, false);
 	dma_fence_put(fence);
-- 
2.34.1


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

end of thread, other threads:[~2025-06-11 19:47 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-03 17:40 [PATCH] drm/xe: Don't use drm exec locking in SVM pagefaults Matthew Brost
2025-06-03 17:43 ` ✓ CI.Patch_applied: success for " Patchwork
2025-06-03 17:43 ` ✓ CI.checkpatch: " Patchwork
2025-06-03 17:44 ` ✗ CI.KUnit: failure " Patchwork
2025-06-05 20:52 ` ✓ CI.Patch_applied: success for drm/xe: Don't use drm exec locking in SVM pagefaults (rev2) Patchwork
2025-06-05 20:53 ` ✓ CI.checkpatch: " Patchwork
2025-06-05 20:54 ` ✓ CI.KUnit: " Patchwork
2025-06-05 21:11 ` ✓ CI.Build: " Patchwork
2025-06-05 21:14 ` ✓ CI.Hooks: " Patchwork
2025-06-05 21:15 ` ✓ CI.checksparse: " Patchwork
2025-06-05 22:21 ` ✓ Xe.CI.BAT: " Patchwork
2025-06-07 15:25 ` ✓ Xe.CI.Full: " Patchwork
2025-06-08  2:41 ` ✗ Xe.CI.Full: failure " Patchwork
2025-06-11 19:25 ` [PATCH] drm/xe: Don't use drm exec locking in SVM pagefaults Maarten Lankhorst
2025-06-11 19:47 ` Summers, Stuart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox