Please pull HMM changes
Hi Linus,
This series arose from a review of hmm_range_fault() by Christoph, Ralph and myself. Several bug fixes and some general clarity.
hmm_range_fault() is being used by these 'SVM' style drivers to non-destructively read the page tables. It is very similar to get_user_pages() except that the output is an array of PFNs and per-pfn flags, and it has various modes of reading.
This is necessary before RDMA ODP can be converted, as we don't want to have weird corner case regressions, which is still a looking forward item. Ralph has a nice tester for this routine, but it is waiting for feedback from the selftests maintainers.
Regards,
Jason
The following changes since commit f8788d86ab28f61f7b46eb6be375f8a726783636:
Linux 5.6-rc3 (2020-02-23 16:17:42 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git tags/for-linus-hmm
for you to fetch changes up to 9cee0e8c6f1eb4b5e56d3eb7f5d47b05637bab4f:
mm/hmm: return error for non-vma snapshots (2020-03-27 20:19:25 -0300)
----------------------------------------------------------------
hmm related patches for 5.7
This series focuses on corner case bug fixes and general clarity improvements to hmm_range_fault().
- 9 bug fixes
- Allow pgmap to track the 'owner' of a DEVICE_PRIVATE - in this case the owner tells the driver if it can understand the DEVICE_PRIVATE page or not. Use this to resolve a bug in nouveau where it could touch DEVICE_PRIVATE pages from other drivers.
- Remove a bunch of dead, redundant or unused code and flags
- Clarity improvements to hmm_range_fault()
----------------------------------------------------------------
Christoph Hellwig (9):
mm/hmm: don't provide a stub for hmm_range_fault() mm/hmm: remove the unused HMM_FAULT_ALLOW_RETRY flag mm/hmm: simplify hmm_vma_walk_hugetlb_entry()
mm/hmm: don't handle the non-fault case in hmm_vma_walk_hole_()
mm: merge hmm_vma_do_fault into into hmm_vma_walk_hole_
memremap: add an owner field to struct dev_pagemap
mm: handle multiple owners of device private pages in migrate_vma
mm: simplify device private page handling in hmm_range_fault mm/hmm: check the device private page owner in hmm_range_fault()
Jason Gunthorpe (17):
mm/hmm: add missing unmaps of the ptep during hmm_vma_handle_pte() mm/hmm: do not call hmm_vma_walk_hole() while holding a spinlock mm/hmm: add missing pfns set to hmm_vma_walk_pmd()
mm/hmm: add missing call to hmm_range_need_fault() before returning EFAULT mm/hmm: reorganize how !pte_present is handled in hmm_vma_handle_pte() mm/hmm: return -EFAULT when setting HMM_PFN_ERROR on requested valid pages mm/hmm: add missing call to hmm_pte_need_fault in HMM_PFN_SPECIAL handling mm/hmm: do not check pmd_protnone twice in hmm_vma_handle_pmd() mm/hmm: remove pgmap checking for devmap pages
mm/hmm: return the fault type from hmm_pte_need_fault() mm/hmm: remove unused code and tidy comments
mm/hmm: remove HMM_FAULT_SNAPSHOT
mm/hmm: remove the CONFIG_TRANSPARENT_HUGEPAGE #ifdef
mm/hmm: use device_private_entry_to_pfn()
mm/hmm: do not unconditionally set pfns when returning EBUSY mm/hmm: do not set pfns when returning an error code
mm/hmm: return error for non-vma snapshots
Documentation/vm/hmm.rst | 12 +- arch/powerpc/kvm/book3s_hv_uvmem.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +- drivers/gpu/drm/nouveau/nouveau_dmem.c | 19 +- drivers/gpu/drm/nouveau/nouveau_svm.c | 3 +- include/linux/hmm.h | 125 +-------- include/linux/memremap.h | 4 + include/linux/migrate.h | 8 + mm/hmm.c | 476 +++++++++++++------------------- mm/memremap.c | 4 + mm/migrate.c | 9 +- 11 files changed, 227 insertions(+), 439 deletions(-)
Quoted 59 lines · Jason Gunthorpe
Hi Linus,
This series arose from a review of
hmm_range_fault()by Christoph, Ralph and myself. Several bug fixes and some general clarity.
hmm_range_fault()is being used by these 'SVM' style drivers to non-destructively read the page tables. It is very similar toget_user_pages()except that the output is an array of PFNs and per-pfn flags, and it has various modes of reading.This is necessary before RDMA ODP can be converted, as we don't want to have weird corner case regressions, which is still a looking forward item. Ralph has a nice tester for this routine, but it is waiting for feedback from the selftests maintainers.
Regards,
JasonThe following changes since commit
f8788d86ab28f61f7b46eb6be375f8a726783636:Linux 5.6-rc3 (2020-02-23 16:17:42 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.gittags/for-linus-hmmfor you to fetch changes up to
9cee0e8c6f1eb4b5e56d3eb7f5d47b05637bab4f:mm/hmm: return error for non-vma snapshots (2020-03-27 20:19:25 -0300)
----------------------------------------------------------------
hmm related patches for 5.7This series focuses on corner case bug fixes and general clarity improvements to
hmm_range_fault().- 9 bug fixes
- Allow pgmap to track the 'owner' of a
DEVICE_PRIVATE- in this case the owner tells the driver if it can understand theDEVICE_PRIVATEpage or not. Use this to resolve a bug in nouveau where it could touchDEVICE_PRIVATEpages from other drivers.- Remove a bunch of dead, redundant or unused code and flags
- Clarity improvements to
hmm_range_fault()----------------------------------------------------------------
Christoph Hellwig (9):
mm/hmm: don't provide a stub forhmm_range_fault()mm/hmm: remove the unusedHMM_FAULT_ALLOW_RETRYflag mm/hmm: simplifyhmm_vma_walk_hugetlb_entry()
mm/hmm: don't handle the non-fault case inhmm_vma_walk_hole_()
mm: mergehmm_vma_do_faultinto intohmm_vma_walk_hole_
memremap: add an owner field to structdev_pagemap
mm: handle multiple owners of device private pages inmigrate_vma
mm: simplify device private page handling inhmm_range_faultmm/hmm: check the device private page owner inhmm_range_fault()
Quoted 14 lines
Jason Gunthorpe (17):
mm/hmm: add missing unmaps of the ptep duringhmm_vma_handle_pte()mm/hmm: do not callhmm_vma_walk_hole()while holding a spinlock mm/hmm: add missing pfns set tohmm_vma_walk_pmd()
mm/hmm: add missing call tohmm_range_need_fault()before returning EFAULT mm/hmm: reorganize how !pte_present is handled inhmm_vma_handle_pte()mm/hmm: return-EFAULTwhen settingHMM_PFN_ERRORon requested valid pages mm/hmm: add missing call tohmm_pte_need_faultinHMM_PFN_SPECIALhandling mm/hmm: do not checkpmd_protnonetwice inhmm_vma_handle_pmd()mm/hmm: remove pgmap checking for devmap pages
mm/hmm: return the fault type fromhmm_pte_need_fault()mm/hmm: remove unused code and tidy comments
mm/hmm: removeHMM_FAULT_SNAPSHOT
mm/hmm: remove theCONFIG_TRANSPARENT_HUGEPAGE#ifdef
This patch causes an error on arm32 all{mod,yes}config because pmd_pfn is only defined when CONFIG_ARM_LPAE is set, which is a dependency of CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE and CONFIG_TRANSPARENT_HUGEPAGE.
$ make -j$(nproc) -s ARCH=arm CC=clang CROSS_COMPILE=arm-linux-gnueabi- O=out/arm32 distclean allyesconfig mm/hmm.o
mm/hmm.c:207:8: error: implicit declaration of function 'pmd_pfn'
[-Werror,-Wimplicit-function-declaration]
pfn = pmd_pfn(pmd) + ((addr & ~PMD_MASK) >> PAGE_SHIFT);
^
1 error generated.https://elixir.bootlin.com/linux/v5.6/source/arch/arm/include/asm/pgtable-3level.h#L236
https://elixir.bootlin.com/linux/v5.6/source/arch/arm/include/asm/pgtable.h#L29
https://elixir.bootlin.com/linux/v5.6/source/arch/arm/Kconfig#L1579
No idea how to rectify that but thought I would let you know.
Cheers,
Nathan
Quoted 15 lines · Nathan Chancellor
Quoted 6 lines
Jason Gunthorpe (17):
mm/hmm: add missing unmaps of the ptep duringhmm_vma_handle_pte()mm/hmm: do not callhmm_vma_walk_hole()while holding a spinlock mm/hmm: add missing pfns set tohmm_vma_walk_pmd()
mm/hmm: add missing call tohmm_range_need_fault()before returning EFAULT mm/hmm: reorganize how !pte_present is handled inhmm_vma_handle_pte()Quoted 8 lines
mm/hmm: return
-EFAULTwhen settingHMM_PFN_ERRORon requested valid pages mm/hmm: add missing call tohmm_pte_need_faultinHMM_PFN_SPECIALhandling mm/hmm: do not checkpmd_protnonetwice inhmm_vma_handle_pmd()mm/hmm: remove pgmap checking for devmap pages
mm/hmm: return the fault type fromhmm_pte_need_fault()mm/hmm: remove unused code and tidy comments
mm/hmm: removeHMM_FAULT_SNAPSHOT
mm/hmm: remove theCONFIG_TRANSPARENT_HUGEPAGE#ifdef
Quoted 3 lines
This patch causes an error on arm32 all{mod,yes}config because
pmd_pfnis only defined whenCONFIG_ARM_LPAEis set, which is a dependency ofCONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGEandCONFIG_TRANSPARENT_HUGEPAGE.
Oh! I'm again surprised 0-day did not catch on to this. linux-next surely would have, but things got there later than I would have preferred due to the world being upside down right now :(
Quoted 5 lines
https://elixir.bootlin.com/linux/v5.6/source/arch/arm/include/asm/pgtable-3level.h#L236
https://elixir.bootlin.com/linux/v5.6/source/arch/arm/include/asm/pgtable.h#L29
https://elixir.bootlin.com/linux/v5.6/source/arch/arm/Kconfig#L1579No idea how to rectify that but thought I would let you know.
I'll just drop the patch. Next cycle we can add some comment here as this requirement is a hard to notice.
The for-linus-hmm tag is updated now to reflect this.
Thanks a lot,
Jason