linux/Documentation/vm
Jason Gunthorpe 2733ea144d mm/hmm: remove the customizable pfn format from hmm_range_fault
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()

Link: https://lore.kernel.org/r/5-v2-b4e84f444c7d+24f57-hmm_no_flags_jgg@mellanox.com
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
Tested-by: Ralph Campbell <rcampbell@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
2020-05-11 10:47:29 -03:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
active_mm.rst docs/vm: rename documentation files to .rst 2018-04-16 14:18:15 -06:00
balance.rst docs/vm: rename documentation files to .rst 2018-04-16 14:18:15 -06:00
cleancache.rst docs/vm: rename documentation files to .rst 2018-04-16 14:18:15 -06:00
free_page_reporting.rst mm/page_reporting: add free page reporting documentation 2020-04-07 10:43:39 -07:00
frontswap.rst docs/vm: rename documentation files to .rst 2018-04-16 14:18:15 -06:00
highmem.rst docs/vm: rename documentation files to .rst 2018-04-16 14:18:15 -06:00
hmm.rst mm/hmm: remove the customizable pfn format from hmm_range_fault 2020-05-11 10:47:29 -03:00
hugetlbfs_reserv.rst docs/vm: Minor editorial changes in the THP and hugetlbfs 2019-04-30 06:34:40 -06:00
hwpoison.rst docs/vm: hwpoison.rst: Fix quote formatting 2019-06-20 14:11:32 -06:00
index.rst docs/vm: add documentation of memory models 2019-04-30 06:30:01 -06:00
ksm.rst docs/vm: ksm: split userspace interface to admin-guide/mm/ksm.rst 2018-04-27 17:19:49 -06:00
memory-model.rst mm: document ZONE_DEVICE memory-model implications 2019-07-18 17:08:07 -07:00
mmu_notifier.rst docs/vm: rename documentation files to .rst 2018-04-16 14:18:15 -06:00
numa.rst docs: cgroup-v1: add it to the admin-guide book 2019-07-15 11:03:02 -03:00
overcommit-accounting.rst docs/vm: rename documentation files to .rst 2018-04-16 14:18:15 -06:00
page_frags.rst docs/vm: rename documentation files to .rst 2018-04-16 14:18:15 -06:00
page_migration.rst docs: cgroup-v1: add it to the admin-guide book 2019-07-15 11:03:02 -03:00
page_owner.rst docs/vm: rename documentation files to .rst 2018-04-16 14:18:15 -06:00
remap_file_pages.rst docs/vm: rename documentation files to .rst 2018-04-16 14:18:15 -06:00
slub.rst docs: Add missing colon 2019-02-01 16:03:45 -07:00
split_page_table_lock.rst mm: treewide: clarify pgtable_page_{ctor,dtor}() naming 2019-09-26 10:10:44 -07:00
swap_numa.rst docs/vm: rename documentation files to .rst 2018-04-16 14:18:15 -06:00
transhuge.rst docs/vm: Minor editorial changes in the THP and hugetlbfs 2019-04-30 06:34:40 -06:00
unevictable-lru.rst docs: cgroup-v1: add it to the admin-guide book 2019-07-15 11:03:02 -03:00
z3fold.rst docs/vm: rename documentation files to .rst 2018-04-16 14:18:15 -06:00
zsmalloc.rst docs/vm: rename documentation files to .rst 2018-04-16 14:18:15 -06:00
zswap.rst mm/zswap: allow setting default status, compressor and allocator in Kconfig 2020-04-07 10:43:41 -07:00