tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: d5226fa6dbae0569ee43ecfc08bdcd6770fc4755 commit: 6bd33e1ece528f67646db33bf97406b747dafda0 riscv: add nommu support date: 2 months ago config: riscv-randconfig-a001-20200127 (attached as .config) compiler: riscv64-linux-gcc (GCC) 7.5.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 6bd33e1ece528f67646db33bf97406b747dafda0 # save the attached .config to linux build tree GCC_VERSION=7.5.0 make.cross ARCH=riscv If you fix the issue, kindly add following tag Reported-by: kbuild test robot All error/warnings (new ones prefixed by >>): from include/linux/preempt.h:78, from include/linux/spinlock.h:51, from include/linux/seqlock.h:36, from include/linux/time.h:6, from include/linux/stat.h:19, from include/linux/module.h:10, from init/main.c:17: include/linux/highmem.h: In function 'kmap_to_page': include/asm-generic/memory_model.h:54:29: error: 'vmemmap' undeclared (first use in this function); did you mean 'vm_mmap'? #define __pfn_to_page(pfn) (vmemmap + (pfn)) ^ include/asm-generic/memory_model.h:82:21: note: in expansion of macro '__pfn_to_page' #define pfn_to_page __pfn_to_page ^~~~~~~~~~~~~ arch/riscv/include/asm/page.h:112:30: note: in expansion of macro 'pfn_to_page' #define virt_to_page(vaddr) (pfn_to_page(virt_to_pfn(vaddr))) ^~~~~~~~~~~ include/linux/highmem.h:75:9: note: in expansion of macro 'virt_to_page' return virt_to_page(addr); ^~~~~~~~~~~~ include/linux/scatterlist.h: In function 'sg_set_buf': include/asm-generic/memory_model.h:54:29: error: 'vmemmap' undeclared (first use in this function); did you mean 'vm_mmap'? #define __pfn_to_page(pfn) (vmemmap + (pfn)) ^ include/asm-generic/memory_model.h:82:21: note: in expansion of macro '__pfn_to_page' #define pfn_to_page __pfn_to_page ^~~~~~~~~~~~~ arch/riscv/include/asm/page.h:112:30: note: in expansion of macro 'pfn_to_page' #define virt_to_page(vaddr) (pfn_to_page(virt_to_pfn(vaddr))) ^~~~~~~~~~~ include/linux/scatterlist.h:145:18: note: in expansion of macro 'virt_to_page' sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf)); ^~~~~~~~~~~~ In file included from arch/riscv/include/asm/page.h:12:0, from arch/riscv/include/asm/thread_info.h:11, from include/linux/thread_info.h:38, from include/asm-generic/preempt.h:5, from ./arch/riscv/include/generated/asm/preempt.h:1, from include/linux/preempt.h:78, from include/linux/spinlock.h:51, from include/linux/seqlock.h:36, from include/linux/time.h:6, from include/linux/stat.h:19, from include/linux/module.h:10, from init/main.c:17: include/linux/scatterlist.h: In function 'sg_phys': include/asm-generic/memory_model.h:55:54: error: 'vmemmap' undeclared (first use in this function); did you mean 'vm_mmap'? #define __page_to_pfn(page) (unsigned long)((page) - vmemmap) ^ include/linux/pfn.h:21:36: note: in definition of macro 'PFN_PHYS' #define PFN_PHYS(x) ((phys_addr_t)(x) << PAGE_SHIFT) ^ arch/riscv/include/asm/page.h:115:29: note: in expansion of macro 'pfn_to_phys' #define page_to_phys(page) (pfn_to_phys(page_to_pfn(page))) ^~~~~~~~~~~ include/asm-generic/memory_model.h:81:21: note: in expansion of macro '__page_to_pfn' #define page_to_pfn __page_to_pfn ^~~~~~~~~~~~~ arch/riscv/include/asm/page.h:115:41: note: in expansion of macro 'page_to_pfn' #define page_to_phys(page) (pfn_to_phys(page_to_pfn(page))) ^~~~~~~~~~~ include/linux/scatterlist.h:224:9: note: in expansion of macro 'page_to_phys' return page_to_phys(sg_page(sg)) + sg->offset; ^~~~~~~~~~~~ In file included from arch/riscv/include/asm/page.h:131:0, from arch/riscv/include/asm/thread_info.h:11, from include/linux/thread_info.h:38, from include/asm-generic/preempt.h:5, from ./arch/riscv/include/generated/asm/preempt.h:1, from include/linux/preempt.h:78, from include/linux/spinlock.h:51, from include/linux/seqlock.h:36, from include/linux/time.h:6, from include/linux/stat.h:19, from include/linux/module.h:10, from init/main.c:17: include/linux/scatterlist.h: In function 'sg_page_iter_page': include/asm-generic/memory_model.h:54:29: error: 'vmemmap' undeclared (first use in this function); did you mean 'vm_mmap'? #define __pfn_to_page(pfn) (vmemmap + (pfn)) ^ include/asm-generic/memory_model.h:82:21: note: in expansion of macro '__pfn_to_page' #define pfn_to_page __pfn_to_page ^~~~~~~~~~~~~ include/linux/mm.h:213:26: note: in expansion of macro 'pfn_to_page' #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) ^~~~~~~~~~~ include/linux/scatterlist.h:384:9: note: in expansion of macro 'nth_page' return nth_page(sg_page(piter->sg), piter->sg_pgoffset); ^~~~~~~~ In file included from include/linux/kernel.h:11:0, from include/linux/list.h:9, from include/linux/module.h:9, from init/main.c:17: init/main.c: In function 'start_kernel': include/asm-generic/memory_model.h:54:29: error: 'vmemmap' undeclared (first use in this function); did you mean 'vm_mmap'? #define __pfn_to_page(pfn) (vmemmap + (pfn)) ^ include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~ >> init/main.c:735:2: note: in expansion of macro 'if' if (initrd_start && !initrd_below_start_ok && ^~ include/asm-generic/memory_model.h:81:21: note: in expansion of macro '__page_to_pfn' #define page_to_pfn __page_to_pfn ^~~~~~~~~~~~~ include/asm-generic/memory_model.h:82:21: note: in expansion of macro '__pfn_to_page' #define pfn_to_page __pfn_to_page ^~~~~~~~~~~~~ arch/riscv/include/asm/page.h:112:30: note: in expansion of macro 'pfn_to_page' #define virt_to_page(vaddr) (pfn_to_page(virt_to_pfn(vaddr))) ^~~~~~~~~~~ >> init/main.c:736:18: note: in expansion of macro 'virt_to_page' page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) { ^~~~~~~~~~~~ -- return pte_wrprotect(pte); ^~~~~~~~~~~~~~~~~~ include/asm-generic/hugetlb.h: In function 'huge_ptep_set_wrprotect': include/asm-generic/hugetlb.h:109:2: error: implicit declaration of function 'ptep_set_wrprotect'; did you mean 'huge_ptep_set_wrprotect'? [-Werror=implicit-function-declaration] ptep_set_wrprotect(mm, addr, ptep); ^~~~~~~~~~~~~~~~~~ huge_ptep_set_wrprotect include/asm-generic/hugetlb.h: In function 'huge_ptep_set_access_flags': include/asm-generic/hugetlb.h:118:9: error: implicit declaration of function 'ptep_set_access_flags'; did you mean 'huge_ptep_set_access_flags'? [-Werror=implicit-function-declaration] return ptep_set_access_flags(vma, addr, ptep, pte, dirty); ^~~~~~~~~~~~~~~~~~~~~ huge_ptep_set_access_flags In file included from arch/riscv/include/asm/page.h:131:0, from arch/riscv/include/asm/thread_info.h:11, from include/linux/thread_info.h:38, from include/asm-generic/preempt.h:5, from ./arch/riscv/include/generated/asm/preempt.h:1, from include/linux/preempt.h:78, from include/linux/spinlock.h:51, from include/linux/mmzone.h:8, from include/linux/gfp.h:6, from include/linux/slab.h:15, from kernel/fork.c:16: include/linux/scatterlist.h: In function 'sg_set_buf': include/asm-generic/memory_model.h:54:29: error: 'vmemmap' undeclared (first use in this function); did you mean 'vm_mmap'? #define __pfn_to_page(pfn) (vmemmap + (pfn)) ^ include/asm-generic/memory_model.h:82:21: note: in expansion of macro '__pfn_to_page' #define pfn_to_page __pfn_to_page ^~~~~~~~~~~~~ arch/riscv/include/asm/page.h:112:30: note: in expansion of macro 'pfn_to_page' #define virt_to_page(vaddr) (pfn_to_page(virt_to_pfn(vaddr))) ^~~~~~~~~~~ include/linux/scatterlist.h:145:18: note: in expansion of macro 'virt_to_page' sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf)); ^~~~~~~~~~~~ In file included from arch/riscv/include/asm/page.h:12:0, from arch/riscv/include/asm/thread_info.h:11, from include/linux/thread_info.h:38, from include/asm-generic/preempt.h:5, from ./arch/riscv/include/generated/asm/preempt.h:1, from include/linux/preempt.h:78, from include/linux/spinlock.h:51, from include/linux/mmzone.h:8, from include/linux/gfp.h:6, from include/linux/slab.h:15, from kernel/fork.c:16: include/linux/scatterlist.h: In function 'sg_phys': include/asm-generic/memory_model.h:55:54: error: 'vmemmap' undeclared (first use in this function); did you mean 'vm_mmap'? #define __page_to_pfn(page) (unsigned long)((page) - vmemmap) ^ include/linux/pfn.h:21:36: note: in definition of macro 'PFN_PHYS' #define PFN_PHYS(x) ((phys_addr_t)(x) << PAGE_SHIFT) ^ arch/riscv/include/asm/page.h:115:29: note: in expansion of macro 'pfn_to_phys' #define page_to_phys(page) (pfn_to_phys(page_to_pfn(page))) ^~~~~~~~~~~ include/asm-generic/memory_model.h:81:21: note: in expansion of macro '__page_to_pfn' #define page_to_pfn __page_to_pfn ^~~~~~~~~~~~~ arch/riscv/include/asm/page.h:115:41: note: in expansion of macro 'page_to_pfn' #define page_to_phys(page) (pfn_to_phys(page_to_pfn(page))) ^~~~~~~~~~~ include/linux/scatterlist.h:224:9: note: in expansion of macro 'page_to_phys' return page_to_phys(sg_page(sg)) + sg->offset; ^~~~~~~~~~~~ In file included from arch/riscv/include/asm/page.h:131:0, from arch/riscv/include/asm/thread_info.h:11, from include/linux/thread_info.h:38, from include/asm-generic/preempt.h:5, from ./arch/riscv/include/generated/asm/preempt.h:1, from include/linux/preempt.h:78, from include/linux/spinlock.h:51, from include/linux/mmzone.h:8, from include/linux/gfp.h:6, from include/linux/slab.h:15, from kernel/fork.c:16: include/linux/scatterlist.h: In function 'sg_page_iter_page': include/asm-generic/memory_model.h:54:29: error: 'vmemmap' undeclared (first use in this function); did you mean 'vm_mmap'? #define __pfn_to_page(pfn) (vmemmap + (pfn)) ^ include/asm-generic/memory_model.h:82:21: note: in expansion of macro '__pfn_to_page' #define pfn_to_page __pfn_to_page ^~~~~~~~~~~~~ include/linux/mm.h:213:26: note: in expansion of macro 'pfn_to_page' #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) ^~~~~~~~~~~ include/linux/scatterlist.h:384:9: note: in expansion of macro 'nth_page' return nth_page(sg_page(piter->sg), piter->sg_pgoffset); ^~~~~~~~ kernel/fork.c: In function 'free_thread_stack': include/asm-generic/memory_model.h:54:29: error: 'vmemmap' undeclared (first use in this function); did you mean 'vm_mmap'? #define __pfn_to_page(pfn) (vmemmap + (pfn)) ^ include/asm-generic/memory_model.h:82:21: note: in expansion of macro '__pfn_to_page' #define pfn_to_page __pfn_to_page ^~~~~~~~~~~~~ arch/riscv/include/asm/page.h:112:30: note: in expansion of macro 'pfn_to_page' #define virt_to_page(vaddr) (pfn_to_page(virt_to_pfn(vaddr))) ^~~~~~~~~~~ >> kernel/fork.c:297:15: note: in expansion of macro 'virt_to_page' __free_pages(virt_to_page(tsk->stack), THREAD_SIZE_ORDER); ^~~~~~~~~~~~ kernel/fork.c: In function 'account_kernel_stack': include/asm-generic/memory_model.h:54:29: error: 'vmemmap' undeclared (first use in this function); did you mean 'vm_mmap'? #define __pfn_to_page(pfn) (vmemmap + (pfn)) ^ include/asm-generic/memory_model.h:82:21: note: in expansion of macro '__pfn_to_page' #define pfn_to_page __pfn_to_page ^~~~~~~~~~~~~ arch/riscv/include/asm/page.h:112:30: note: in expansion of macro 'pfn_to_page' #define virt_to_page(vaddr) (pfn_to_page(virt_to_pfn(vaddr))) ^~~~~~~~~~~ kernel/fork.c:392:29: note: in expansion of macro 'virt_to_page' struct page *first_page = virt_to_page(stack); ^~~~~~~~~~~~ include/linux/dma-mapping.h: In function 'dma_map_single_attrs': include/asm-generic/memory_model.h:54:29: error: 'vmemmap' undeclared (first use in this function); did you mean 'vm_mmap'? #define __pfn_to_page(pfn) (vmemmap + (pfn)) ^ include/asm-generic/memory_model.h:82:21: note: in expansion of macro '__pfn_to_page' #define pfn_to_page __pfn_to_page ^~~~~~~~~~~~~ arch/riscv/include/asm/page.h:112:30: note: in expansion of macro 'pfn_to_page' #define virt_to_page(vaddr) (pfn_to_page(virt_to_pfn(vaddr))) ^~~~~~~~~~~ include/linux/dma-mapping.h:587:33: note: in expansion of macro 'virt_to_page' return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr), ^~~~~~~~~~~~ In file included from include/linux/dax.h:6:0, from include/linux/mempolicy.h:11, from kernel/fork.c:34: include/linux/mm.h: In function 'lowmem_page_address': include/linux/mm.h:1322:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors -- In file included from arch/riscv/include/asm/page.h:131:0, from arch/riscv/include/asm/thread_info.h:11, from include/linux/thread_info.h:38, from include/asm-generic/preempt.h:5, from ./arch/riscv/include/generated/asm/preempt.h:1, from include/linux/preempt.h:78, from include/linux/radix-tree.h:14, from include/linux/idr.h:15, from include/linux/kernfs.h:13, from include/linux/sysfs.h:16, from include/linux/kobject.h:20, from include/linux/device.h:16, from kernel/iomem.c:2: include/linux/mm.h: In function 'virt_to_head_page': include/asm-generic/memory_model.h:54:29: error: 'vmemmap' undeclared (first use in this function); did you mean 'mem_map'? #define __pfn_to_page(pfn) (vmemmap + (pfn)) ^ include/asm-generic/memory_model.h:82:21: note: in expansion of macro '__pfn_to_page' #define pfn_to_page __pfn_to_page ^~~~~~~~~~~~~ arch/riscv/include/asm/page.h:112:30: note: in expansion of macro 'pfn_to_page' #define virt_to_page(vaddr) (pfn_to_page(virt_to_pfn(vaddr))) ^~~~~~~~~~~ include/linux/mm.h:751:22: note: in expansion of macro 'virt_to_page' struct page *page = virt_to_page(x); ^~~~~~~~~~~~ include/asm-generic/memory_model.h:54:29: note: each undeclared identifier is reported only once for each function it appears in #define __pfn_to_page(pfn) (vmemmap + (pfn)) ^ include/asm-generic/memory_model.h:82:21: note: in expansion of macro '__pfn_to_page' #define pfn_to_page __pfn_to_page ^~~~~~~~~~~~~ arch/riscv/include/asm/page.h:112:30: note: in expansion of macro 'pfn_to_page' #define virt_to_page(vaddr) (pfn_to_page(virt_to_pfn(vaddr))) ^~~~~~~~~~~ include/linux/mm.h:751:22: note: in expansion of macro 'virt_to_page' struct page *page = virt_to_page(x); ^~~~~~~~~~~~ In file included from arch/riscv/include/asm/thread_info.h:11:0, from include/linux/thread_info.h:38, from include/asm-generic/preempt.h:5, from ./arch/riscv/include/generated/asm/preempt.h:1, from include/linux/preempt.h:78, from include/linux/radix-tree.h:14, from include/linux/idr.h:15, from include/linux/kernfs.h:13, from include/linux/sysfs.h:16, from include/linux/kobject.h:20, from include/linux/device.h:16, from kernel/iomem.c:2: include/linux/mm.h: In function 'lowmem_page_address': include/asm-generic/memory_model.h:55:54: error: 'vmemmap' undeclared (first use in this function); did you mean 'mem_map'? #define __page_to_pfn(page) (unsigned long)((page) - vmemmap) ^ arch/riscv/include/asm/page.h:104:45: note: in definition of macro '__va' #define __va(x) ((void *)((unsigned long) (x) + va_pa_offset)) ^ arch/riscv/include/asm/page.h:107:27: note: in expansion of macro 'PFN_PHYS' #define pfn_to_phys(pfn) (PFN_PHYS(pfn)) ^~~~~~~~ arch/riscv/include/asm/page.h:110:32: note: in expansion of macro 'pfn_to_phys' #define pfn_to_virt(pfn) (__va(pfn_to_phys(pfn))) ^~~~~~~~~~~ arch/riscv/include/asm/page.h:113:29: note: in expansion of macro 'pfn_to_virt' #define page_to_virt(page) (pfn_to_virt(page_to_pfn(page))) ^~~~~~~~~~~ include/asm-generic/memory_model.h:81:21: note: in expansion of macro '__page_to_pfn' #define page_to_pfn __page_to_pfn ^~~~~~~~~~~~~ arch/riscv/include/asm/page.h:113:41: note: in expansion of macro 'page_to_pfn' #define page_to_virt(page) (pfn_to_virt(page_to_pfn(page))) ^~~~~~~~~~~ include/linux/mm.h:1321:9: note: in expansion of macro 'page_to_virt' return page_to_virt(page); ^~~~~~~~~~~~ In file included from include/linux/ioport.h:13:0, from include/linux/device.h:15, from kernel/iomem.c:2: kernel/iomem.c: In function 'try_ram_remap': include/asm-generic/memory_model.h:54:29: error: 'vmemmap' undeclared (first use in this function); did you mean 'vm_mmap'? #define __pfn_to_page(pfn) (vmemmap + (pfn)) ^ include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~ >> kernel/iomem.c:36:2: note: in expansion of macro 'if' if (pfn_valid(pfn) && !PageHighMem(pfn_to_page(pfn)) && ^~ include/asm-generic/memory_model.h:82:21: note: in expansion of macro '__pfn_to_page' #define pfn_to_page __pfn_to_page ^~~~~~~~~~~~~ >> kernel/iomem.c:36:37: note: in expansion of macro 'pfn_to_page' if (pfn_valid(pfn) && !PageHighMem(pfn_to_page(pfn)) && ^~~~~~~~~~~ .. vim +4904 mm/hugetlb.c 3212b535f200c8 Steve Capper 2013-04-23 4878 3212b535f200c8 Steve Capper 2013-04-23 4879 /* 3212b535f200c8 Steve Capper 2013-04-23 4880 * unmap huge page backed by shared pte. 3212b535f200c8 Steve Capper 2013-04-23 4881 * 3212b535f200c8 Steve Capper 2013-04-23 4882 * Hugetlb pte page is ref counted at the time of mapping. If pte is shared 3212b535f200c8 Steve Capper 2013-04-23 4883 * indicated by page_count > 1, unmap is achieved by clearing pud and 3212b535f200c8 Steve Capper 2013-04-23 4884 * decrementing the ref count. If count == 1, the pte page is not shared. 3212b535f200c8 Steve Capper 2013-04-23 4885 * ddeaab32a89f04 Mike Kravetz 2019-01-08 4886 * called with page table lock held. 3212b535f200c8 Steve Capper 2013-04-23 4887 * 3212b535f200c8 Steve Capper 2013-04-23 4888 * returns: 1 successfully unmapped a shared pte page 3212b535f200c8 Steve Capper 2013-04-23 4889 * 0 the underlying pte page is not shared, or it is the last user 3212b535f200c8 Steve Capper 2013-04-23 4890 */ 3212b535f200c8 Steve Capper 2013-04-23 4891 int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep) 3212b535f200c8 Steve Capper 2013-04-23 4892 { 3212b535f200c8 Steve Capper 2013-04-23 4893 pgd_t *pgd = pgd_offset(mm, *addr); c2febafc67734a Kirill A. Shutemov 2017-03-09 4894 p4d_t *p4d = p4d_offset(pgd, *addr); c2febafc67734a Kirill A. Shutemov 2017-03-09 4895 pud_t *pud = pud_offset(p4d, *addr); 3212b535f200c8 Steve Capper 2013-04-23 4896 3212b535f200c8 Steve Capper 2013-04-23 @4897 BUG_ON(page_count(virt_to_page(ptep)) == 0); 3212b535f200c8 Steve Capper 2013-04-23 4898 if (page_count(virt_to_page(ptep)) == 1) 3212b535f200c8 Steve Capper 2013-04-23 4899 return 0; 3212b535f200c8 Steve Capper 2013-04-23 4900 3212b535f200c8 Steve Capper 2013-04-23 4901 pud_clear(pud); 3212b535f200c8 Steve Capper 2013-04-23 4902 put_page(virt_to_page(ptep)); dc6c9a35b66b52 Kirill A. Shutemov 2015-02-11 4903 mm_dec_nr_pmds(mm); 3212b535f200c8 Steve Capper 2013-04-23 @4904 *addr = ALIGN(*addr, HPAGE_SIZE * PTRS_PER_PTE) - HPAGE_SIZE; 3212b535f200c8 Steve Capper 2013-04-23 4905 return 1; 3212b535f200c8 Steve Capper 2013-04-23 4906 } 9e5fc74c302505 Steve Capper 2013-04-30 4907 #define want_pmd_share() (1) 9e5fc74c302505 Steve Capper 2013-04-30 4908 #else /* !CONFIG_ARCH_WANT_HUGE_PMD_SHARE */ 9e5fc74c302505 Steve Capper 2013-04-30 4909 pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud) 9e5fc74c302505 Steve Capper 2013-04-30 4910 { 9e5fc74c302505 Steve Capper 2013-04-30 4911 return NULL; 9e5fc74c302505 Steve Capper 2013-04-30 4912 } e81f2d22370f82 Zhang Zhen 2015-06-24 4913 :::::: The code at line 4904 was first introduced by commit :::::: 3212b535f200c85b5a67cbfaea18431da71b5c72 mm: hugetlb: Copy huge_pmd_share from x86 to mm. :::::: TO: Steve Capper :::::: CC: Steve Capper --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation