The patch titled Subject: mm: introduce ARCH_HAS_PTE_SPECIAL has been added to the -mm tree. Its filename is mm-introduce-arch_has_pte_special.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-introduce-arch_has_pte_special.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-introduce-arch_has_pte_special.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Laurent Dufour <ldufour@xxxxxxxxxxxxxxxxxx> Subject: mm: introduce ARCH_HAS_PTE_SPECIAL Currently the PTE special supports is turned on in per architecture header files. Most of the time, it is defined in arch/*/include/asm/pgtable.h depending or not on some other per architecture static definition. This patch introduce a new configuration variable to manage this directly in the Kconfig files. It would later replace __HAVE_ARCH_PTE_SPECIAL. Here notes for some architecture where the definition of __HAVE_ARCH_PTE_SPECIAL is not obvious: arm __HAVE_ARCH_PTE_SPECIAL which is currently defined in arch/arm/include/asm/pgtable-3level.h which is included by arch/arm/include/asm/pgtable.h when CONFIG_ARM_LPAE is set. So select ARCH_HAS_PTE_SPECIAL if ARM_LPAE. powerpc __HAVE_ARCH_PTE_SPECIAL is defined in 2 files: - arch/powerpc/include/asm/book3s/64/pgtable.h - arch/powerpc/include/asm/pte-common.h The first one is included if (PPC_BOOK3S & PPC64) while the second is included in all the other cases. So select ARCH_HAS_PTE_SPECIAL all the time. sparc: __HAVE_ARCH_PTE_SPECIAL is defined if defined(__sparc__) && defined(__arch64__) which are defined through the compiler in sparc/Makefile if !SPARC32 which I assume to be if SPARC64. So select ARCH_HAS_PTE_SPECIAL if SPARC64 There is no functional change introduced by this patch. Link: http://lkml.kernel.org/r/1523433816-14460-2-git-send-email-ldufour@xxxxxxxxxxxxxxxxxx Signed-off-by: Laurent Dufour <ldufour@xxxxxxxxxxxxxxxxxx> Suggested-by: Jerome Glisse <jglisse@xxxxxxxxxx> Reviewed-by: Jerome Glisse <jglisse@xxxxxxxxxx> Acked-by: David Rientjes <rientjes@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: "Aneesh Kumar K . V" <aneesh.kumar@xxxxxxxxxxxxxxxxxx> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> Cc: Paul Mackerras <paulus@xxxxxxxxx> Cc: Jonathan Corbet <corbet@xxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Cc: Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx> Cc: Rich Felker <dalias@xxxxxxxx> Cc: David S. Miller <davem@xxxxxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: Vineet Gupta <vgupta@xxxxxxxxxxxx> Cc: Palmer Dabbelt <palmer@xxxxxxxxxx> Cc: Albert Ou <albert@xxxxxxxxxx> Cc: Martin Schwidefsky <schwidefsky@xxxxxxxxxx> Cc: Heiko Carstens <heiko.carstens@xxxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Robin Murphy <robin.murphy@xxxxxxx> Cc: Christophe LEROY <christophe.leroy@xxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- Documentation/features/vm/pte_special/arch-support.txt | 2 +- arch/arc/Kconfig | 1 + arch/arc/include/asm/pgtable.h | 2 -- arch/arm/Kconfig | 1 + arch/arm/include/asm/pgtable-3level.h | 1 - arch/arm64/Kconfig | 1 + arch/arm64/include/asm/pgtable.h | 2 -- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/book3s/64/pgtable.h | 3 --- arch/powerpc/include/asm/pte-common.h | 3 --- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/pgtable-bits.h | 3 --- arch/s390/Kconfig | 1 + arch/s390/include/asm/pgtable.h | 1 - arch/sh/Kconfig | 1 + arch/sh/include/asm/pgtable.h | 2 -- arch/sparc/Kconfig | 1 + arch/sparc/include/asm/pgtable_64.h | 3 --- arch/x86/Kconfig | 1 + arch/x86/include/asm/pgtable_types.h | 1 - include/linux/pfn_t.h | 4 ++-- mm/Kconfig | 3 +++ mm/gup.c | 4 ++-- mm/memory.c | 2 +- 24 files changed, 18 insertions(+), 27 deletions(-) diff -puN arch/arc/include/asm/pgtable.h~mm-introduce-arch_has_pte_special arch/arc/include/asm/pgtable.h --- a/arch/arc/include/asm/pgtable.h~mm-introduce-arch_has_pte_special +++ a/arch/arc/include/asm/pgtable.h @@ -320,8 +320,6 @@ PTE_BIT_FUNC(mkexec, |= (_PAGE_EXECUTE)) PTE_BIT_FUNC(mkspecial, |= (_PAGE_SPECIAL)); PTE_BIT_FUNC(mkhuge, |= (_PAGE_HW_SZ)); -#define __HAVE_ARCH_PTE_SPECIAL - static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { return __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot)); diff -puN arch/arc/Kconfig~mm-introduce-arch_has_pte_special arch/arc/Kconfig --- a/arch/arc/Kconfig~mm-introduce-arch_has_pte_special +++ a/arch/arc/Kconfig @@ -44,6 +44,7 @@ config ARC select HAVE_GENERIC_DMA_COHERENT select HAVE_KERNEL_GZIP select HAVE_KERNEL_LZMA + select ARCH_HAS_PTE_SPECIAL config MIGHT_HAVE_PCI bool diff -puN arch/arm64/include/asm/pgtable.h~mm-introduce-arch_has_pte_special arch/arm64/include/asm/pgtable.h --- a/arch/arm64/include/asm/pgtable.h~mm-introduce-arch_has_pte_special +++ a/arch/arm64/include/asm/pgtable.h @@ -306,8 +306,6 @@ static inline int pte_same(pte_t pte_a, #define HPAGE_MASK (~(HPAGE_SIZE - 1)) #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) -#define __HAVE_ARCH_PTE_SPECIAL - static inline pte_t pgd_pte(pgd_t pgd) { return __pte(pgd_val(pgd)); diff -puN arch/arm64/Kconfig~mm-introduce-arch_has_pte_special arch/arm64/Kconfig --- a/arch/arm64/Kconfig~mm-introduce-arch_has_pte_special +++ a/arch/arm64/Kconfig @@ -17,6 +17,7 @@ config ARM64 select ARCH_HAS_GIGANTIC_PAGE if (MEMORY_ISOLATION && COMPACTION) || CMA select ARCH_HAS_KCOV select ARCH_HAS_MEMBARRIER_SYNC_CORE + select ARCH_HAS_PTE_SPECIAL select ARCH_HAS_SET_MEMORY select ARCH_HAS_SG_CHAIN select ARCH_HAS_STRICT_KERNEL_RWX diff -puN arch/arm/include/asm/pgtable-3level.h~mm-introduce-arch_has_pte_special arch/arm/include/asm/pgtable-3level.h --- a/arch/arm/include/asm/pgtable-3level.h~mm-introduce-arch_has_pte_special +++ a/arch/arm/include/asm/pgtable-3level.h @@ -219,7 +219,6 @@ static inline pte_t pte_mkspecial(pte_t pte_val(pte) |= L_PTE_SPECIAL; return pte; } -#define __HAVE_ARCH_PTE_SPECIAL #define pmd_write(pmd) (pmd_isclear((pmd), L_PMD_SECT_RDONLY)) #define pmd_dirty(pmd) (pmd_isset((pmd), L_PMD_SECT_DIRTY)) diff -puN arch/arm/Kconfig~mm-introduce-arch_has_pte_special arch/arm/Kconfig --- a/arch/arm/Kconfig~mm-introduce-arch_has_pte_special +++ a/arch/arm/Kconfig @@ -8,6 +8,7 @@ config ARM select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_FORTIFY_SOURCE + select ARCH_HAS_PTE_SPECIAL if ARM_LPAE select ARCH_HAS_SET_MEMORY select ARCH_HAS_PHYS_TO_DMA select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL diff -puN arch/powerpc/include/asm/book3s/64/pgtable.h~mm-introduce-arch_has_pte_special arch/powerpc/include/asm/book3s/64/pgtable.h --- a/arch/powerpc/include/asm/book3s/64/pgtable.h~mm-introduce-arch_has_pte_special +++ a/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -319,9 +319,6 @@ extern unsigned long pci_io_base; /* Advertise special mapping type for AGP */ #define HAVE_PAGE_AGP -/* Advertise support for _PAGE_SPECIAL */ -#define __HAVE_ARCH_PTE_SPECIAL - #ifndef __ASSEMBLY__ /* diff -puN arch/powerpc/include/asm/pte-common.h~mm-introduce-arch_has_pte_special arch/powerpc/include/asm/pte-common.h --- a/arch/powerpc/include/asm/pte-common.h~mm-introduce-arch_has_pte_special +++ a/arch/powerpc/include/asm/pte-common.h @@ -216,9 +216,6 @@ static inline bool pte_user(pte_t pte) #define PAGE_AGP (PAGE_KERNEL_NC) #define HAVE_PAGE_AGP -/* Advertise support for _PAGE_SPECIAL */ -#define __HAVE_ARCH_PTE_SPECIAL - #ifndef _PAGE_READ /* if not defined, we should not find _PAGE_WRITE too */ #define _PAGE_READ 0 diff -puN arch/powerpc/Kconfig~mm-introduce-arch_has_pte_special arch/powerpc/Kconfig --- a/arch/powerpc/Kconfig~mm-introduce-arch_has_pte_special +++ a/arch/powerpc/Kconfig @@ -141,6 +141,7 @@ config PPC select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_PHYS_TO_DMA select ARCH_HAS_PMEM_API if PPC64 + select ARCH_HAS_PTE_SPECIAL select ARCH_HAS_MEMBARRIER_CALLBACKS select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE select ARCH_HAS_SG_CHAIN diff -puN arch/riscv/include/asm/pgtable-bits.h~mm-introduce-arch_has_pte_special arch/riscv/include/asm/pgtable-bits.h --- a/arch/riscv/include/asm/pgtable-bits.h~mm-introduce-arch_has_pte_special +++ a/arch/riscv/include/asm/pgtable-bits.h @@ -42,7 +42,4 @@ _PAGE_WRITE | _PAGE_EXEC | \ _PAGE_USER | _PAGE_GLOBAL)) -/* Advertise support for _PAGE_SPECIAL */ -#define __HAVE_ARCH_PTE_SPECIAL - #endif /* _ASM_RISCV_PGTABLE_BITS_H */ diff -puN arch/riscv/Kconfig~mm-introduce-arch_has_pte_special arch/riscv/Kconfig --- a/arch/riscv/Kconfig~mm-introduce-arch_has_pte_special +++ a/arch/riscv/Kconfig @@ -34,6 +34,7 @@ config RISCV select THREAD_INFO_IN_TASK select RISCV_TIMER select GENERIC_IRQ_MULTI_HANDLER + select ARCH_HAS_PTE_SPECIAL config MMU def_bool y diff -puN arch/s390/include/asm/pgtable.h~mm-introduce-arch_has_pte_special arch/s390/include/asm/pgtable.h --- a/arch/s390/include/asm/pgtable.h~mm-introduce-arch_has_pte_special +++ a/arch/s390/include/asm/pgtable.h @@ -171,7 +171,6 @@ static inline int is_module_addr(void *a #define _PAGE_WRITE 0x020 /* SW pte write bit */ #define _PAGE_SPECIAL 0x040 /* SW associated with special page */ #define _PAGE_UNUSED 0x080 /* SW bit for pgste usage state */ -#define __HAVE_ARCH_PTE_SPECIAL #ifdef CONFIG_MEM_SOFT_DIRTY #define _PAGE_SOFT_DIRTY 0x002 /* SW pte soft dirty bit */ diff -puN arch/s390/Kconfig~mm-introduce-arch_has_pte_special arch/s390/Kconfig --- a/arch/s390/Kconfig~mm-introduce-arch_has_pte_special +++ a/arch/s390/Kconfig @@ -72,6 +72,7 @@ config S390 select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_GIGANTIC_PAGE if (MEMORY_ISOLATION && COMPACTION) || CMA select ARCH_HAS_KCOV + select ARCH_HAS_PTE_SPECIAL select ARCH_HAS_SET_MEMORY select ARCH_HAS_SG_CHAIN select ARCH_HAS_STRICT_KERNEL_RWX diff -puN arch/sh/include/asm/pgtable.h~mm-introduce-arch_has_pte_special arch/sh/include/asm/pgtable.h --- a/arch/sh/include/asm/pgtable.h~mm-introduce-arch_has_pte_special +++ a/arch/sh/include/asm/pgtable.h @@ -156,8 +156,6 @@ extern void page_table_range_init(unsign #define HAVE_ARCH_UNMAPPED_AREA #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN -#define __HAVE_ARCH_PTE_SPECIAL - #include <asm-generic/pgtable.h> #endif /* __ASM_SH_PGTABLE_H */ diff -puN arch/sh/Kconfig~mm-introduce-arch_has_pte_special arch/sh/Kconfig --- a/arch/sh/Kconfig~mm-introduce-arch_has_pte_special +++ a/arch/sh/Kconfig @@ -50,6 +50,7 @@ config SUPERH select HAVE_ARCH_AUDITSYSCALL select HAVE_FUTEX_CMPXCHG if FUTEX select HAVE_NMI + select ARCH_HAS_PTE_SPECIAL help The SuperH is a RISC processor targeted for use in embedded systems and consumer electronics; it was also used in the Sega Dreamcast diff -puN arch/sparc/include/asm/pgtable_64.h~mm-introduce-arch_has_pte_special arch/sparc/include/asm/pgtable_64.h --- a/arch/sparc/include/asm/pgtable_64.h~mm-introduce-arch_has_pte_special +++ a/arch/sparc/include/asm/pgtable_64.h @@ -117,9 +117,6 @@ bool kern_addr_valid(unsigned long addr) #define _PAGE_PMD_HUGE _AC(0x0100000000000000,UL) /* Huge page */ #define _PAGE_PUD_HUGE _PAGE_PMD_HUGE -/* Advertise support for _PAGE_SPECIAL */ -#define __HAVE_ARCH_PTE_SPECIAL - /* SUN4U pte bits... */ #define _PAGE_SZ4MB_4U _AC(0x6000000000000000,UL) /* 4MB Page */ #define _PAGE_SZ512K_4U _AC(0x4000000000000000,UL) /* 512K Page */ diff -puN arch/sparc/Kconfig~mm-introduce-arch_has_pte_special arch/sparc/Kconfig --- a/arch/sparc/Kconfig~mm-introduce-arch_has_pte_special +++ a/arch/sparc/Kconfig @@ -86,6 +86,7 @@ config SPARC64 select ARCH_USE_QUEUED_SPINLOCKS select GENERIC_TIME_VSYSCALL select ARCH_CLOCKSOURCE_DATA + select ARCH_HAS_PTE_SPECIAL config ARCH_DEFCONFIG string diff -puN arch/x86/include/asm/pgtable_types.h~mm-introduce-arch_has_pte_special arch/x86/include/asm/pgtable_types.h --- a/arch/x86/include/asm/pgtable_types.h~mm-introduce-arch_has_pte_special +++ a/arch/x86/include/asm/pgtable_types.h @@ -65,7 +65,6 @@ #define _PAGE_PKEY_BIT2 (_AT(pteval_t, 0)) #define _PAGE_PKEY_BIT3 (_AT(pteval_t, 0)) #endif -#define __HAVE_ARCH_PTE_SPECIAL #define _PAGE_PKEY_MASK (_PAGE_PKEY_BIT0 | \ _PAGE_PKEY_BIT1 | \ diff -puN arch/x86/Kconfig~mm-introduce-arch_has_pte_special arch/x86/Kconfig --- a/arch/x86/Kconfig~mm-introduce-arch_has_pte_special +++ a/arch/x86/Kconfig @@ -57,6 +57,7 @@ config X86 select ARCH_HAS_KCOV if X86_64 select ARCH_HAS_MEMBARRIER_SYNC_CORE select ARCH_HAS_PMEM_API if X86_64 + select ARCH_HAS_PTE_SPECIAL select ARCH_HAS_REFCOUNT select ARCH_HAS_UACCESS_FLUSHCACHE if X86_64 select ARCH_HAS_SET_MEMORY diff -puN Documentation/features/vm/pte_special/arch-support.txt~mm-introduce-arch_has_pte_special Documentation/features/vm/pte_special/arch-support.txt --- a/Documentation/features/vm/pte_special/arch-support.txt~mm-introduce-arch_has_pte_special +++ a/Documentation/features/vm/pte_special/arch-support.txt @@ -1,6 +1,6 @@ # # Feature name: pte_special -# Kconfig: __HAVE_ARCH_PTE_SPECIAL +# Kconfig: ARCH_HAS_PTE_SPECIAL # description: arch supports the pte_special()/pte_mkspecial() VM APIs # ----------------------- diff -puN include/linux/pfn_t.h~mm-introduce-arch_has_pte_special include/linux/pfn_t.h --- a/include/linux/pfn_t.h~mm-introduce-arch_has_pte_special +++ a/include/linux/pfn_t.h @@ -122,7 +122,7 @@ pud_t pud_mkdevmap(pud_t pud); #endif #endif /* __HAVE_ARCH_PTE_DEVMAP */ -#ifdef __HAVE_ARCH_PTE_SPECIAL +#ifdef CONFIG_ARCH_HAS_PTE_SPECIAL static inline bool pfn_t_special(pfn_t pfn) { return (pfn.val & PFN_SPECIAL) == PFN_SPECIAL; @@ -132,5 +132,5 @@ static inline bool pfn_t_special(pfn_t p { return false; } -#endif /* __HAVE_ARCH_PTE_SPECIAL */ +#endif /* CONFIG_ARCH_HAS_PTE_SPECIAL */ #endif /* _LINUX_PFN_T_H_ */ diff -puN mm/gup.c~mm-introduce-arch_has_pte_special mm/gup.c --- a/mm/gup.c~mm-introduce-arch_has_pte_special +++ a/mm/gup.c @@ -1351,7 +1351,7 @@ static void undo_dev_pagemap(int *nr, in } } -#ifdef __HAVE_ARCH_PTE_SPECIAL +#ifdef CONFIG_ARCH_HAS_PTE_SPECIAL static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end, int write, struct page **pages, int *nr) { @@ -1427,7 +1427,7 @@ static int gup_pte_range(pmd_t pmd, unsi { return 0; } -#endif /* __HAVE_ARCH_PTE_SPECIAL */ +#endif /* CONFIG_ARCH_HAS_PTE_SPECIAL */ #if defined(__HAVE_ARCH_PTE_DEVMAP) && defined(CONFIG_TRANSPARENT_HUGEPAGE) static int __gup_device_huge(unsigned long pfn, unsigned long addr, diff -puN mm/Kconfig~mm-introduce-arch_has_pte_special mm/Kconfig --- a/mm/Kconfig~mm-introduce-arch_has_pte_special +++ a/mm/Kconfig @@ -752,3 +752,6 @@ config GUP_BENCHMARK performance of get_user_pages_fast(). See tools/testing/selftests/vm/gup_benchmark.c + +config ARCH_HAS_PTE_SPECIAL + bool diff -puN mm/memory.c~mm-introduce-arch_has_pte_special mm/memory.c --- a/mm/memory.c~mm-introduce-arch_has_pte_special +++ a/mm/memory.c @@ -817,7 +817,7 @@ static void print_bad_pte(struct vm_area * PFNMAP mappings in order to support COWable mappings. * */ -#ifdef __HAVE_ARCH_PTE_SPECIAL +#ifdef CONFIG_ARCH_HAS_PTE_SPECIAL # define HAVE_PTE_SPECIAL 1 #else # define HAVE_PTE_SPECIAL 0 _ Patches currently in -mm which might be from ldufour@xxxxxxxxxxxxxxxxxx are mm-introduce-arch_has_pte_special.patch mm-remove-odd-have_pte_special.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html