Skip to contentSkip to conversation

arch/x86/mm/ident_map.c:19:8: warning: no previous prototype for 'ident_split_large_pmd'

PATCH kernel test robot 1 participant 1 message Mar 8, 2023

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   git://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git for-kernelci
head:   307a19a22eea94622a082f1bce0959cfb6f7d9f7
commit: e5a05147bd0061090db95126181ff8096645fad6 [5/23] x86/boot: Support 4KB pages for identity mapping
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230308/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git/commit/?id=e5a05147bd0061090db95126181ff8096645fad6
        git remote add ardb git://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git
        git fetch --no-tags ardb for-kernelci
        git checkout e5a05147bd0061090db95126181ff8096645fad6
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash arch/x86/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from arch/x86/mm/init_64.c:61:

>> arch/x86/mm/ident_map.c:19:8: warning: no previous prototype for 'ident_split_large_pmd' [-Wmissing-prototypes]
      19 | pte_t *ident_split_large_pmd(struct x86_mapping_info *info,
         |        ^~~~~~~~~~~~~~~~~~~~~
>> arch/x86/mm/ident_map.c:102:8: warning: no previous prototype for 'ident_split_large_pud' [-Wmissing-prototypes]

102 | pmd_t *ident_split_large_pud(struct x86_mapping_info *info,
| ^~~~~~~~~~~~~~~~~~~~~

vim +/ident_split_large_pmd +19 arch/x86/mm/ident_map.c

    18	
  > 19	pte_t *ident_split_large_pmd(struct x86_mapping_info *info,
    20				     pmd_t *pmdp, unsigned long page_addr)
    21	{
    22		unsigned long pmd_addr, page_flags;
    23		pte_t *pte;
    24	
    25		pte = (pte_t *)info->alloc_pgt_page(info->context);
    26		if (!pte)
    27			return NULL;
    28	
    29		pmd_addr = page_addr & PMD_MASK;
    30	
    31		/* Not a large page - clear PSE flag */
    32		page_flags = pmd_flags(*pmdp) & ~_PSE;
    33		ident_pte_init(info, pte, pmd_addr, pmd_addr + PMD_SIZE, page_flags);
    34	
    35		return pte;
    36	}
    37	
    38	static int ident_pmd_init(struct x86_mapping_info *info, pmd_t *pmd_page,
    39				  unsigned long addr, unsigned long end,
    40				  unsigned long flags)
    41	{
    42		unsigned long next;
    43		bool new_table = 0;
    44	
    45		for (; addr < end; addr = next) {
    46			pmd_t *pmd = pmd_page + pmd_index(addr);
    47			pte_t *pte;
    48	
    49			next = (addr & PMD_MASK) + PMD_SIZE;
    50			if (next > end)
    51				next = end;
    52	
    53			/*
    54			 * Use 2M pages if 4k pages are not allowed or
    55			 * we are not mapping extra, i.e. address and size are aligned.
    56			 */
    57	
    58			if (!info->allow_4kpages ||
    59			    (!(addr & ~PMD_MASK) && next == addr + PMD_SIZE)) {
    60	
    61				pmd_t pmdval;
    62	
    63				addr &= PMD_MASK;
    64				pmdval = __pmd((addr - info->offset) | flags | _PSE);
    65				set_pmd(pmd, pmdval);
    66				continue;
    67			}
    68	
    69			/*
    70			 * If currently mapped page is large, we need to split it.
    71			 * The case when we don't can remap 2M page to 2M page
    72			 * with different flags is already covered above.
    73			 *
    74			 * If there's nothing mapped to desired address,
    75			 * we need to allocate new page table.
    76			 */
    77	
    78			if (pmd_large(*pmd)) {
    79				pte = ident_split_large_pmd(info, pmd, addr);
    80				new_table = 1;
    81			} else if (!pmd_present(*pmd)) {
    82				pte = (pte_t *)info->alloc_pgt_page(info->context);
    83				new_table = 1;
    84			} else {
    85				pte = pte_offset_kernel(pmd, 0);
    86				new_table = 0;
    87			}
    88	
    89			if (!pte)
    90				return -ENOMEM;
    91	
    92			ident_pte_init(info, pte, addr, next, flags);
    93	
    94			if (new_table)
    95				set_pmd(pmd, __pmd(__pa(pte) | info->kernpg_flag));
    96		}
    97	
    98		return 0;
    99	}
   100	
   101	
 > 102	pmd_t *ident_split_large_pud(struct x86_mapping_info *info,

103 pud_t *pudp, unsigned long page_addr)
104 {
105 unsigned long pud_addr, page_flags;
106 pmd_t *pmd;
107
108 pmd = (pmd_t *)info->alloc_pgt_page(info->context);
109 if (!pmd)
110 return NULL;
111
112 pud_addr = page_addr & PUD_MASK;
113
114 /* Not a large page - clear PSE flag */
115 page_flags = pud_flags(*pudp) & ~_PSE;
116 ident_pmd_init(info, pmd, pud_addr, pud_addr + PUD_SIZE, page_flags);
117
118 return pmd;
119 }
120

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests