Subject: Re: [PATCH 1/4] hugetlbfs: add arch_hugetlb_valid_size

From: kbuild test robot <[email-masked]>
Date: Thu, 19 Mar 2020 08:48:38 +0800

Hi Mike,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20200318]
[also build test ERROR on v5.6-rc6]
[cannot apply to arm64/for-next/core powerpc/next sparc/master linus/master sparc-next/master v5.6-rc6 v5.6-rc5 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Mike-Kravetz/Clean-up-hugetlb-boot-command-line-processing/20200319-060943
base:    47780d7892b77e922bbe19b5dea99cde06b2f0e5
config: riscv-allyesconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.2.0
reproduce:
        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
        GCC_VERSION=9.2.0 make.cross ARCH=riscv 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email-masked]>

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

   arch/riscv/mm/hugetlbpage.c: In function 'arch_hugetlb_valid_size':
>> arch/riscv/mm/hugetlbpage.c:19:39: error: 'ps' undeclared (first use in this function)
      19 |  else if (IS_ENABLED(CONFIG_64BIT) && ps == PUD_SIZE)
         |                                       ^~
   arch/riscv/mm/hugetlbpage.c:19:39: note: each undeclared identifier is reported only once for each function it appears in
>> arch/riscv/mm/hugetlbpage.c:20:3: error: 'retrurn' undeclared (first use in this function)
      20 |   retrurn true;
         |   ^~~~~~~
>> arch/riscv/mm/hugetlbpage.c:20:10: error: expected ';' before 'true'
      20 |   retrurn true;
         |          ^~~~~
         |          ;
   In file included from include/linux/printk.h:7,
                    from include/linux/kernel.h:15,
                    from include/asm-generic/bug.h:19,
                    from arch/riscv/include/asm/bug.h:75,
                    from include/linux/bug.h:5,
                    from arch/riscv/include/asm/cmpxchg.h:9,
                    from arch/riscv/include/asm/atomic.h:19,
                    from include/linux/atomic.h:7,
                    from include/linux/mm_types_task.h:13,
                    from include/linux/mm_types.h:5,
                    from include/linux/hugetlb.h:5,
                    from arch/riscv/mm/hugetlbpage.c:2:
   arch/riscv/mm/hugetlbpage.c: In function 'setup_hugepagesz':
   include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=]
       5 | #define KERN_SOH "\001"  /* ASCII Start Of Header */
         |                  ^~~~~~
   include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH'
      11 | #define KERN_ERR KERN_SOH "3" /* error conditions */
         |                  ^~~~~~~~
   include/linux/printk.h:304:9: note: in expansion of macro 'KERN_ERR'
     304 |  printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~
   arch/riscv/mm/hugetlbpage.c:35:2: note: in expansion of macro 'pr_err'
      35 |  pr_err("hugepagesz: Unsupported page size %lu M\n", ps >> 20);
         |  ^~~~~~
   arch/riscv/mm/hugetlbpage.c:35:46: note: format string is defined here
      35 |  pr_err("hugepagesz: Unsupported page size %lu M\n", ps >> 20);
         |                                            ~~^
         |                                              |
         |                                              long unsigned int
         |                                            %llu
   arch/riscv/mm/hugetlbpage.c: In function 'arch_hugetlb_valid_size':
>> arch/riscv/mm/hugetlbpage.c:23:1: warning: control reaches end of non-void function [-Wreturn-type]
      23 | }
         | ^

vim +/ps +19 arch/riscv/mm/hugetlbpage.c

    14	
    15	bool __init arch_hugetlb_valid_size(unsigned long long size)
    16	{
    17		if (size == HPAGE_SIZE)
    18			return true;
  > 19		else if (IS_ENABLED(CONFIG_64BIT) && ps == PUD_SIZE)
  > 20			retrurn true;
    21		else
    22			return false;
  > 23	}
    24	
    25	static __init int setup_hugepagesz(char *opt)
    26	{
    27		unsigned long long ps = memparse(opt, &opt);
    28	
    29		if (arch_hugetlb_valid_size(ps)) {
    30			hugetlb_add_hstate(ilog2(ps) - PAGE_SHIFT);
    31			return 1;
    32		}
    33	
    34		hugetlb_bad_size();
  > 35		pr_err("hugepagesz: Unsupported page size %lu M\n", ps >> 20);
    36		return 0;
    37	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email-masked]