nouveau/svm: Fix to migrate all requested pages
Subsystems (3)
PATCH 1/1 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.
--- drivers/gpu/drm/nouveau/nouveau_dmem.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_dmem.c +5 -1
@@ -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;
Signature · 1 line
2.35.1
Quoted 7 lines · Alistair Popple
Users may request that pages from an OpenCL SVM allocation be migrated to the GPU with
clEnqueueSVMMigrateMem(). In Nouveau this will call intonouveau_dmem_migrate_vma()to do the migration. If the total range to be migrated exceedsSG_MAX_SINGLE_ALLOCthe pages will be migrated in chunks of sizeSG_MAX_SINGLE_ALLOC. However a typo in updating the starting address means that only the first chunk will get migrated.
Quoted 5 lines
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")
Thanks for fixing this!
hi, in the future if it's taking a while for a review to come back feel free to just send a poke on the thread for the patch you submitted, I do my best to keep up with all of the patches coming in. But there's a lot of email that I get so every now and then one slips through the cracks.
Anyway, this patch looks good to me:
I will push it to the appropriate branch in a little bit
Quoted 34 lines · Alistair Popple
Users may request that pages from an OpenCL SVM allocation be migrated to the GPU with
clEnqueueSVMMigrateMem(). In Nouveau this will call intonouveau_dmem_migrate_vma()to do the migration. If the total range to be migrated exceedsSG_MAX_SINGLE_ALLOCthe pages will be migrated in chunks of sizeSG_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")---
drivers/gpu/drm/nouveau/nouveau_dmem.c | 6 +++++-1 file changed, 5 insertions(+), 1 deletion(-)drivers/gpu/drm/nouveau/nouveau_dmem.c +0
-0@@ -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)
gotoout_free_pfns;
Signature · 3 lines
Cheers, Lyude Paul (she/her) Software Engineer at Red Hat