All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nouveau/svm: Fix to migrate all requested pages
@ 2022-07-20  6:27 ` Alistair Popple
  0 siblings, 0 replies; 9+ messages in thread
From: Alistair Popple @ 2022-07-20  6:27 UTC (permalink / raw)
  To: bskeggs, rcampbell
  Cc: kherbst, lyude, airlied, daniel, nouveau, linux-kernel,
	dri-devel, jhubbard, Alistair Popple

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: e3d8b0890469 ("drm/nouveau/svm: map pages after migration")
---
 drivers/gpu/drm/nouveau/nouveau_dmem.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nouveau/nouveau_dmem.c
index 7ba66ad68a8a..16356611b5b9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dmem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c
@@ -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;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Nouveau] [PATCH] nouveau/svm: Fix to migrate all requested pages
@ 2022-07-20  6:27 ` Alistair Popple
  0 siblings, 0 replies; 9+ messages in thread
From: Alistair Popple @ 2022-07-20  6:27 UTC (permalink / raw)
  To: bskeggs, rcampbell
  Cc: airlied, nouveau, Alistair Popple, linux-kernel, dri-devel, daniel

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: e3d8b0890469 ("drm/nouveau/svm: map pages after migration")
---
 drivers/gpu/drm/nouveau/nouveau_dmem.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nouveau/nouveau_dmem.c
index 7ba66ad68a8a..16356611b5b9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dmem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c
@@ -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;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] nouveau/svm: Fix to migrate all requested pages
@ 2022-07-20  6:27 ` Alistair Popple
  0 siblings, 0 replies; 9+ messages in thread
From: Alistair Popple @ 2022-07-20  6:27 UTC (permalink / raw)
  To: bskeggs, rcampbell
  Cc: kherbst, airlied, nouveau, Alistair Popple, linux-kernel,
	dri-devel, jhubbard

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: e3d8b0890469 ("drm/nouveau/svm: map pages after migration")
---
 drivers/gpu/drm/nouveau/nouveau_dmem.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nouveau/nouveau_dmem.c
index 7ba66ad68a8a..16356611b5b9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dmem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c
@@ -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;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] nouveau/svm: Fix to migrate all requested pages
  2022-07-20  6:27 ` [Nouveau] " Alistair Popple
  (?)
@ 2022-07-28 19:27   ` Ralph Campbell
  -1 siblings, 0 replies; 9+ messages in thread
From: Ralph Campbell @ 2022-07-28 19:27 UTC (permalink / raw)
  To: Alistair Popple, bskeggs
  Cc: kherbst, lyude, airlied, daniel, nouveau, linux-kernel,
	dri-devel, jhubbard

On 7/19/22 23:27, Alistair Popple wrote:

> 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: e3d8b0890469 ("drm/nouveau/svm: map pages after migration")

Thanks for fixing this!
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Nouveau] [PATCH] nouveau/svm: Fix to migrate all requested pages
@ 2022-07-28 19:27   ` Ralph Campbell
  0 siblings, 0 replies; 9+ messages in thread
From: Ralph Campbell @ 2022-07-28 19:27 UTC (permalink / raw)
  To: Alistair Popple, bskeggs
  Cc: airlied, nouveau, linux-kernel, dri-devel, daniel

On 7/19/22 23:27, Alistair Popple wrote:

> 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: e3d8b0890469 ("drm/nouveau/svm: map pages after migration")

Thanks for fixing this!
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] nouveau/svm: Fix to migrate all requested pages
@ 2022-07-28 19:27   ` Ralph Campbell
  0 siblings, 0 replies; 9+ messages in thread
From: Ralph Campbell @ 2022-07-28 19:27 UTC (permalink / raw)
  To: Alistair Popple, bskeggs
  Cc: kherbst, airlied, nouveau, linux-kernel, dri-devel, jhubbard

On 7/19/22 23:27, Alistair Popple wrote:

> 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: e3d8b0890469 ("drm/nouveau/svm: map pages after migration")

Thanks for fixing this!
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] nouveau/svm: Fix to migrate all requested pages
  2022-07-20  6:27 ` [Nouveau] " Alistair Popple
  (?)
@ 2022-07-28 20:17   ` Lyude Paul
  -1 siblings, 0 replies; 9+ messages in thread
From: Lyude Paul @ 2022-07-28 20:17 UTC (permalink / raw)
  To: Alistair Popple, bskeggs, rcampbell
  Cc: kherbst, airlied, daniel, nouveau, linux-kernel, dri-devel, jhubbard

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:

Reviewed-by: Lyude Paul <lyude@redhat.com>

I will push it to the appropriate branch in a little bit

On Wed, 2022-07-20 at 16:27 +1000, Alistair Popple wrote:
> 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: e3d8b0890469 ("drm/nouveau/svm: map pages after migration")
> ---
>  drivers/gpu/drm/nouveau/nouveau_dmem.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c
> b/drivers/gpu/drm/nouveau/nouveau_dmem.c
> index 7ba66ad68a8a..16356611b5b9 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c
> @@ -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;

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Nouveau] [PATCH] nouveau/svm: Fix to migrate all requested pages
@ 2022-07-28 20:17   ` Lyude Paul
  0 siblings, 0 replies; 9+ messages in thread
From: Lyude Paul @ 2022-07-28 20:17 UTC (permalink / raw)
  To: Alistair Popple, bskeggs, rcampbell
  Cc: airlied, nouveau, linux-kernel, dri-devel, daniel

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:

Reviewed-by: Lyude Paul <lyude@redhat.com>

I will push it to the appropriate branch in a little bit

On Wed, 2022-07-20 at 16:27 +1000, Alistair Popple wrote:
> 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: e3d8b0890469 ("drm/nouveau/svm: map pages after migration")
> ---
>  drivers/gpu/drm/nouveau/nouveau_dmem.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c
> b/drivers/gpu/drm/nouveau/nouveau_dmem.c
> index 7ba66ad68a8a..16356611b5b9 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c
> @@ -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;

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] nouveau/svm: Fix to migrate all requested pages
@ 2022-07-28 20:17   ` Lyude Paul
  0 siblings, 0 replies; 9+ messages in thread
From: Lyude Paul @ 2022-07-28 20:17 UTC (permalink / raw)
  To: Alistair Popple, bskeggs, rcampbell
  Cc: kherbst, airlied, nouveau, linux-kernel, dri-devel, jhubbard

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:

Reviewed-by: Lyude Paul <lyude@redhat.com>

I will push it to the appropriate branch in a little bit

On Wed, 2022-07-20 at 16:27 +1000, Alistair Popple wrote:
> 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: e3d8b0890469 ("drm/nouveau/svm: map pages after migration")
> ---
>  drivers/gpu/drm/nouveau/nouveau_dmem.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c
> b/drivers/gpu/drm/nouveau/nouveau_dmem.c
> index 7ba66ad68a8a..16356611b5b9 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c
> @@ -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;

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-07-28 20:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-20  6:27 [PATCH] nouveau/svm: Fix to migrate all requested pages Alistair Popple
2022-07-20  6:27 ` Alistair Popple
2022-07-20  6:27 ` [Nouveau] " Alistair Popple
2022-07-28 19:27 ` Ralph Campbell
2022-07-28 19:27   ` Ralph Campbell
2022-07-28 19:27   ` [Nouveau] " Ralph Campbell
2022-07-28 20:17 ` Lyude Paul
2022-07-28 20:17   ` Lyude Paul
2022-07-28 20:17   ` [Nouveau] " Lyude Paul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.