mm/hugetlb.c:4979:10: error: implicit declaration of function 'pmd_page'; did you mean 'pud_page'?

From: kbuild test robot
Date: Sat Feb 15 2020 - 00:21:18 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 2019fc96af228b412bdb2e8e0ad4b1fc12046a51
commit: 8ad8b72721d0f07fa02dbe71f901743f9c71c8e6 riscv: Add KASAN support
date: 3 weeks ago
config: riscv-randconfig-a001-20200214 (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 8ad8b72721d0f07fa02dbe71f901743f9c71c8e6
# 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 <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

^
mm/hugetlb.c: In function 'huge_pmd_share':
mm/hugetlb.c:4786:19: error: implicit declaration of function 'pmd_alloc'; did you mean '__pmd_alloc'? [-Werror=implicit-function-declaration]
return (pte_t *)pmd_alloc(mm, pud, addr);
^~~~~~~~~
__pmd_alloc
mm/hugetlb.c:4786:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
return (pte_t *)pmd_alloc(mm, pud, addr);
^
mm/hugetlb.c:4809:3: error: implicit declaration of function 'pud_populate'; did you mean 'pgd_populate'? [-Werror=implicit-function-declaration]
pud_populate(mm, pud,
^~~~~~~~~~~~
pgd_populate
mm/hugetlb.c:4817:8: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
pte = (pte_t *)pmd_alloc(mm, pud, addr);
^
mm/hugetlb.c: In function 'huge_pmd_unshare':
mm/hugetlb.c:4836:15: error: implicit declaration of function 'pgd_offset'; did you mean 'pmd_offset'? [-Werror=implicit-function-declaration]
pgd_t *pgd = pgd_offset(mm, *addr);
^~~~~~~~~~
pmd_offset
mm/hugetlb.c:4836:15: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
In file included from include/linux/cache.h:5:0,
from include/linux/printk.h:9,
from include/linux/kernel.h:15,
from include/linux/list.h:9,
from mm/hugetlb.c:6:
mm/hugetlb.c:4847:36: error: 'PTRS_PER_PTE' undeclared (first use in this function); did you mean 'PTRS_PER_P4D'?
*addr = ALIGN(*addr, HPAGE_SIZE * PTRS_PER_PTE) - HPAGE_SIZE;
^
include/uapi/linux/kernel.h:11:47: note: in definition of macro '__ALIGN_KERNEL_MASK'
#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
^~~~
include/linux/kernel.h:33:22: note: in expansion of macro '__ALIGN_KERNEL'
#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
^~~~~~~~~~~~~~
mm/hugetlb.c:4847:10: note: in expansion of macro 'ALIGN'
*addr = ALIGN(*addr, HPAGE_SIZE * PTRS_PER_PTE) - HPAGE_SIZE;
^~~~~
mm/hugetlb.c:4847:36: note: each undeclared identifier is reported only once for each function it appears in
*addr = ALIGN(*addr, HPAGE_SIZE * PTRS_PER_PTE) - HPAGE_SIZE;
^
include/uapi/linux/kernel.h:11:47: note: in definition of macro '__ALIGN_KERNEL_MASK'
#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
^~~~
include/linux/kernel.h:33:22: note: in expansion of macro '__ALIGN_KERNEL'
#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
^~~~~~~~~~~~~~
mm/hugetlb.c:4847:10: note: in expansion of macro 'ALIGN'
*addr = ALIGN(*addr, HPAGE_SIZE * PTRS_PER_PTE) - HPAGE_SIZE;
^~~~~
mm/hugetlb.c: In function 'huge_pte_alloc':
mm/hugetlb.c:4878:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
pgd = pgd_offset(mm, addr);
^
mm/hugetlb.c:4879:8: error: implicit declaration of function 'p4d_alloc'; did you mean '__p4d_alloc'? [-Werror=implicit-function-declaration]
p4d = p4d_alloc(mm, pgd, addr);
^~~~~~~~~
__p4d_alloc
mm/hugetlb.c:4879:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
p4d = p4d_alloc(mm, pgd, addr);
^
mm/hugetlb.c:4882:8: error: implicit declaration of function 'pud_alloc'; did you mean '__pud_alloc'? [-Werror=implicit-function-declaration]
pud = pud_alloc(mm, p4d, addr);
^~~~~~~~~
__pud_alloc
mm/hugetlb.c:4882:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
pud = pud_alloc(mm, p4d, addr);
^
mm/hugetlb.c:4891:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
pte = (pte_t *)pmd_alloc(mm, pud, addr);
^
In file included from include/linux/kernel.h:11:0,
from include/linux/list.h:9,
from mm/hugetlb.c:6:
mm/hugetlb.c:4894:38: error: implicit declaration of function 'pte_huge'; did you mean 'pud_huge'? [-Werror=implicit-function-declaration]
BUG_ON(pte && pte_present(*pte) && !pte_huge(*pte));
^
include/linux/compiler.h:33:34: note: in definition of macro '__branch_check__'
______r = __builtin_expect(!!(x), expect); \
^
include/asm-generic/bug.h:62:36: note: in expansion of macro 'unlikely'
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
^~~~~~~~
mm/hugetlb.c:4894:2: note: in expansion of macro 'BUG_ON'
BUG_ON(pte && pte_present(*pte) && !pte_huge(*pte));
^~~~~~
mm/hugetlb.c: In function 'huge_pte_offset':
mm/hugetlb.c:4916:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
pgd = pgd_offset(mm, addr);
^
mm/hugetlb.c:4931:24: error: implicit declaration of function 'pmd_none'; did you mean 'pud_none'? [-Werror=implicit-function-declaration]
if (sz != PMD_SIZE && pmd_none(*pmd))
^~~~~~~~
pud_none
mm/hugetlb.c:4934:25: error: implicit declaration of function 'pmd_present'; did you mean 'pud_present'? [-Werror=implicit-function-declaration]
if (pmd_huge(*pmd) || !pmd_present(*pmd))
^~~~~~~~~~~
pud_present
mm/hugetlb.c: In function 'follow_huge_pmd':
>> mm/hugetlb.c:4979:10: error: implicit declaration of function 'pmd_page'; did you mean 'pud_page'? [-Werror=implicit-function-declaration]
page = pmd_page(*pmd) + ((address & ~PMD_MASK) >> PAGE_SHIFT);
^~~~~~~~
pud_page
mm/hugetlb.c:4979:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
page = pmd_page(*pmd) + ((address & ~PMD_MASK) >> PAGE_SHIFT);
^
mm/hugetlb.c:4985:4: error: implicit declaration of function '__migration_entry_wait'; did you mean '__list_del_entry_valid'? [-Werror=implicit-function-declaration]
__migration_entry_wait(mm, (pte_t *)pmd, ptl);
^~~~~~~~~~~~~~~~~~~~~~
__list_del_entry_valid
mm/hugetlb.c: In function 'follow_huge_pud':
mm/hugetlb.c:5005:33: warning: return makes pointer from integer without a cast [-Wint-conversion]
return pte_page(*(pte_t *)pud) + ((address & ~PUD_MASK) >> PAGE_SHIFT);
~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/hugetlb.c: In function 'follow_huge_pgd':
mm/hugetlb.c:5014:33: warning: return makes pointer from integer without a cast [-Wint-conversion]
return pte_page(*(pte_t *)pgd) + ((address & ~PGDIR_MASK) >> PAGE_SHIFT);
~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from arch/riscv/include/asm/hugetlb.h:5:0,
from include/linux/hugetlb.h:536,
from mm/hugetlb.c:37:
include/asm-generic/hugetlb.h: In function 'huge_ptep_get_and_clear':
include/asm-generic/hugetlb.h:65:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
include/asm-generic/hugetlb.h: In function 'huge_pte_mkwrite':
include/asm-generic/hugetlb.h:23:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
include/asm-generic/hugetlb.h: In function 'mk_huge_pte':
include/asm-generic/hugetlb.h:8:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
include/asm-generic/hugetlb.h: In function 'huge_pte_wrprotect':
include/asm-generic/hugetlb.h:87:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
include/asm-generic/hugetlb.h: In function 'huge_pte_mkdirty':
include/asm-generic/hugetlb.h:28:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
cc1: some warnings being treated as errors

vim +4979 mm/hugetlb.c

4dc71451a2078ef Aneesh Kumar K.V 2017-07-06 4960
61f77eda9bbf0d2 Naoya Horiguchi 2015-02-11 4961 struct page * __weak
9e5fc74c3025056 Steve Capper 2013-04-30 4962 follow_huge_pmd(struct mm_struct *mm, unsigned long address,
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4963 pmd_t *pmd, int flags)
9e5fc74c3025056 Steve Capper 2013-04-30 4964 {
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4965 struct page *page = NULL;
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4966 spinlock_t *ptl;
c9d398fa237882e Naoya Horiguchi 2017-03-31 4967 pte_t pte;
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4968 retry:
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4969 ptl = pmd_lockptr(mm, pmd);
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4970 spin_lock(ptl);
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4971 /*
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4972 * make sure that the address range covered by this pmd is not
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4973 * unmapped from other threads.
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4974 */
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4975 if (!pmd_huge(*pmd))
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4976 goto out;
c9d398fa237882e Naoya Horiguchi 2017-03-31 4977 pte = huge_ptep_get((pte_t *)pmd);
c9d398fa237882e Naoya Horiguchi 2017-03-31 4978 if (pte_present(pte)) {
97534127012f0e3 Gerald Schaefer 2015-04-14 @4979 page = pmd_page(*pmd) + ((address & ~PMD_MASK) >> PAGE_SHIFT);
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4980 if (flags & FOLL_GET)
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4981 get_page(page);
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4982 } else {
c9d398fa237882e Naoya Horiguchi 2017-03-31 4983 if (is_hugetlb_entry_migration(pte)) {
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4984 spin_unlock(ptl);
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4985 __migration_entry_wait(mm, (pte_t *)pmd, ptl);
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4986 goto retry;
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4987 }
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4988 /*
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4989 * hwpoisoned entry is treated as no_page_table in
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4990 * follow_page_mask().
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4991 */
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4992 }
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4993 out:
e66f17ff71772b2 Naoya Horiguchi 2015-02-11 4994 spin_unlock(ptl);
9e5fc74c3025056 Steve Capper 2013-04-30 4995 return page;
9e5fc74c3025056 Steve Capper 2013-04-30 4996 }
9e5fc74c3025056 Steve Capper 2013-04-30 4997

:::::: The code at line 4979 was first introduced by commit
:::::: 97534127012f0e396eddea4691f4c9b170aed74b mm/hugetlb: use pmd_page() in follow_huge_pmd()

:::::: TO: Gerald Schaefer <gerald.schaefer@xxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip