From: Ralph Campbell <rcampbell@nvidia.com>
To: Jason Gunthorpe <jgg@ziepe.ca>, <linux-mm@kvack.org>
Cc: amd-gfx@lists.freedesktop.org, "Yang,
Philip" <Philip.Yang@amd.com>,
"John Hubbard" <jhubbard@nvidia.com>,
"Felix Kuehling" <Felix.Kuehling@amd.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
"Christoph Hellwig" <hch@lst.de>,
"Jérôme Glisse" <jglisse@redhat.com>,
"Ben Skeggs" <bskeggs@redhat.com>,
nouveau@lists.freedesktop.org,
"Alex Deucher" <alexander.deucher@amd.com>,
"Niranjana Vishwanathapura" <niranjana.vishwanathapura@intel.com>,
intel-gfx@lists.freedesktop.org,
"Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH hmm v2 5/5] mm/hmm: remove the customizable pfn format from hmm_range_fault
Date: Fri, 1 May 2020 17:53:26 -0700 [thread overview]
Message-ID: <3c06a94c-c17f-dc31-537e-f3f6e1ace9a2@nvidia.com> (raw)
In-Reply-To: <5-v2-b4e84f444c7d+24f57-hmm_no_flags_jgg@mellanox.com>
On 5/1/20 11:20 AM, Jason Gunthorpe wrote:
> From: Jason Gunthorpe <jgg@mellanox.com>
>
> Presumably the intent here was that hmm_range_fault() could put the data
> into some HW specific format and thus avoid some work. However, nothing
> actually does that, and it isn't clear how anything actually could do that
> as hmm_range_fault() provides CPU addresses which must be DMA mapped.
>
> Perhaps there is some special HW that does not need DMA mapping, but we
> don't have any examples of this, and the theoretical performance win of
> avoiding an extra scan over the pfns array doesn't seem worth the
> complexity. Plus pfns needs to be scanned anyhow to sort out any
> DEVICE_PRIVATE pages.
>
> This version replaces the uint64_t with an usigned long containing a pfn
> and fixed flags. On input flags is filled with the HMM_PFN_REQ_* values,
> on successful output it is filled with HMM_PFN_* values, describing the
> state of the pages.
>
> amdgpu is simple to convert, it doesn't use snapshot and doesn't use
> per-page flags.
>
> nouveau uses only 16 hmm_pte entries at most (ie fits in a few cache
> lines), and it sweeps over its pfns array a couple of times anyhow. It
> also has a nasty call chain before it reaches the dma map and hardware
> suggesting performance isn't important:
>
> nouveau_svm_fault():
> args.i.m.method = NVIF_VMM_V0_PFNMAP
> nouveau_range_fault()
> nvif_object_ioctl()
> client->driver->ioctl()
> struct nvif_driver nvif_driver_nvkm:
> .ioctl = nvkm_client_ioctl
> nvkm_ioctl()
> nvkm_ioctl_path()
> nvkm_ioctl_v0[type].func(..)
> nvkm_ioctl_mthd()
> nvkm_object_mthd()
> struct nvkm_object_func nvkm_uvmm:
> .mthd = nvkm_uvmm_mthd
> nvkm_uvmm_mthd()
> nvkm_uvmm_mthd_pfnmap()
> nvkm_vmm_pfn_map()
> nvkm_vmm_ptes_get_map()
> func == gp100_vmm_pgt_pfn
> struct nvkm_vmm_desc_func gp100_vmm_desc_spt:
> .pfn = gp100_vmm_pgt_pfn
> nvkm_vmm_iter()
> REF_PTES == func == gp100_vmm_pgt_pfn()
> dma_map_page()
>
> Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
> Tested-by: Ralph Campbell <rcampbell@nvidia.com>
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> Documentation/vm/hmm.rst | 26 ++--
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 35 ++----
> drivers/gpu/drm/nouveau/nouveau_dmem.c | 27 +---
> drivers/gpu/drm/nouveau/nouveau_dmem.h | 3 +-
> drivers/gpu/drm/nouveau/nouveau_svm.c | 87 ++++++++-----
> include/linux/hmm.h | 99 ++++++---------
> mm/hmm.c | 160 +++++++++++-------------
> 7 files changed, 192 insertions(+), 245 deletions(-)
>
...snip...
>
> +static void nouveau_hmm_convert_pfn(struct nouveau_drm *drm,
> + struct hmm_range *range, u64 *ioctl_addr)
> +{
> + unsigned long i, npages;
> +
> + /*
> + * The ioctl_addr prepared here is passed through nvif_object_ioctl()
> + * to an eventual DMA map in something like gp100_vmm_pgt_pfn()
> + *
> + * This is all just encoding the internal hmm reprensetation into a
s/reprensetation/representation/
Looks good and still tests OK with nouveau.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-05-02 0:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-01 18:20 [PATCH hmm v2 0/5] Adjust hmm_range_fault() API Jason Gunthorpe
2020-05-01 18:20 ` [PATCH hmm v2 1/5] mm/hmm: make CONFIG_DEVICE_PRIVATE into a select Jason Gunthorpe
2020-05-02 5:47 ` John Hubbard
2020-05-10 0:16 ` Andrew Morton
2020-05-11 13:49 ` Jason Gunthorpe
2020-05-01 18:20 ` [PATCH hmm v2 2/5] mm/hmm: make hmm_range_fault return 0 or -1 Jason Gunthorpe
2020-05-05 0:20 ` John Hubbard
2020-05-01 18:20 ` [PATCH hmm v2 3/5] drm/amdgpu: remove dead code after hmm_range_fault() Jason Gunthorpe
2020-05-01 18:20 ` [PATCH hmm v2 4/5] mm/hmm: remove HMM_PFN_SPECIAL Jason Gunthorpe
2020-05-05 0:23 ` John Hubbard
2020-05-01 18:20 ` [PATCH hmm v2 5/5] mm/hmm: remove the customizable pfn format from hmm_range_fault Jason Gunthorpe
2020-05-02 0:53 ` Ralph Campbell [this message]
2020-05-06 16:18 ` Jason Gunthorpe
2020-05-05 1:30 ` John Hubbard
2020-05-06 16:21 ` Jason Gunthorpe
2020-05-06 18:45 ` [PATCH hmm v2 0/5] Adjust hmm_range_fault() API Jason Gunthorpe
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=3c06a94c-c17f-dc31-537e-f3f6e1ace9a2@nvidia.com \
--to=rcampbell@nvidia.com \
--cc=Felix.Kuehling@amd.com \
--cc=Philip.Yang@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=bskeggs@redhat.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hch@lst.de \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jgg@ziepe.ca \
--cc=jglisse@redhat.com \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=niranjana.vishwanathapura@intel.com \
--cc=nouveau@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).