Skip to content

Commit 7987b93

Browse files
Thomas Hellströmlucasdemarchi
authored andcommitted
drm/xe/svm: Ensure data will be migrated to system if indicated by madvise.
If the location madvise() is set to DRM_XE_PREFERRED_LOC_DEFAULT_SYSTEM, the drm_pagemap in the SVM gpu fault handler will be set to NULL. However there is nothing that explicitly migrates the data to system if it is already present in device memory. In that case, set the device memory owner to NULL to ensure data gets properly migrated to system on page-fault. v2: - Remove redundant dpagemap assignment (Himal Prasad Ghimiray) Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> #v1 Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com> Link: https://lore.kernel.org/r/20251010104149.72783-2-thomas.hellstrom@linux.intel.com Fixes: 10aa5c8 ("drm/gpusvm, drm/xe: Fix userptr to not allow device private pages") (cherry picked from commit 2cfcea7a745794f9b8e265a309717ca6ba335fc4) Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
1 parent 9f64b3c commit 7987b93

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/drm/xe/xe_svm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,9 @@ static int __xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
10341034
if (err)
10351035
return err;
10361036

1037+
dpagemap = xe_vma_resolve_pagemap(vma, tile);
1038+
if (!dpagemap && !ctx.devmem_only)
1039+
ctx.device_private_page_owner = NULL;
10371040
range = xe_svm_range_find_or_insert(vm, fault_addr, vma, &ctx);
10381041

10391042
if (IS_ERR(range))
@@ -1054,7 +1057,6 @@ static int __xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,
10541057

10551058
range_debug(range, "PAGE FAULT");
10561059

1057-
dpagemap = xe_vma_resolve_pagemap(vma, tile);
10581060
if (--migrate_try_count >= 0 &&
10591061
xe_svm_range_needs_migrate_to_vram(range, vma, !!dpagemap || ctx.devmem_only)) {
10601062
ktime_t migrate_start = xe_svm_stats_ktime_get();

0 commit comments

Comments
 (0)