mm, x86: Add ARCH_HAS_ZONE_DEVICE to Kconfig
Subsystems (4)
PATCH v3 1/6 mm, x86: Add ARCH_HAS_ZONE_DEVICE to Kconfig
Currently ZONE_DEVICE depends on X86_64 and this will get unwieldly as new architectures (and platforms) get ZONE_DEVICE support. Move to an arch selected Kconfig option to save us the trouble.
---
v2: Added missing hunk.
v3: No changes
--- arch/x86/Kconfig | 1 + mm/Kconfig | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-)
arch/x86/Kconfig +1 -0
@@ -59,6 +59,7 @@ config X86 select ARCH_HAS_STRICT_KERNEL_RWX select ARCH_HAS_STRICT_MODULE_RWX select ARCH_HAS_UBSAN_SANITIZE_ALL + select ARCH_HAS_ZONE_DEVICE if X86_64 select ARCH_HAVE_NMI_SAFE_CMPXCHG select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI select ARCH_MIGHT_HAVE_PC_PARPORT
mm/Kconfig +5 -1
@@ -683,12 +683,16 @@ config IDLE_PAGE_TRACKING See Documentation/vm/idle_page_tracking.txt for more details. +# arch_add_memory() comprehends device memory +config ARCH_HAS_ZONE_DEVICE + bool + config ZONE_DEVICE bool "Device memory (pmem, etc...) hotplug support" depends on MEMORY_HOTPLUG depends on MEMORY_HOTREMOVE depends on SPARSEMEM_VMEMMAP - depends on X86_64 #arch_add_memory() comprehends device memory + depends on ARCH_HAS_ZONE_DEVICE help Device memory hotplug support allows for establishing pmem,
Signature · 7 lines
2.9.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v3 2/6 powerpc/vmemmap: Reshuffle vmemmap_free()
Removes an indentation level and shuffles some code around to make the following patch cleaner. No functional changes.
---
v1 -> v2: Remove broken initialiser
--- arch/powerpc/mm/init_64.c | 48 ++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-)
arch/powerpc/mm/init_64.c +25 -23
@@ -234,13 +234,15 @@ static unsigned long vmemmap_list_free(unsigned long start)void __ref vmemmap_free (unsigned long start,unsigned long end) {unsigned long page_size =1 << mmu_psize_defs[mmu_vmemmap_psize].shift; +unsigned long page_order =get_order (page_size); start =_ALIGN_DOWN (start, page_size);pr_debug ("vmemmap_free %lx...%lx\n" , start, end);for (; start < end; start += page_size) { -unsigned long addr; +unsigned long nr_pages, addr; +struct page *page;/* * the section has already be marked as invalid, so
@@ -251,29 +253,29 @@ void __ref vmemmap_free(unsigned long start, unsigned long end)continue ; addr =vmemmap_list_free (start); -if (addr) { -struct page *page =pfn_to_page (addr >>PAGE_SHIFT ); - -if (PageReserved (page)) { -/* allocated from bootmem */ -if (page_size <PAGE_SIZE ) { -/* -* this shouldn't happen, but if it is -* the case, leave the memory there -*/ -WARN_ON_ONCE (1 ); - }else { -unsigned int nr_pages = -1 <<get_order (page_size); -while (nr_pages--) -free_reserved_page (page++); - } - }else -free_pages ((unsigned long )(__va (addr)), -get_order (page_size)); - -vmemmap_remove_mapping (start, page_size); +if (!addr) +continue ; + + page =pfn_to_page (addr >>PAGE_SHIFT ); + nr_pages =1 << page_order; + +if (PageReserved (page)) { +/* allocated from bootmem */ +if (page_size <PAGE_SIZE ) { +/* +* this shouldn't happen, but if it is +* the case, leave the memory there +*/ +WARN_ON_ONCE (1 ); + }else { +while (nr_pages--) +free_reserved_page (page++); + } + }else { +free_pages ((unsigned long )(__va (addr)), page_order); } + + vmemmap_remove_mapping(start, page_size); } }#endif
Signature · 1 line
2.9.4
Re: [PATCH v3 2/6] powerpc/vmemmap: Reshuffle vmemmap_free()
Quoted 73 lines · On Fri, 23 Jun 2017 18:31:18 +1000 Oliver O'Halloran <[email protected]> wrote:
Removes an indentation level and shuffles some code around to make the following patch cleaner. No functional changes.
Signed-off-by Oliver O'Halloran <[email protected]>---
v1 -> v2: Remove broken initialiser--- arch/powerpc/mm/init_64.c | 48 ++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-)arch/powerpc/mm/init_64.c +19
-23@@ -234,13 +234,15 @@ static unsigned long vmemmap_list_free(unsigned long start)void __ref vmemmap_free (unsigned long start,unsigned long end) {unsigned long page_size =1 << mmu_psize_defs[mmu_vmemmap_psize].shift; +unsigned long page_order =get_order (page_size); start =_ALIGN_DOWN (start, page_size);pr_debug ("vmemmap_free %lx...%lx\n" , start, end);for (; start < end; start += page_size) { -unsigned long addr; +unsigned long nr_pages, addr; +struct page *page;/* * the section has already be marked as invalid, so @@ -251,29 +253,29 @@ void __ref vmemmap_free(unsigned long start, unsigned long end)continue ; addr =vmemmap_list_free (start); -if (addr) { -struct page *page =pfn_to_page (addr >>PAGE_SHIFT ); - -if (PageReserved (page)) { -/* allocated from bootmem */ -if (page_size <PAGE_SIZE ) { -/* -* this shouldn't happen, but if it is -* the case, leave the memory there -*/ -WARN_ON_ONCE (1 ); - }else { -unsigned int nr_pages = -1 <<get_order (page_size); -while (nr_pages--) -free_reserved_page (page++); - } - }else -free_pages ((unsigned long )(__va (addr)), -get_order (page_size)); - -vmemmap_remove_mapping (start, page_size); +if (!addr) +continue ; + + page =pfn_to_page (addr >>PAGE_SHIFT ); + nr_pages =1 << page_order; + +if (PageReserved (page)) { +/* allocated from bootmem */ +if (page_size <PAGE_SIZE ) { +/* +* this shouldn't happen, but if it is +* the case, leave the memory there +*/ +WARN_ON_ONCE (1 ); + }else { +while (nr_pages--)
arch/powerpc/mm/init_64.c void __ref vmemmap_free(unsigned long start, unsigned long end) · line 281
Quoted 10 lines
arch/powerpc/mm/init_64.c +6
-0+ free_reserved_page(page++); + } + }else { +free_pages ((unsigned long )(__va (addr)), page_order); } + +vmemmap_remove_mapping (start, page_size); } }#endif
Balbir Singh.
PATCH v3 3/6 powerpc/vmemmap: Add altmap support
In reply to Oliver O'HalloranAdds support to powerpc for the altmap feature of ZONE_DEVICE memory. An altmap is a driver provided region that is used to provide the backing storage for the struct pages of ZONE_DEVICE memory. In situations where large amount of ZONE_DEVICE memory is being added to the system the altmap reduces pressure on main system memory by allowing the mm/ metadata to be stored on the device itself rather in main memory.
--- arch/powerpc/mm/init_64.c | 15 +++++++++++++-- arch/powerpc/mm/mem.c | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-)
arch/powerpc/mm/init_64.c +13 -2
@@ -44,6 +44,7 @@#include <linux/slab.h> #include <linux/of_fdt.h> #include <linux/libfdt.h> +#include <linux/memremap.h> #include <asm/pgalloc.h> #include <asm/page.h>
@@ -171,13 +172,17 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)pr_debug ("vmemmap_populate %lx..%lx, node %d\n" , start, end, node);for (; start < end; start += page_size) { +struct vmem_altmap *altmap;void *p;int rc;if (vmemmap_populated (start, page_size))continue ; - p =vmemmap_alloc_block (page_size, node); +/* altmap lookups only work at section boundaries */ + altmap =to_vmem_altmap (SECTION_ALIGN_DOWN (start)); + + p =__vmemmap_alloc_block_buf (page_size, node, altmap);if (!p)return -ENOMEM ;
@@ -242,6 +247,8 @@ void __ref vmemmap_free(unsigned long start, unsigned long end)for (; start < end; start += page_size) {unsigned long nr_pages, addr; +struct vmem_altmap *altmap; +struct page *section_base;struct page *page;/*
@@ -257,9 +264,13 @@ void __ref vmemmap_free(unsigned long start, unsigned long end)continue ; page =pfn_to_page (addr >>PAGE_SHIFT ); + section_base =pfn_to_page (vmemmap_section_start (start)); nr_pages =1 << page_order; -if (PageReserved (page)) { + altmap =to_vmem_altmap ((unsigned long ) section_base); +if (altmap) { +vmem_altmap_free (altmap, nr_pages); + }else if (PageReserved (page)) {/* allocated from bootmem */ if (page_size <PAGE_SIZE ) {/*
arch/powerpc/mm/mem.c +13 -3
@@ -36,6 +36,7 @@#include <linux/hugetlb.h> #include <linux/slab.h> #include <linux/vmalloc.h> +#include <linux/memremap.h> #include <asm/pgalloc.h> #include <asm/prom.h>
@@ -159,11 +160,20 @@ int arch_remove_memory(u64 start, u64 size) {unsigned long start_pfn = start >>PAGE_SHIFT ;unsigned long nr_pages = size >>PAGE_SHIFT ; -struct zone *zone; +struct vmem_altmap *altmap; +struct page *page;int ret; - zone =page_zone (pfn_to_page (start_pfn)); - ret =__remove_pages (zone, start_pfn, nr_pages); +/* +* If we have an altmap then we need to skip over any reserved PFNs +* when querying the zone. +*/ + page =pfn_to_page (start_pfn); + altmap =to_vmem_altmap ((unsigned long ) page); +if (altmap) + page +=vmem_altmap_offset (altmap); + + ret =__remove_pages (page_zone (page), start_pfn, nr_pages);if (ret)return ret;
Signature · 1 line
2.9.4
PATCH v3 4/6 powerpc/mm: Add devmap support for ppc64
In reply to Oliver O'HalloranAdd support for the devmap bit on PTEs and PMDs for PPC64 Book3S. This is used to differentiate device backed memory from transparent huge pages since they are handled in more or less the same manner by the core mm code.
---
v1 -> v2: Properly differentiate THP and PMD Devmap entries. The mm core assumes that pmd_trans_huge() and pmd_devmap() are mutually exclusive and v1 had pmd_trans_huge() being true on a devmap pmd.
v2 -> v3:
Remove setting of _PAGE_SPECIAL in pmd_mkdevmap() Make pud_pfn() a BUILD_BUG()
Remove unnecessary _PAGE_DEVMAP check in hash__pmd_trans_huge()
--- arch/powerpc/include/asm/book3s/64/pgtable.h | 46 +++++++++++++++++++++++++++- arch/powerpc/include/asm/book3s/64/radix.h | 2 +- arch/powerpc/include/asm/string.h | 1 + arch/powerpc/mm/hugetlbpage.c | 2 +- arch/powerpc/mm/pgtable-book3s64.c | 4 +-- arch/powerpc/mm/pgtable-hash64.c | 4 ++- arch/powerpc/mm/pgtable-radix.c | 3 +- arch/powerpc/mm/pgtable_64.c | 2 +- 8 files changed, 56 insertions(+), 8 deletions(-)
arch/powerpc/include/asm/book3s/64/pgtable.h +45 -1
@@ -5,6 +5,7 @@#ifndef __ASSEMBLY__#include <linux/mmdebug.h> +#include <linux/bug.h> #endif /*
@@ -79,6 +80,9 @@#define _PAGE_SOFT_DIRTY _RPAGE_SW3/* software: software dirty tracking */ #define _PAGE_SPECIAL _RPAGE_SW2/* software: special page */ +#define _PAGE_DEVMAP _RPAGE_SW1 +#define __HAVE_ARCH_PTE_DEVMAP +/* * Drivers request for cache inhibited pte mapping using _PAGE_NO_CACHE * Instead of fixing all of them, add an alternate define which
@@ -599,6 +603,16 @@ static inline pte_t pte_mkhuge(pte_t pte)return pte; } +static inline pte_t pte_mkdevmap (pte_t pte) +{ +return __pte (pte_val (pte) | _PAGE_SPECIAL|_PAGE_DEVMAP); +} + +static inline int pte_devmap (pte_t pte) +{ +return !!(pte_raw (pte) &cpu_to_be64 (_PAGE_DEVMAP)); +} +static inline pte_t pte_modify (pte_t pte,pgprot_t newprot) {/* FIXME!! check whether this need to be a conditional */
@@ -1137,7 +1151,6 @@ static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl,return true; } -#define arch_needs_pgtable_deposit arch_needs_pgtable_depositstatic inline bool arch_needs_pgtable_deposit (void ) {
@@ -1146,6 +1159,37 @@ static inline bool arch_needs_pgtable_deposit(void)return true; } +static inline pmd_t pmd_mkdevmap (pmd_t pmd) +{ +return __pmd (pmd_val (pmd) | (_PAGE_PTE | _PAGE_DEVMAP)); +} + +static inline int pmd_devmap (pmd_t pmd) +{ +return pte_devmap (pmd_pte (pmd)); +} + +static inline int pud_devmap (pud_t pud) +{ +return 0 ; +} + +static inline const int pud_pfn (pud_t pud) +{ +/* +* Calls to pud_pfn() are gated around a pud_devmap() check +* so this should never be used. If it grows another user we +* want to know about it. +*/ +BUILD_BUG (); +return 0 ; +} + +static inline int pgd_devmap (pgd_t pgd) +{ +return 0 ; +} +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ #endif /* __ASSEMBLY__ */ #endif /* _ASM_POWERPC_BOOK3S_64_PGTABLE_H_ */
arch/powerpc/include/asm/book3s/64/radix.h +1 -1
@@ -252,7 +252,7 @@ static inline int radix__pgd_bad(pgd_t pgd)static inline int radix__pmd_trans_huge (pmd_t pmd) { -return !!(pmd_val (pmd) & _PAGE_PTE); +return (pmd_val (pmd) & (_PAGE_PTE | _PAGE_DEVMAP)) == _PAGE_PTE; }static inline pmd_t radix__pmd_mkhuge (pmd_t pmd)
arch/powerpc/include/asm/string.h +1 -0
@@ -10,6 +10,7 @@#define __HAVE_ARCH_MEMMOVE#define __HAVE_ARCH_MEMCMP#define __HAVE_ARCH_MEMCHR +#define __HAVE_ARCH_MEMCPY_FLUSHCACHEextern char *strcpy (char *,const char *);extern char *strncpy (char *,const char *,__kernel_size_t );
arch/powerpc/mm/hugetlbpage.c +1 -1
@@ -963,7 +963,7 @@ pte_t *__find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,if (pmd_none (pmd))return NULL ; -if (pmd_trans_huge (pmd)) { +if (pmd_trans_huge (pmd) ||pmd_devmap (pmd)) {if (is_thp) *is_thp = true; ret_pte = (pte_t *) pmdp;
arch/powerpc/mm/pgtable-book3s64.c +2 -2
@@ -32,7 +32,7 @@ int pmdp_set_access_flags(struct vm_area_struct *vma, unsigned long address, {int changed;#ifdef CONFIG_DEBUG_VM -WARN_ON (!pmd_trans_huge (*pmdp)); +WARN_ON (!pmd_trans_huge (*pmdp) && !pmd_devmap (*pmdp));assert_spin_locked (&vma->vm_mm->page_table_lock);#endif changed = !pmd_same (*(pmdp), entry);
@@ -59,7 +59,7 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,#ifdef CONFIG_DEBUG_VM WARN_ON (pte_present (pmd_pte (*pmdp)) && !pte_protnone (pmd_pte (*pmdp)));assert_spin_locked (&mm->page_table_lock); -WARN_ON (!pmd_trans_huge (pmd)); +WARN_ON (!(pmd_trans_huge (pmd) ||pmd_devmap (pmd)));#endif trace_hugepage_set_pmd (addr,pmd_val (pmd));return set_pte_at (mm, addr,pmdp_ptep (pmdp),pmd_pte (pmd));
arch/powerpc/mm/pgtable-hash64.c +3 -1
@@ -109,7 +109,7 @@ unsigned long hash__pmd_hugepage_update(struct mm_struct *mm, unsigned long addrunsigned long old;#ifdef CONFIG_DEBUG_VM -WARN_ON (!pmd_trans_huge (*pmdp)); +WARN_ON (!hash__pmd_trans_huge (*pmdp) && !pmd_devmap (*pmdp));assert_spin_locked (&mm->page_table_lock);#endif
@@ -141,6 +141,7 @@ pmd_t hash__pmdp_collapse_flush(struct vm_area_struct *vma, unsigned long addresVM_BUG_ON (address & ~HPAGE_PMD_MASK );VM_BUG_ON (pmd_trans_huge (*pmdp)); +VM_BUG_ON (pmd_devmap (*pmdp)); pmd = *pmdp;pmd_clear (pmdp);
@@ -221,6 +222,7 @@ void hash__pmdp_huge_split_prepare(struct vm_area_struct *vma, {VM_BUG_ON (address & ~HPAGE_PMD_MASK );VM_BUG_ON (REGION_ID (address) !=USER_REGION_ID ); +VM_BUG_ON (pmd_devmap (*pmdp));/* * We can't mark the pmd none here, because that will cause a race
arch/powerpc/mm/pgtable-radix.c +2 -1
@@ -683,7 +683,7 @@ unsigned long radix__pmd_hugepage_update(struct mm_struct *mm, unsigned long addunsigned long old;#ifdef CONFIG_DEBUG_VM -WARN_ON (!radix__pmd_trans_huge (*pmdp)); +WARN_ON (!radix__pmd_trans_huge (*pmdp) && !pmd_devmap (*pmdp));assert_spin_locked (&mm->page_table_lock);#endif
@@ -701,6 +701,7 @@ pmd_t radix__pmdp_collapse_flush(struct vm_area_struct *vma, unsigned long addreVM_BUG_ON (address & ~HPAGE_PMD_MASK );VM_BUG_ON (radix__pmd_trans_huge (*pmdp)); +VM_BUG_ON (pmd_devmap (*pmdp));/* * khugepaged calls this for normal pmd */
arch/powerpc/mm/pgtable_64.c +1 -1
@@ -323,7 +323,7 @@ struct page *pud_page(pud_t pud)*/ struct page *pmd_page (pmd_t pmd) { -if (pmd_trans_huge (pmd) ||pmd_huge (pmd)) +if (pmd_trans_huge (pmd) ||pmd_huge (pmd) ||pmd_devmap (pmd))return pte_page (pmd_pte (pmd));return virt_to_page (pmd_page_vaddr (pmd)); }
Signature · 1 line
2.9.4
kbuild test robot
build botRe: [PATCH v3 4/6] powerpc/mm: Add devmap support for ppc64
reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross…
Hi Oliver,
[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.12-rc6 next-20170623]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Oliver-O-Halloran/mm-x86-Add-ARCH_HAS_ZONE_DEVICE-to-Kconfig/20170625-102522 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc-defconfig (attached as .config) compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc
All errors (new ones prefixed by >>):
mm/gup.c: In function '__gup_device_huge_pud':
>> mm/gup.c:1329:14: error: implicit declaration of function 'pud_pfn' [-Werror=implicit-function-declaration]
fault_pfn = pud_pfn(pud) + ((addr & ~PUD_MASK) >> PAGE_SHIFT);
^~~~~~~cc1: some warnings being treated as errors
vim +/pud_pfn +1329 mm/gup.c
b59f65fa Kirill A. Shutemov 2017-03-16 1323
b59f65fa Kirill A. Shutemov 2017-03-16 1324 static int __gup_device_huge_pud(pud_t pud, unsigned long addr,
b59f65fa Kirill A. Shutemov 2017-03-16 1325 unsigned long end, struct page **pages, int *nr)
b59f65fa Kirill A. Shutemov 2017-03-16 1326 {
b59f65fa Kirill A. Shutemov 2017-03-16 1327 unsigned long fault_pfn;
b59f65fa Kirill A. Shutemov 2017-03-16 1328
b59f65fa Kirill A. Shutemov 2017-03-16 @1329 fault_pfn = pud_pfn(pud) + ((addr & ~PUD_MASK) >> PAGE_SHIFT);
b59f65fa Kirill A. Shutemov 2017-03-16 1330 return __gup_device_huge(fault_pfn, addr, end, pages, nr);
b59f65fa Kirill A. Shutemov 2017-03-16 1331 }
b59f65fa Kirill A. Shutemov 2017-03-16 1332 #else:::::: The code at line 1329 was first introduced by commit
:::::: b59f65fa076a8eac2ff3a8ab7f8e1705b9fa86cb mm/gup: Implement the dev_pagemap() logic in the generic get_user_pages_fast() function
:::::: TO: Kirill A. Shutemov <[email protected]> :::::: CC: Ingo Molnar <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Michael Ellerman
reviewerRe: [PATCH v3 4/6] powerpc/mm: Add devmap support for ppc64
Quoted 16 lines · kbuild test robot
Hi Oliver,
[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.12-rc6 next-20170623]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]url: https://github.com/0day-ci/linux/commits/Oliver-O-Halloran/mm-x86-Add-ARCH_HAS_ZONE_DEVICE-to-Kconfig/20170625-102522 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc-defconfig (attached as .config) compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc
Quoted 7 lines
All errors (new ones prefixed by >>):
mm/gup.c: In function '__gup_device_huge_pud':Quoted 1 line
Quoted 1 line
mm/gup.c:1329:14: error: implicit declaration of function 'pud_pfn' [-Werror=implicit-function-declaration]fault_pfn = pud_pfn(pud) + ((addr & ~PUD_MASK) >> PAGE_SHIFT); ^~~~~~~cc1: some warnings being treated as errors
The key here is that CONFIG_TRANSPARENT_HUGEPAGE=n.
So this needs to be fixed before I can merge this.
I think the problem is just that pud_pfn() is inside #ifdef CONFIG_TRANSPARENT_HUGEPAGE but shouldn't be.
cheers
Re: [PATCH v3 4/6] powerpc/mm: Add devmap support for ppc64
Quoted 26 lines · Michael Ellerman
Quoted 16 lines · kbuild test robot
Hi Oliver,
[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.12-rc6 next-20170623]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]url: https://github.com/0day-ci/linux/commits/Oliver-O-Halloran/mm-x86-Add-ARCH_HAS_ZONE_DEVICE-to-Kconfig/20170625-102522 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc-defconfig (attached as .config) compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpcQuoted 7 lines
All errors (new ones prefixed by >>):
mm/gup.c: In function '__gup_device_huge_pud':Quoted 1 line
Quoted 1 line
mm/gup.c:1329:14: error: implicit declaration of function 'pud_pfn' [-Werror=implicit-function-declaration]fault_pfn = pud_pfn(pud) + ((addr & ~PUD_MASK) >> PAGE_SHIFT); ^~~~~~~cc1: some warnings being treated as errors
Quoted 6 lines
The key here is that
CONFIG_TRANSPARENT_HUGEPAGE=n.So this needs to be fixed before I can merge this.
I think the problem is just that
pud_pfn()is inside #ifdefCONFIG_TRANSPARENT_HUGEPAGEbut shouldn't be.
I'm not 100% sold on making pud_pfn() independent of THP. pmd_pfn() is used a few times in generic code, but the usages are always gated by a #ifdef CONFIG_TRANSPARENT_HUGEPAGE so I think we should be doing the same here. I sent a patch[1] yesterday to fix the usage in gup.c, but I'll do a respin if you want.
Thanks,
Oliver
PATCH v3 5/6 powerpc/mm: Wire up hpte_removebolted for powernv
In reply to Oliver O'HalloranFrom: Anton Blanchard <[email protected]>
Adds support for removing bolted (i.e kernel linear mapping) mappings on powernv. This is needed to support memory hot unplug operations which are required for the teardown of DAX/PMEM devices.
---
v1 -> v2: Fixed the commit author
Added VM_WARN_ON() if we attempt to remove an unbolted hpte
--- arch/powerpc/mm/hash_native_64.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
arch/powerpc/mm/hash_native_64.c +33 -0
@@ -407,6 +407,38 @@ static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea,tlbie (vpn, psize, psize, ssize,0 ); } +/* +* Remove a bolted kernel entry. Memory hotplug uses this. +* +* No need to lock here because we should be the only user. +*/ +static int native_hpte_removebolted (unsigned long ea,int psize,int ssize) +{ +unsigned long vpn; +unsigned long vsid; +long slot; +struct hash_pte *hptep; + + vsid =get_kernel_vsid (ea, ssize); + vpn =hpt_vpn (ea, vsid, ssize); + + slot =native_hpte_find (vpn, psize, ssize); +if (slot ==-1 ) +return -ENOENT ; + + hptep = htab_address + slot; + +VM_WARN_ON (!(be64_to_cpu (hptep->v) &HPTE_V_BOLTED )); + +/* Invalidate the hpte */ + hptep->v =0 ; + +/* Invalidate the TLB */ +tlbie (vpn, psize, psize, ssize,0 ); +return 0 ; +} + +static void native_hpte_invalidate (unsigned long slot,unsigned long vpn,int bpsize,int apsize,int ssize,int local) {
@@ -725,6 +757,7 @@ void __init hpte_init_native(void) mmu_hash_ops.hpte_invalidate = native_hpte_invalidate; mmu_hash_ops.hpte_updatepp = native_hpte_updatepp; mmu_hash_ops.hpte_updateboltedpp = native_hpte_updateboltedpp; + mmu_hash_ops.hpte_removebolted = native_hpte_removebolted; mmu_hash_ops.hpte_insert = native_hpte_insert; mmu_hash_ops.hpte_remove = native_hpte_remove; mmu_hash_ops.hpte_clear_all = native_hpte_clear;
Signature · 1 line
2.9.4
PATCH v3 6/6 powerpc/mm: Enable ZONE_DEVICE on powerpc
In reply to Oliver O'HalloranFlip the switch. Running around and screaming "IT'S ALIVE" is optional, but recommended.
---
v3: Only select when building for 64bit Book3-S
--- arch/powerpc/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/Kconfig +1 -0
@@ -138,6 +138,7 @@ config PPC select ARCH_HAS_SG_CHAIN select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAS_UBSAN_SANITIZE_ALL + select ARCH_HAS_ZONE_DEVICE if PPC_BOOK3S_64 select ARCH_HAVE_NMI_SAFE_CMPXCHG select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO
Signature · 1 line
2.9.4
Quoted 41 lines · Oliver O'Halloran
Currently
ZONE_DEVICEdepends onX86_64and this will get unwieldly as new architectures (and platforms) getZONE_DEVICEsupport. Move to an arch selectedKconfigoption to save us the trouble.Acked-by Ingo Molnar <[email protected]>Acked-by Balbir Singh <[email protected]>Signed-off-by Oliver O'Halloran <[email protected]>---
v2: Added missing hunk.
v3: No changes--- arch/x86/Kconfig | 1 + mm/Kconfig | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-)arch/x86/Kconfig +1
-0@@ -59,6 +59,7 @@ config X86 select ARCH_HAS_STRICT_KERNEL_RWX select ARCH_HAS_STRICT_MODULE_RWX select ARCH_HAS_UBSAN_SANITIZE_ALL + select ARCH_HAS_ZONE_DEVICE if X86_64 select ARCH_HAVE_NMI_SAFE_CMPXCHG select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI select ARCH_MIGHT_HAVE_PC_PARPORTmm/Kconfig +4
-0@@ -683,12 +683,16 @@ config IDLE_PAGE_TRACKING See Documentation/vm/idle_page_tracking.txt for more details. +# arch_add_memory() comprehends device memory +config ARCH_HAS_ZONE_DEVICE + bool +
mm/Kconfig config IDLE_PAGE_TRACKING · line 698
Quoted 10 lines
mm/Kconfig +1
-1config ZONE_DEVICE bool "Device memory (pmem, etc...) hotplug support" depends on MEMORY_HOTPLUG depends on MEMORY_HOTREMOVE depends on SPARSEMEM_VMEMMAP - depends on X86_64 #arch_add_memory() comprehends device memory + depends on ARCH_HAS_ZONE_DEVICE help Device memory hotplug support allows for establishing pmem,
Hi Oliver,
+1, this is nice to have, and it behaves as expected on x86_64 with and without HMM, at least with the small bit of Kconfig dependency testing I did here.
thanks,
john h
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>