Re: [PATCH v1 4/9] s390/vmemmap: cleanup when vmemmap_populate() fails

From: kernel test robot
Date: Fri Jul 03 2020 - 13:10:18 EST


Hi David,

I love your patch! Yet something to improve:

[auto build test ERROR on s390/features]
[also build test ERROR on next-20200703]
[cannot apply to linux/master kvms390/next linus/master v5.8-rc3]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/David-Hildenbrand/s390-implement-and-optimize-vmemmap_free/20200703-214348
base: https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features
config: s390-alldefconfig (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=s390

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All error/warnings (new ones prefixed by >>):

arch/s390/mm/vmem.c: In function 'vmemmap_populate':
>> arch/s390/mm/vmem.c:368:3: error: implicit declaration of function 'vmemmap_free'; did you mean 'vmem_altmap_free'? [-Werror=implicit-function-declaration]
368 | vmemmap_free(start, end, altmap);
| ^~~~~~~~~~~~
| vmem_altmap_free
arch/s390/mm/vmem.c: At top level:
arch/s390/mm/vmem.c:372:6: warning: no previous prototype for 'vmemmap_free' [-Wmissing-prototypes]
372 | void vmemmap_free(unsigned long start, unsigned long end,
| ^~~~~~~~~~~~
>> arch/s390/mm/vmem.c:372:6: warning: conflicting types for 'vmemmap_free'
arch/s390/mm/vmem.c:368:3: note: previous implicit declaration of 'vmemmap_free' was here
368 | vmemmap_free(start, end, altmap);
| ^~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +368 arch/s390/mm/vmem.c

280
281 /*
282 * Add a backed mem_map array to the virtual mem_map array.
283 */
284 int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
285 struct vmem_altmap *altmap)
286 {
287 unsigned long pgt_prot, sgt_prot;
288 unsigned long address = start;
289 pgd_t *pg_dir;
290 p4d_t *p4_dir;
291 pud_t *pu_dir;
292 pmd_t *pm_dir;
293 pte_t *pt_dir;
294 int ret = -ENOMEM;
295
296 pgt_prot = pgprot_val(PAGE_KERNEL);
297 sgt_prot = pgprot_val(SEGMENT_KERNEL);
298 if (!MACHINE_HAS_NX) {
299 pgt_prot &= ~_PAGE_NOEXEC;
300 sgt_prot &= ~_SEGMENT_ENTRY_NOEXEC;
301 }
302 for (address = start; address < end;) {
303 pg_dir = pgd_offset_k(address);
304 if (pgd_none(*pg_dir)) {
305 p4_dir = vmem_crst_alloc(_REGION2_ENTRY_EMPTY);
306 if (!p4_dir)
307 goto out;
308 pgd_populate(&init_mm, pg_dir, p4_dir);
309 }
310
311 p4_dir = p4d_offset(pg_dir, address);
312 if (p4d_none(*p4_dir)) {
313 pu_dir = vmem_crst_alloc(_REGION3_ENTRY_EMPTY);
314 if (!pu_dir)
315 goto out;
316 p4d_populate(&init_mm, p4_dir, pu_dir);
317 }
318
319 pu_dir = pud_offset(p4_dir, address);
320 if (pud_none(*pu_dir)) {
321 pm_dir = vmem_crst_alloc(_SEGMENT_ENTRY_EMPTY);
322 if (!pm_dir)
323 goto out;
324 pud_populate(&init_mm, pu_dir, pm_dir);
325 }
326
327 pm_dir = pmd_offset(pu_dir, address);
328 if (pmd_none(*pm_dir)) {
329 /* Use 1MB frames for vmemmap if available. We always
330 * use large frames even if they are only partially
331 * used.
332 * Otherwise we would have also page tables since
333 * vmemmap_populate gets called for each section
334 * separately. */
335 if (MACHINE_HAS_EDAT1) {
336 void *new_page;
337
338 new_page = vmemmap_alloc_block(PMD_SIZE, node);
339 if (!new_page)
340 goto out;
341 pmd_val(*pm_dir) = __pa(new_page) | sgt_prot;
342 address = (address + PMD_SIZE) & PMD_MASK;
343 continue;
344 }
345 pt_dir = vmem_pte_alloc();
346 if (!pt_dir)
347 goto out;
348 pmd_populate(&init_mm, pm_dir, pt_dir);
349 } else if (pmd_large(*pm_dir)) {
350 address = (address + PMD_SIZE) & PMD_MASK;
351 continue;
352 }
353
354 pt_dir = pte_offset_kernel(pm_dir, address);
355 if (pte_none(*pt_dir)) {
356 void *new_page;
357
358 new_page = vmemmap_alloc_block(PAGE_SIZE, node);
359 if (!new_page)
360 goto out;
361 pte_val(*pt_dir) = __pa(new_page) | pgt_prot;
362 }
363 address += PAGE_SIZE;
364 }
365 ret = 0;
366 out:
367 if (ret)
> 368 vmemmap_free(start, end, altmap);
369 return ret;
370 }
371
> 372 void vmemmap_free(unsigned long start, unsigned long end,
373 struct vmem_altmap *altmap)
374 {
375 remove_pagetable(start, end, false);
376 }
377

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

Attachment: .config.gz
Description: application/gzip