]> Git Repo - linux.git/commitdiff
nouveau/svm: Fix to migrate all requested pages
authorAlistair Popple <[email protected]>
Wed, 20 Jul 2022 06:27:45 +0000 (16:27 +1000)
committerLyude Paul <[email protected]>
Thu, 28 Jul 2022 20:43:31 +0000 (16:43 -0400)
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: e3d8b0890469 ("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+
drivers/gpu/drm/nouveau/nouveau_dmem.c

index 7ba66ad68a8a1e5b1b92b32177e2c5fc8c8b23e5..16356611b5b9500bc2563b704bb0f8120a5dba2b 100644 (file)
@@ -680,7 +680,11 @@ nouveau_dmem_migrate_vma(struct nouveau_drm *drm,
                goto out_free_dma;
 
        for (i = 0; i < npages; i += max) {
-               args.end = start + (max << PAGE_SHIFT);
+               if (args.start + (max << PAGE_SHIFT) > end)
+                       args.end = end;
+               else
+                       args.end = args.start + (max << PAGE_SHIFT);
+
                ret = migrate_vma_setup(&args);
                if (ret)
                        goto out_free_pfns;
This page took 0.059467 seconds and 4 git commands to generate.