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

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

diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
index 1cc41ce7b684..4b0e0820153a 100644
--- a/drivers/gpu/drm/xe/xe_svm.c
+++ b/drivers/gpu/drm/xe/xe_svm.c
@@ -780,6 +780,7 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma 
*vma,
                .check_pages_threshold = IS_DGFX(vm->xe) &&
                        IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR) ? SZ_64K : 0,
                .vram_only = atomic,
+               .timeslice_ms = atomic ? 5 : 0,
        };
        struct xe_svm_range *range;
        struct drm_gpusvm_range *r;
@@ -816,6 +817,7 @@ int xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma 
*vma,
        if (--migrate_try_count >= 0 &&
            xe_svm_range_needs_migrate_to_vram(range, vma)) {
                err = xe_svm_alloc_vram(vm, tile, range, &ctx);
+               ctx.timeslice_ms <<= 1; /* Double timeslice if we have to retry 
*/
                if (err) {
                        if (migrate_try_count || !ctx.vram_only) {
                                drm_dbg(&vm->xe->drm,
-- 
2.34.1

Reply via email to