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 <apopple@nvidia.com> Fixes: e3d8b08 ("drm/nouveau/svm: map pages after migration") Reviewed-by: Ralph Campbell <rcampbell@nvidia.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Lyude Paul <lyude@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220720062745.960701-1-apopple@nvidia.com Cc: <stable@vger.kernel.org> # 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)