Re: [arc:topic-mmu 27/32] arch/arc/include/asm/hugepage.h:29:36: error: implicit declaration of function 'pte_mknotpresent'; did you mean 'pte_present'?

From: Vineet Gupta
Date: Fri Aug 06 2021 - 15:46:11 EST


On 8/6/21 6:38 AM, kernel test robot wrote:
> tree: https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git__;!!A4F2R9G_pg!JkynKBqZimbhej1a4Vdszp5CSFVPGZRDksLBzwDbrZhdmsyGKSOySAh_3Qh53SoH$ topic-mmu
> head: aad84191703280f0aace986bff0afd917b77511e
> commit: 9832faa2ca147e7d3fa551f7cc43df19cf569111 [27/32] ARC: mm: remove unused pte accessors
> config: arc-allyesconfig (attached as .config)
> compiler: arceb-elf-gcc (GCC) 10.3.0
> reproduce (this is a W=1 build):
> wget https://urldefense.com/v3/__https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross__;!!A4F2R9G_pg!JkynKBqZimbhej1a4Vdszp5CSFVPGZRDksLBzwDbrZhdmsyGKSOySAh_3VPXG8J4$ -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git/commit/?id=9832faa2ca147e7d3fa551f7cc43df19cf569111__;!!A4F2R9G_pg!JkynKBqZimbhej1a4Vdszp5CSFVPGZRDksLBzwDbrZhdmsyGKSOySAh_3bcRVHFe$
> git remote add arc https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git__;!!A4F2R9G_pg!JkynKBqZimbhej1a4Vdszp5CSFVPGZRDksLBzwDbrZhdmsyGKSOySAh_3Qh53SoH$
> git fetch --no-tags arc topic-mmu
> git checkout 9832faa2ca147e7d3fa551f7cc43df19cf569111
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=arc
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>

Thanks for this report. I love this testing. I wish I could buy you guys
a beer (or a beverage of choice !)
I've added the Reported-by tag for the ensuing fix.

-Vineet

>
> All errors (new ones prefixed by >>):
>
> In file included from arch/arc/include/asm/bug.h:30,
> from include/linux/bug.h:5,
> from include/linux/mmdebug.h:5,
> from include/linux/gfp.h:5,
> from mm/debug_vm_pgtable.c:13:
> mm/debug_vm_pgtable.c: In function 'pmd_thp_tests':
>>> arch/arc/include/asm/hugepage.h:29:36: error: implicit declaration of function 'pte_mknotpresent'; did you mean 'pte_present'? [-Werror=implicit-function-declaration]
> 29 | #define pmd_mkinvalid(pmd) pte_pmd(pte_mknotpresent(pmd_pte(pmd)))
> | ^~~~~~~~~~~~~~~~
> include/asm-generic/bug.h:121:25: note: in definition of macro 'WARN_ON'
> 121 | int __ret_warn_on = !!(condition); \
> | ^~~~~~~~~
> include/asm-generic/pgtable-nop4d.h:40:24: note: in expansion of macro 'pgd_val'
> 40 | #define p4d_val(x) (pgd_val((x).pgd))
> | ^~~~~~~
> include/asm-generic/pgtable-nopud.h:48:24: note: in expansion of macro 'p4d_val'
> 48 | #define pud_val(x) (p4d_val((x).p4d))
> | ^~~~~~~
> include/asm-generic/pgtable-nopmd.h:50:24: note: in expansion of macro 'pud_val'
> 50 | #define pmd_val(x) (pud_val((x).pud))
> | ^~~~~~~
> arch/arc/include/asm/hugepage.h:39:30: note: in expansion of macro 'pmd_val'
> 39 | #define pmd_trans_huge(pmd) (pmd_val(pmd) & _PAGE_HW_SZ)
> | ^~~~~~~
> mm/debug_vm_pgtable.c:913:11: note: in expansion of macro 'pmd_trans_huge'
> 913 | WARN_ON(!pmd_trans_huge(pmd_mkinvalid(pmd_mkhuge(pmd))));
> | ^~~~~~~~~~~~~~
> mm/debug_vm_pgtable.c:913:26: note: in expansion of macro 'pmd_mkinvalid'
> 913 | WARN_ON(!pmd_trans_huge(pmd_mkinvalid(pmd_mkhuge(pmd))));
> | ^~~~~~~~~~~~~
>>> arch/arc/include/asm/hugepage.h:29:36: error: incompatible type for argument 1 of 'pte_pmd'
> 29 | #define pmd_mkinvalid(pmd) pte_pmd(pte_mknotpresent(pmd_pte(pmd)))
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | |
> | int
> include/asm-generic/bug.h:121:25: note: in definition of macro 'WARN_ON'
> 121 | int __ret_warn_on = !!(condition); \
> | ^~~~~~~~~
> include/asm-generic/pgtable-nop4d.h:40:24: note: in expansion of macro 'pgd_val'
> 40 | #define p4d_val(x) (pgd_val((x).pgd))
> | ^~~~~~~
> include/asm-generic/pgtable-nopud.h:48:24: note: in expansion of macro 'p4d_val'
> 48 | #define pud_val(x) (p4d_val((x).p4d))
> | ^~~~~~~
> include/asm-generic/pgtable-nopmd.h:50:24: note: in expansion of macro 'pud_val'
> 50 | #define pmd_val(x) (pud_val((x).pud))
> | ^~~~~~~
> arch/arc/include/asm/hugepage.h:39:30: note: in expansion of macro 'pmd_val'
> 39 | #define pmd_trans_huge(pmd) (pmd_val(pmd) & _PAGE_HW_SZ)
> | ^~~~~~~
> mm/debug_vm_pgtable.c:913:11: note: in expansion of macro 'pmd_trans_huge'
> 913 | WARN_ON(!pmd_trans_huge(pmd_mkinvalid(pmd_mkhuge(pmd))));
> | ^~~~~~~~~~~~~~
> mm/debug_vm_pgtable.c:913:26: note: in expansion of macro 'pmd_mkinvalid'
> 913 | WARN_ON(!pmd_trans_huge(pmd_mkinvalid(pmd_mkhuge(pmd))));
> | ^~~~~~~~~~~~~
> In file included from arch/arc/include/asm/pgtable-bits-arcv2.h:145,
> from arch/arc/include/asm/pgtable.h:12,
> from include/linux/pgtable.h:6,
> from include/linux/mm.h:33,
> from include/linux/highmem.h:8,
> from mm/debug_vm_pgtable.c:14:
> arch/arc/include/asm/hugepage.h:18:35: note: expected 'pte_t' but argument is of type 'int'
> 18 | static inline pmd_t pte_pmd(pte_t pte)
> | ~~~~~~^~~
> In file included from arch/arc/include/asm/bug.h:30,
> from include/linux/bug.h:5,
> from include/linux/mmdebug.h:5,
> from include/linux/gfp.h:5,
> from mm/debug_vm_pgtable.c:13:
>>> arch/arc/include/asm/hugepage.h:29:36: error: incompatible type for argument 1 of 'pte_pmd'
> 29 | #define pmd_mkinvalid(pmd) pte_pmd(pte_mknotpresent(pmd_pte(pmd)))
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | |
> | int
> include/asm-generic/bug.h:121:25: note: in definition of macro 'WARN_ON'
> 121 | int __ret_warn_on = !!(condition); \
> | ^~~~~~~~~
> include/asm-generic/pgtable-nop4d.h:40:24: note: in expansion of macro 'pgd_val'
> 40 | #define p4d_val(x) (pgd_val((x).pgd))
> | ^~~~~~~
> include/asm-generic/pgtable-nopud.h:48:24: note: in expansion of macro 'p4d_val'
> 48 | #define pud_val(x) (p4d_val((x).p4d))
> | ^~~~~~~
> include/asm-generic/pgtable-nopmd.h:50:24: note: in expansion of macro 'pud_val'
> 50 | #define pmd_val(x) (pud_val((x).pud))
> | ^~~~~~~
> arch/arc/include/asm/pgtable-levels.h:66:26: note: in expansion of macro 'pmd_val'
> 66 | #define pmd_present(x) (pmd_val(x))
> | ^~~~~~~
> mm/debug_vm_pgtable.c:914:11: note: in expansion of macro 'pmd_present'
> 914 | WARN_ON(!pmd_present(pmd_mkinvalid(pmd_mkhuge(pmd))));
> | ^~~~~~~~~~~
> mm/debug_vm_pgtable.c:914:23: note: in expansion of macro 'pmd_mkinvalid'
> 914 | WARN_ON(!pmd_present(pmd_mkinvalid(pmd_mkhuge(pmd))));
> | ^~~~~~~~~~~~~
> In file included from arch/arc/include/asm/pgtable-bits-arcv2.h:145,
> from arch/arc/include/asm/pgtable.h:12,
> from include/linux/pgtable.h:6,
> from include/linux/mm.h:33,
> from include/linux/highmem.h:8,
> from mm/debug_vm_pgtable.c:14:
> arch/arc/include/asm/hugepage.h:18:35: note: expected 'pte_t' but argument is of type 'int'
> 18 | static inline pmd_t pte_pmd(pte_t pte)
> | ~~~~~~^~~
> cc1: some warnings being treated as errors
> --
> In file included from arch/arc/include/asm/pgtable-bits-arcv2.h:145,
> from arch/arc/include/asm/pgtable.h:12,
> from include/linux/pgtable.h:6,
> from include/linux/mm.h:33,
> from include/linux/pagemap.h:8,
> from mm/pgtable-generic.c:10:
> mm/pgtable-generic.c: In function 'pmdp_invalidate':
>>> arch/arc/include/asm/hugepage.h:29:36: error: implicit declaration of function 'pte_mknotpresent'; did you mean 'pte_present'? [-Werror=implicit-function-declaration]
> 29 | #define pmd_mkinvalid(pmd) pte_pmd(pte_mknotpresent(pmd_pte(pmd)))
> | ^~~~~~~~~~~~~~~~
> mm/pgtable-generic.c:197:49: note: in expansion of macro 'pmd_mkinvalid'
> 197 | pmd_t old = pmdp_establish(vma, address, pmdp, pmd_mkinvalid(*pmdp));
> | ^~~~~~~~~~~~~
>>> arch/arc/include/asm/hugepage.h:29:36: error: incompatible type for argument 1 of 'pte_pmd'
> 29 | #define pmd_mkinvalid(pmd) pte_pmd(pte_mknotpresent(pmd_pte(pmd)))
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | |
> | int
> mm/pgtable-generic.c:197:49: note: in expansion of macro 'pmd_mkinvalid'
> 197 | pmd_t old = pmdp_establish(vma, address, pmdp, pmd_mkinvalid(*pmdp));
> | ^~~~~~~~~~~~~
> arch/arc/include/asm/hugepage.h:18:35: note: expected 'pte_t' but argument is of type 'int'
> 18 | static inline pmd_t pte_pmd(pte_t pte)
> | ~~~~~~^~~
> cc1: some warnings being treated as errors
>
>
> vim +29 arch/arc/include/asm/hugepage.h
>
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 22
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 23 #define pmd_wrprotect(pmd) pte_pmd(pte_wrprotect(pmd_pte(pmd)))
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 24 #define pmd_mkwrite(pmd) pte_pmd(pte_mkwrite(pmd_pte(pmd)))
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 25 #define pmd_mkdirty(pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd)))
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 26 #define pmd_mkold(pmd) pte_pmd(pte_mkold(pmd_pte(pmd)))
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 27 #define pmd_mkyoung(pmd) pte_pmd(pte_mkyoung(pmd_pte(pmd)))
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 28 #define pmd_mkhuge(pmd) pte_pmd(pte_mkhuge(pmd_pte(pmd)))
> 86ec2da037b854 Anshuman Khandual 2020-06-03 @29 #define pmd_mkinvalid(pmd) pte_pmd(pte_mknotpresent(pmd_pte(pmd)))
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 30 #define pmd_mkclean(pmd) pte_pmd(pte_mkclean(pmd_pte(pmd)))
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 31
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 32 #define pmd_write(pmd) pte_write(pmd_pte(pmd))
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 33 #define pmd_young(pmd) pte_young(pmd_pte(pmd))
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 34 #define pmd_pfn(pmd) pte_pfn(pmd_pte(pmd))
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 35 #define pmd_dirty(pmd) pte_dirty(pmd_pte(pmd))
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 36
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 37 #define mk_pmd(page, prot) pte_pmd(mk_pte(page, prot))
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 38
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 @39 #define pmd_trans_huge(pmd) (pmd_val(pmd) & _PAGE_HW_SZ)
> fe6c1b8611aa3a Vineet Gupta 2014-07-08 40
>
> :::::: The code at line 29 was first introduced by commit
> :::::: 86ec2da037b85436b63afe3df43ed48fa0e52b0e mm/thp: rename pmd_mknotpresent() as pmd_mkinvalid()
>
> :::::: TO: Anshuman Khandual <anshuman.khandual@xxxxxxx>
> :::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://urldefense.com/v3/__https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org__;!!A4F2R9G_pg!JkynKBqZimbhej1a4Vdszp5CSFVPGZRDksLBzwDbrZhdmsyGKSOySAh_3SyjWe_B$