Patch "drm/xe: Skip VMAs pin when requesting signal to the last XE_EXEC" has been added to the 6.8-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/xe: Skip VMAs pin when requesting signal to the last XE_EXEC

to the 6.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-xe-skip-vmas-pin-when-requesting-signal-to-the-l.patch
and it can be found in the queue-6.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 6abebeeabf157f23417b5fb5372abfbd6e3593a1
Author: José Roberto de Souza <jose.souza@xxxxxxxxx>
Date:   Wed Mar 13 10:13:18 2024 -0700

    drm/xe: Skip VMAs pin when requesting signal to the last XE_EXEC
    
    [ Upstream commit dd8a07f06dfd946e0eea1a3323d52e7c28a6ed80 ]
    
    Doing a XE_EXEC with num_batch_buffer == 0 makes signals passed as
    argument to be signaled when the last real XE_EXEC is completed.
    But to do that it was first pinning all VMAs in drm_gpuvm_exec_lock(),
    this patch remove this pinning as it is not required.
    
    This change also help Mesa implementing memory over-commiting recovery
    as it needs to unbind not needed VMAs when the whole VM can't fit
    in GPU memory but it can only do the unbiding when the last XE_EXEC
    is completed.
    So with this change Mesa can get the signal it want without getting
    out-of-memory errors.
    
    Fixes: eb9702ad2986 ("drm/xe: Allow num_batch_buffer / num_binds == 0 in IOCTLs")
    Cc: Thomas Hellstrom <thomas.hellstrom@xxxxxxxxxxxxxxx>
    Co-developed-by: Matthew Brost <matthew.brost@xxxxxxxxx>
    Signed-off-by: José Roberto de Souza <jose.souza@xxxxxxxxx>
    Reviewed-by: Matthew Brost <matthew.brost@xxxxxxxxx>
    Signed-off-by: Matthew Brost <matthew.brost@xxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240313171318.121066-1-jose.souza@xxxxxxxxx
    (cherry picked from commit 58480c1c912ff8146d067301a0d04cca318b4a66)
    Signed-off-by: Lucas De Marchi <lucas.demarchi@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/xe/xe_exec.c b/drivers/gpu/drm/xe/xe_exec.c
index 17f26952e6656..222209b0d6904 100644
--- a/drivers/gpu/drm/xe/xe_exec.c
+++ b/drivers/gpu/drm/xe/xe_exec.c
@@ -196,6 +196,29 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
 			goto err_unlock_list;
 	}
 
+	if (!args->num_batch_buffer) {
+		err = xe_vm_lock(vm, true);
+		if (err)
+			goto err_unlock_list;
+
+		if (!xe_vm_in_lr_mode(vm)) {
+			struct dma_fence *fence;
+
+			fence = xe_sync_in_fence_get(syncs, num_syncs, q, vm);
+			if (IS_ERR(fence)) {
+				err = PTR_ERR(fence);
+				goto err_unlock_list;
+			}
+			for (i = 0; i < num_syncs; i++)
+				xe_sync_entry_signal(&syncs[i], NULL, fence);
+			xe_exec_queue_last_fence_set(q, vm, fence);
+			dma_fence_put(fence);
+		}
+
+		xe_vm_unlock(vm);
+		goto err_unlock_list;
+	}
+
 	vm_exec.vm = &vm->gpuvm;
 	vm_exec.num_fences = 1 + vm->xe->info.tile_count;
 	vm_exec.flags = DRM_EXEC_INTERRUPTIBLE_WAIT;
@@ -216,24 +239,6 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
 		goto err_exec;
 	}
 
-	if (!args->num_batch_buffer) {
-		if (!xe_vm_in_lr_mode(vm)) {
-			struct dma_fence *fence;
-
-			fence = xe_sync_in_fence_get(syncs, num_syncs, q, vm);
-			if (IS_ERR(fence)) {
-				err = PTR_ERR(fence);
-				goto err_exec;
-			}
-			for (i = 0; i < num_syncs; i++)
-				xe_sync_entry_signal(&syncs[i], NULL, fence);
-			xe_exec_queue_last_fence_set(q, vm, fence);
-			dma_fence_put(fence);
-		}
-
-		goto err_exec;
-	}
-
 	if (xe_exec_queue_is_lr(q) && xe_exec_queue_ring_full(q)) {
 		err = -EWOULDBLOCK;	/* Aliased to -EAGAIN */
 		skip_retry = true;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux