Skip to content

Commit 66cee90

Browse files
apopple-nvidiaLyude
authored andcommitted
nouveau/svm: Fix to migrate all requested pages
Users may request that pages from an OpenCL SVM allocation be migrated to the GPU with clEnqueueSVMMigrateMem(). In Nouveau this will call into nouveau_dmem_migrate_vma() to do the migration. If the total range to be migrated exceeds SG_MAX_SINGLE_ALLOC the pages will be migrated in chunks of size SG_MAX_SINGLE_ALLOC. However a typo in updating the starting address means that only the first chunk will get migrated. Fix the calculation so that the entire range will get migrated if possible. Signed-off-by: Alistair Popple <[email protected]> Fixes: e3d8b08 ("drm/nouveau/svm: map pages after migration") Reviewed-by: Ralph Campbell <[email protected]> Reviewed-by: Lyude Paul <[email protected]> Signed-off-by: Lyude Paul <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Cc: <[email protected]> # v5.8+
1 parent 0c09bc3 commit 66cee90

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/gpu/drm/nouveau/nouveau_dmem.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,11 @@ nouveau_dmem_migrate_vma(struct nouveau_drm *drm,
680680
goto out_free_dma;
681681

682682
for (i = 0; i < npages; i += max) {
683-
args.end = start + (max << PAGE_SHIFT);
683+
if (args.start + (max << PAGE_SHIFT) > end)
684+
args.end = end;
685+
else
686+
args.end = args.start + (max << PAGE_SHIFT);
687+
684688
ret = migrate_vma_setup(&args);
685689
if (ret)
686690
goto out_free_pfns;

0 commit comments

Comments
 (0)