From: Jason Gunthorpe <jgg-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Ralph Campbell <rcampbell-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Ben Skeggs <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Subject: Re: [PATCH] nouveau: fix the start/end range for migration
Date: Mon, 31 Aug 2020 08:51:17 -0300 [thread overview]
Message-ID: <20200831115117.GU1152540@nvidia.com> (raw)
In-Reply-To: <20200827213744.14074-1-rcampbell-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
On Thu, Aug 27, 2020 at 02:37:44PM -0700, Ralph Campbell wrote:
> The user level OpenCL code shouldn't have to align start and end
> addresses to a page boundary. That is better handled in the nouveau
> driver. The npages field is also redundant since it can be computed
> from the start and end addresses.
>
> Signed-off-by: Ralph Campbell <rcampbell-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>
> This is for Ben Skegg's nouveau tree.
>
> I have been working with Karol Herbst on the OpenCL mesa changes for
> nouveau which will be merged upstream soon.
> With or without those changes, the user visible effect of this patch
> only extends the range by one page (round up vs. round down to page
> boundary).
>
> drivers/gpu/drm/nouveau/nouveau_svm.c | 17 ++++++-----------
> 1 file changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c
> index 2df1c0460559..888aa0908c5a 100644
> +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c
> @@ -105,11 +105,14 @@ nouveau_svmm_bind(struct drm_device *dev, void *data,
> struct nouveau_cli *cli = nouveau_cli(file_priv);
> struct drm_nouveau_svm_bind *args = data;
> unsigned target, cmd, priority;
> - unsigned long addr, end, size;
> + unsigned long addr, end;
> struct mm_struct *mm;
>
> args->va_start &= PAGE_MASK;
> - args->va_end &= PAGE_MASK;
> + args->va_end = ALIGN(args->va_end, PAGE_SIZE);
> + /* If no end address is given, assume a single page. */
> + if (args->va_end == 0)
> + args->va_end = args->va_start + PAGE_SIZE;
That is really weird, how is it useful for the kernel to map a region
of unknown size and alignment to the GPU?
Jason
WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgg@nvidia.com>
To: Ralph Campbell <rcampbell@nvidia.com>
Cc: <nouveau@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
Jerome Glisse <jglisse@redhat.com>,
John Hubbard <jhubbard@nvidia.com>,
Christoph Hellwig <hch@lst.de>, Ben Skeggs <bskeggs@redhat.com>
Subject: Re: [PATCH] nouveau: fix the start/end range for migration
Date: Mon, 31 Aug 2020 08:51:17 -0300 [thread overview]
Message-ID: <20200831115117.GU1152540@nvidia.com> (raw)
In-Reply-To: <20200827213744.14074-1-rcampbell@nvidia.com>
On Thu, Aug 27, 2020 at 02:37:44PM -0700, Ralph Campbell wrote:
> The user level OpenCL code shouldn't have to align start and end
> addresses to a page boundary. That is better handled in the nouveau
> driver. The npages field is also redundant since it can be computed
> from the start and end addresses.
>
> Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
>
> This is for Ben Skegg's nouveau tree.
>
> I have been working with Karol Herbst on the OpenCL mesa changes for
> nouveau which will be merged upstream soon.
> With or without those changes, the user visible effect of this patch
> only extends the range by one page (round up vs. round down to page
> boundary).
>
> drivers/gpu/drm/nouveau/nouveau_svm.c | 17 ++++++-----------
> 1 file changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c
> index 2df1c0460559..888aa0908c5a 100644
> +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c
> @@ -105,11 +105,14 @@ nouveau_svmm_bind(struct drm_device *dev, void *data,
> struct nouveau_cli *cli = nouveau_cli(file_priv);
> struct drm_nouveau_svm_bind *args = data;
> unsigned target, cmd, priority;
> - unsigned long addr, end, size;
> + unsigned long addr, end;
> struct mm_struct *mm;
>
> args->va_start &= PAGE_MASK;
> - args->va_end &= PAGE_MASK;
> + args->va_end = ALIGN(args->va_end, PAGE_SIZE);
> + /* If no end address is given, assume a single page. */
> + if (args->va_end == 0)
> + args->va_end = args->va_start + PAGE_SIZE;
That is really weird, how is it useful for the kernel to map a region
of unknown size and alignment to the GPU?
Jason
next prev parent reply other threads:[~2020-08-31 11:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-27 21:37 [PATCH] nouveau: fix the start/end range for migration Ralph Campbell
2020-08-27 21:37 ` Ralph Campbell
[not found] ` <20200827213744.14074-1-rcampbell-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-08-31 11:51 ` Jason Gunthorpe [this message]
2020-08-31 11:51 ` Jason Gunthorpe
[not found] ` <20200831115117.GU1152540-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-08-31 17:21 ` Ralph Campbell
2020-08-31 17:21 ` Ralph Campbell
[not found] ` <017b1e81-7e6d-b2cb-785c-aef88e466701-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-08-31 18:02 ` Jason Gunthorpe
2020-08-31 18:02 ` Jason Gunthorpe
2020-08-31 18:10 ` Ralph Campbell
2020-08-31 18:10 ` Ralph Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200831115117.GU1152540@nvidia.com \
--to=jgg-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
--cc=bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=hch-jcswGhMUV9g@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=rcampbell-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.