Remove drm/ttm-specific mm changes
Subsystems (6)
cover Remove drm/ttm-specific mm changes
Functionality was added specifically for the DRM TTM driver to support mapping memory for VM_MIXEDMAP VMAs with customised protection flags, however this has now been rolled back as issues were found with this approach.
This series removes the mm changes too, retaining some of the useful comments.
Lorenzo Stoakes (3):
mm: remove unused vmf_insert_mixed_prot()
mm: Remove vmf_insert_pfn_xxx_prot() for huge page-table entries drm/ttm: Remove comment referencing now-removed
vmf_insert_mixed_prot()
drivers/gpu/drm/ttm/ttm_bo_vm.c | 2 +- include/linux/huge_mm.h | 39 ++-------------------- include/linux/mm.h | 2 -- include/linux/mm_types.h | 7 +--- mm/huge_memory.c | 31 ++++++++---------- mm/memory.c | 57 +++++++++++---------------------- 6 files changed, 35 insertions(+), 103 deletions(-)
--
2.39.2
PATCH 1/3 mm: remove unused vmf_insert_mixed_prot()
The sole user of vmf_insert_mixed_prot(), the drm ttm module, stopped using this in commit f91142c62161 ("drm/ttm: nuke VM_MIXEDMAP on BO mappings v3") citing use of VM_MIXEDMAP in this case being terribly broken.
Remove this now-dead code and references to it, but retain the useful description of the prot != vma->vm_page_prot case, moving it to vmf_insert_pfn_prot() instead.
--- include/linux/mm.h | 2 -- include/linux/mm_types.h | 7 +---- mm/memory.c | 57 +++++++++++++--------------------------- 3 files changed, 19 insertions(+), 47 deletions(-)
include/linux/mm.h +0 -2
@@ -3330,8 +3330,6 @@ vm_fault_t vmf_insert_pfn_prot(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn, pgprot_t pgprot);vm_fault_t vmf_insert_mixed (struct vm_area_struct *vma,unsigned long addr,pfn_t pfn); -vm_fault_t vmf_insert_mixed_prot (struct vm_area_struct *vma,unsigned long addr, -pfn_t pfn,pgprot_t pgprot);vm_fault_t vmf_insert_mixed_mkwrite (struct vm_area_struct *vma,unsigned long addr,pfn_t pfn);int vm_iomap_memory (struct vm_area_struct *vma,phys_addr_t start,unsigned long len);
include/linux/mm_types.h +1 -6
@@ -502,12 +502,7 @@ struct vm_area_struct { };struct mm_struct *vm_mm;/* The address space we belong to. */ - -/* -* Access permissions of this VMA. -* See vmf_insert_mixed_prot() for discussion. -*/ -pgprot_t vm_page_prot; +pgprot_t vm_page_prot;/* Access permissions of this VMA. */ /* * Flags, see mm.h.
mm/memory.c +18 -39
85 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH 2/3 mm: Remove vmf_insert_pfn_xxx_prot() for huge page-table entries
In reply to Lorenzo StoakesThis functionality's sole user, the drm ttm module, removed support for it in commit 0d979509539e ("drm/ttm: remove ttm_bo_vm_insert_huge()") as the whole approach is currently unworkable without a PMD/PUD special bit and updates to GUP.
--- include/linux/huge_mm.h | 39 ++------------------------------------- mm/huge_memory.c | 31 +++++++++++++------------------ 2 files changed, 15 insertions(+), 55 deletions(-)
include/linux/huge_mm.h +2 -37
@@ -39,44 +39,9 @@ bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr,int change_huge_pmd (struct mmu_gather *tlb,struct vm_area_struct *vma,pmd_t *pmd,unsigned long addr,pgprot_t newprot,unsigned long cp_flags); -vm_fault_t vmf_insert_pfn_pmd_prot (struct vm_fault *vmf,pfn_t pfn, -pgprot_t pgprot,bool write); -/** -* vmf_insert_pfn_pmd - insert a pmd size pfn -* @vmf: Structure describing the fault -* @pfn: pfn to insert -* @pgprot: page protection to use -* @write: whether it's a write fault -* -* Insert a pmd size pfn. See vmf_insert_pfn() for additional info. -* -* Return: vm_fault_t value. -*/ -static inline vm_fault_t vmf_insert_pfn_pmd (struct vm_fault *vmf,pfn_t pfn, -bool write) -{ -return vmf_insert_pfn_pmd_prot (vmf, pfn, vmf->vma->vm_page_prot, write); -} -vm_fault_t vmf_insert_pfn_pud_prot (struct vm_fault *vmf,pfn_t pfn, -pgprot_t pgprot,bool write); - -/** -* vmf_insert_pfn_pud - insert a pud size pfn -* @vmf: Structure describing the fault -* @pfn: pfn to insert -* @pgprot: page protection to use -* @write: whether it's a write fault -* -* Insert a pud size pfn. See vmf_insert_pfn() for additional info. -* -* Return: vm_fault_t value. -*/ -static inline vm_fault_t vmf_insert_pfn_pud (struct vm_fault *vmf,pfn_t pfn, -bool write) -{ -return vmf_insert_pfn_pud_prot (vmf, pfn, vmf->vma->vm_page_prot, write); -} +vm_fault_t vmf_insert_pfn_pmd (struct vm_fault *vmf,pfn_t pfn,bool write); +vm_fault_t vmf_insert_pfn_pud (struct vm_fault *vmf,pfn_t pfn,bool write);enum transparent_hugepage_flag {TRANSPARENT_HUGEPAGE_NEVER_DAX ,
mm/huge_memory.c +13 -18
@@ -889,23 +889,20 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, }/** -* vmf_insert_pfn_pmd_prot - insert a pmd size pfn +* vmf_insert_pfn_pmd - insert a pmd size pfn * @vmf: Structure describing the fault * @pfn: pfn to insert -* @pgprot: page protection to use * @write: whether it's a write fault * -* Insert a pmd size pfn. See vmf_insert_pfn() for additional info and -* also consult the vmf_insert_mixed_prot() documentation when -* @pgprot != @vmf->vma->vm_page_prot. +* Insert a pmd size pfn. See vmf_insert_pfn() for additional info. * * Return: vm_fault_t value. */ -vm_fault_t vmf_insert_pfn_pmd_prot (struct vm_fault *vmf,pfn_t pfn, -pgprot_t pgprot,bool write) +vm_fault_t vmf_insert_pfn_pmd (struct vm_fault *vmf,pfn_t pfn,bool write) {unsigned long addr = vmf->address &PMD_MASK ;struct vm_area_struct *vma = vmf->vma; +pgprot_t pgprot = vma->vm_page_prot;pgtable_t pgtable =NULL ;/*
@@ -933,7 +930,7 @@ vm_fault_t vmf_insert_pfn_pmd_prot(struct vm_fault *vmf, pfn_t pfn,insert_pfn_pmd (vma, addr, vmf->pmd, pfn, pgprot, write, pgtable);return VM_FAULT_NOPAGE ; } -EXPORT_SYMBOL_GPL (vmf_insert_pfn_pmd_prot); +EXPORT_SYMBOL_GPL (vmf_insert_pfn_pmd);#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD static pud_t maybe_pud_mkwrite (pud_t pud,struct vm_area_struct *vma)
@@ -944,9 +941,10 @@ static pud_t maybe_pud_mkwrite(pud_t pud, struct vm_area_struct *vma) }static void insert_pfn_pud (struct vm_area_struct *vma,unsigned long addr, -pud_t *pud,pfn_t pfn,pgprot_t prot,bool write) +pud_t *pud,pfn_t pfn,bool write) {struct mm_struct *mm = vma->vm_mm; +pgprot_t prot = vma->vm_page_prot;pud_t entry;spinlock_t *ptl;
@@ -980,23 +978,20 @@ static void insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, }/** -* vmf_insert_pfn_pud_prot - insert a pud size pfn +* vmf_insert_pfn_pud - insert a pud size pfn * @vmf: Structure describing the fault * @pfn: pfn to insert -* @pgprot: page protection to use * @write: whether it's a write fault * -* Insert a pud size pfn. See vmf_insert_pfn() for additional info and -* also consult the vmf_insert_mixed_prot() documentation when -* @pgprot != @vmf->vma->vm_page_prot. +* Insert a pud size pfn. See vmf_insert_pfn() for additional info. * * Return: vm_fault_t value. */ -vm_fault_t vmf_insert_pfn_pud_prot (struct vm_fault *vmf,pfn_t pfn, -pgprot_t pgprot,bool write) +vm_fault_t vmf_insert_pfn_pud (struct vm_fault *vmf,pfn_t pfn,bool write) {unsigned long addr = vmf->address &PUD_MASK ;struct vm_area_struct *vma = vmf->vma; +pgprot_t pgprot = vma->vm_page_prot;/* * If we had pud_special, we could avoid all these restrictions,
@@ -1014,10 +1009,10 @@ vm_fault_t vmf_insert_pfn_pud_prot(struct vm_fault *vmf, pfn_t pfn,track_pfn_insert (vma, &pgprot, pfn); -insert_pfn_pud (vma, addr, vmf->pud, pfn, pgprot, write); +insert_pfn_pud (vma, addr, vmf->pud, pfn, write);return VM_FAULT_NOPAGE ; } -EXPORT_SYMBOL_GPL (vmf_insert_pfn_pud_prot); +EXPORT_SYMBOL_GPL (vmf_insert_pfn_pud);#endif /* CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */ static void touch_pmd(struct vm_area_struct *vma, unsigned long addr,
Signature · 1 line
2.39.2
PATCH 3/3 drm/ttm: Remove comment referencing now-removed vmf_insert_mixed_prot()
In reply to Lorenzo StoakesThis function no longer exists, however the prot != vma->vm_page_prot case discussion has been retained and moved to vmf_insert_pfn_prot() so refer to this instead.
--- drivers/gpu/drm/ttm/ttm_bo_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_bo_vm.c +1 -1
@@ -254,7 +254,7 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,* encryption bits. This is because the exact location of the * data may not be known at mmap() time and may also change * at arbitrary times while the data is mmap'ed. -* See vmf_insert_mixed_prot() for a discussion. +* See vmf_insert_pfn_prot() for a discussion. */ ret =vmf_insert_pfn_prot (vma, address, pfn, prot);
Signature · 1 line
2.39.2
Re: [PATCH 3/3] drm/ttm: Remove comment referencing now-removed vmf_insert_mixed_prot()
Am 13.03.23 um 00:40 schrieb Lorenzo Stoakes:
Quoted 5 lines
This function no longer exists, however the prot !=
vma->vm_page_protcase discussion has been retained and moved tovmf_insert_pfn_prot()so refer to this instead.Signed-off-by Lorenzo Stoakes <[email protected]>
Feel free to add my acked-by to the other two patches in the series and upstream through any branch you like.
Alternatively ping me when you get rbs for the first two patches from the MM people and I can push this upstream through drm-misc.
Thanks,
Christian.
Quoted 17 lines
--- drivers/gpu/drm/ttm/ttm_bo_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/ttm/ttm_bo_vm.c +1
-1@@ -254,7 +254,7 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,* encryption bits. This is because the exact location of the * data may not be known at mmap() time and may also change * at arbitrary times while the data is mmap'ed. -* See vmf_insert_mixed_prot() for a discussion. +* See vmf_insert_pfn_prot() for a discussion. */ ret =vmf_insert_pfn_prot (vma, address, pfn, prot);
Re: [PATCH 3/3] drm/ttm: Remove comment referencing now-removed vmf_insert_mixed_prot()
Quoted 9 lines · Christian König
Am 13.03.23 um 00:40 schrieb Lorenzo Stoakes:
Quoted 5 lines
This function no longer exists, however the prot !=
vma->vm_page_protcase discussion has been retained and moved tovmf_insert_pfn_prot()so refer to this instead.Signed-off-by Lorenzo Stoakes <[email protected]>Reviewed-by Christian König <[email protected]>
Quoted 8 lines
Feel free to add my acked-by to the other two patches in the series and upstream through any branch you like.
Alternatively ping me when you get rbs for the first two patches from the MM people and I can push this upstream through drm-misc.
Thanks,
Christian.
Thanks, much appreciated! I'd rather go through mm if possible as Andrew has already taken for mm-unstable pending further review + that's easiest for dealing with any mm feedback.
P.S. apologies for dropping the umlaut on your name in initial patch, I really need to sort out my terminal which got horribly confused by non-ANSI characters :)
Quoted 18 lines
Quoted 17 lines
--- drivers/gpu/drm/ttm/ttm_bo_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/ttm/ttm_bo_vm.c +1
-1@@ -254,7 +254,7 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,* encryption bits. This is because the exact location of the * data may not be known at mmap() time and may also change * at arbitrary times while the data is mmap'ed. -* See vmf_insert_mixed_prot() for a discussion. +* See vmf_insert_pfn_prot() for a discussion. */ ret =vmf_insert_pfn_prot (vma, address, pfn, prot);