Skip to content

Commit 1b36ea2

Browse files
mbrost05lucasdemarchi
authored andcommitted
drm/xe: Timeslice GPU on atomic SVM fault
Ensure GPU can make forward progress on an atomic SVM GPU fault by giving the GPU a timeslice of 5ms v2: - Reduce timeslice to 5ms - Double timeslice on retry - Split out GPU SVM changes into independent patch v5: - Double timeslice in a few more places Fixes: 2f118c9 ("drm/xe: Add SVM VRAM migration") Cc: stable@vger.kernel.org Signed-off-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com> Link: https://lore.kernel.org/r/20250512135500.1405019-5-matthew.brost@intel.com (cherry picked from commit a5d8d3b) Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
1 parent df8c378 commit 1b36ea2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/gpu/drm/xe/xe_svm.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,8 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
783783
IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR) ? SZ_64K : 0,
784784
.devmem_only = atomic && IS_DGFX(vm->xe) &&
785785
IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR),
786+
.timeslice_ms = atomic && IS_DGFX(vm->xe) &&
787+
IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR) ? 5 : 0,
786788
};
787789
struct xe_svm_range *range;
788790
struct drm_gpusvm_range *r;
@@ -819,6 +821,7 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
819821
if (--migrate_try_count >= 0 &&
820822
xe_svm_range_needs_migrate_to_vram(range, vma)) {
821823
err = xe_svm_alloc_vram(vm, tile, range, &ctx);
824+
ctx.timeslice_ms <<= 1; /* Double timeslice if we have to retry */
822825
if (err) {
823826
if (migrate_try_count || !ctx.devmem_only) {
824827
drm_dbg(&vm->xe->drm,
@@ -838,6 +841,7 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
838841
err = drm_gpusvm_range_get_pages(&vm->svm.gpusvm, r, &ctx);
839842
/* Corner where CPU mappings have changed */
840843
if (err == -EOPNOTSUPP || err == -EFAULT || err == -EPERM) {
844+
ctx.timeslice_ms <<= 1; /* Double timeslice if we have to retry */
841845
if (migrate_try_count > 0 || !ctx.devmem_only) {
842846
if (err == -EOPNOTSUPP) {
843847
range_debug(range, "PAGE FAULT - EVICT PAGES");
@@ -877,6 +881,7 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
877881
drm_exec_fini(&exec);
878882
err = PTR_ERR(fence);
879883
if (err == -EAGAIN) {
884+
ctx.timeslice_ms <<= 1; /* Double timeslice if we have to retry */
880885
range_debug(range, "PAGE FAULT - RETRY BIND");
881886
goto retry;
882887
}

0 commit comments

Comments
 (0)