diff mbox series

libnvdimm/e820: Fix build error without MEMORY_HOTPLUG

Message ID 20200826121800.732-1-yuehaibing@huawei.com (mailing list archive)
State New, archived
Headers show
Series libnvdimm/e820: Fix build error without MEMORY_HOTPLUG | expand

Commit Message

Yue Haibing Aug. 26, 2020, 12:18 p.m. UTC
If MEMORY_HOTPLUG is n, build fails:

drivers/nvdimm/e820.c: In function ‘e820_register_one’:
drivers/nvdimm/e820.c:24:12: error: implicit declaration of function ‘phys_to_target_node’; did you mean ‘set_page_node’? [-Werror=implicit-function-declaration]
  int nid = phys_to_target_node(res->start);
            ^~~~~~~~~~~~~~~~~~~
            set_page_node

Fixes: 7b27a8622f80 ("libnvdimm/e820: Retrieve and populate correct 'target_node' info")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/nvdimm/e820.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

kernel test robot Aug. 26, 2020, 3:28 p.m. UTC | #1
Hi YueHaibing,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linux-nvdimm/libnvdimm-for-next]
[also build test ERROR on v5.9-rc2 next-20200826]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/YueHaibing/libnvdimm-e820-Fix-build-error-without-MEMORY_HOTPLUG/20200826-202043
base:   https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git libnvdimm-for-next
config: i386-randconfig-a004-20200826 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

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

All errors (new ones prefixed by >>):

>> drivers/nvdimm/e820.c:21:19: error: redefinition of 'phys_to_target_node'
      21 | static inline int phys_to_target_node(u64 start)
         |                   ^~~~~~~~~~~~~~~~~~~
   In file included from include/linux/nodemask.h:96,
                    from include/linux/sched.h:22,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/platform_device.h:13,
                    from drivers/nvdimm/e820.c:6:
   include/linux/numa.h:38:19: note: previous definition of 'phys_to_target_node' was here
      38 | static inline int phys_to_target_node(phys_addr_t addr)
         |                   ^~~~~~~~~~~~~~~~~~~

# https://github.com/0day-ci/linux/commit/4c003ae129dccea4445a55e9e2c61de5922fbd37
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review YueHaibing/libnvdimm-e820-Fix-build-error-without-MEMORY_HOTPLUG/20200826-202043
git checkout 4c003ae129dccea4445a55e9e2c61de5922fbd37
vim +/phys_to_target_node +21 drivers/nvdimm/e820.c

    19	
    20	#ifndef CONFIG_MEMORY_HOTPLUG
  > 21	static inline int phys_to_target_node(u64 start)
    22	{
    23		return 0;
    24	}
    25	#endif
    26	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Aug. 26, 2020, 4:34 p.m. UTC | #2
Hi YueHaibing,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linux-nvdimm/libnvdimm-for-next]
[also build test ERROR on v5.9-rc2 next-20200826]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/YueHaibing/libnvdimm-e820-Fix-build-error-without-MEMORY_HOTPLUG/20200826-202043
base:   https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git libnvdimm-for-next
config: x86_64-randconfig-a002-20200826 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 7cfcecece0e0430937cf529ce74d3a071a4dedc6)
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
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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

All errors (new ones prefixed by >>):

>> drivers/nvdimm/e820.c:21:19: error: redefinition of 'phys_to_target_node'
   static inline int phys_to_target_node(u64 start)
                     ^
   include/linux/numa.h:38:19: note: previous definition is here
   static inline int phys_to_target_node(phys_addr_t addr)
                     ^
   1 error generated.

# https://github.com/0day-ci/linux/commit/4c003ae129dccea4445a55e9e2c61de5922fbd37
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review YueHaibing/libnvdimm-e820-Fix-build-error-without-MEMORY_HOTPLUG/20200826-202043
git checkout 4c003ae129dccea4445a55e9e2c61de5922fbd37
vim +/phys_to_target_node +21 drivers/nvdimm/e820.c

    19	
    20	#ifndef CONFIG_MEMORY_HOTPLUG
  > 21	static inline int phys_to_target_node(u64 start)
    22	{
    23		return 0;
    24	}
    25	#endif
    26	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Aug. 26, 2020, 8:22 p.m. UTC | #3
Hi YueHaibing,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linux-nvdimm/libnvdimm-for-next]
[also build test ERROR on v5.9-rc2 next-20200826]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/YueHaibing/libnvdimm-e820-Fix-build-error-without-MEMORY_HOTPLUG/20200826-202043
base:   https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git libnvdimm-for-next
config: x86_64-randconfig-r014-20200826 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

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

All errors (new ones prefixed by >>):

>> drivers/nvdimm/e820.c:21:19: error: static declaration of 'phys_to_target_node' follows non-static declaration
      21 | static inline int phys_to_target_node(u64 start)
         |                   ^~~~~~~~~~~~~~~~~~~
   In file included from include/linux/nodemask.h:96,
                    from arch/x86/include/asm/numa.h:5,
                    from arch/x86/include/asm/acpi.h:11,
                    from arch/x86/include/asm/fixmap.h:29,
                    from arch/x86/include/asm/apic.h:11,
                    from arch/x86/include/asm/smp.h:13,
                    from include/linux/smp.h:82,
                    from include/linux/percpu.h:7,
                    from include/linux/hrtimer.h:19,
                    from include/linux/sched.h:20,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from include/linux/platform_device.h:13,
                    from drivers/nvdimm/e820.c:6:
   include/linux/numa.h:31:5: note: previous declaration of 'phys_to_target_node' was here
      31 | int phys_to_target_node(phys_addr_t addr);
         |     ^~~~~~~~~~~~~~~~~~~

# https://github.com/0day-ci/linux/commit/4c003ae129dccea4445a55e9e2c61de5922fbd37
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review YueHaibing/libnvdimm-e820-Fix-build-error-without-MEMORY_HOTPLUG/20200826-202043
git checkout 4c003ae129dccea4445a55e9e2c61de5922fbd37
vim +/phys_to_target_node +21 drivers/nvdimm/e820.c

    19	
    20	#ifndef CONFIG_MEMORY_HOTPLUG
  > 21	static inline int phys_to_target_node(u64 start)
    22	{
    23		return 0;
    24	}
    25	#endif
    26	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Yue Haibing Aug. 27, 2020, 3:54 a.m. UTC | #4
Pls ignore this

It has be fixed in commit dbb8733abb1c ("mm-memory_hotplug-introduce-default-phys_to_target_node-implementation-fix")

On 2020/8/26 20:18, YueHaibing wrote:
> If MEMORY_HOTPLUG is n, build fails:
> 
> drivers/nvdimm/e820.c: In function ‘e820_register_one’:
> drivers/nvdimm/e820.c:24:12: error: implicit declaration of function ‘phys_to_target_node’; did you mean ‘set_page_node’? [-Werror=implicit-function-declaration]
>   int nid = phys_to_target_node(res->start);
>             ^~~~~~~~~~~~~~~~~~~
>             set_page_node
> 
> Fixes: 7b27a8622f80 ("libnvdimm/e820: Retrieve and populate correct 'target_node' info")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/nvdimm/e820.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/nvdimm/e820.c b/drivers/nvdimm/e820.c
> index 4cd18be9d0e9..c741f029f215 100644
> --- a/drivers/nvdimm/e820.c
> +++ b/drivers/nvdimm/e820.c
> @@ -17,6 +17,13 @@ static int e820_pmem_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +#ifndef CONFIG_MEMORY_HOTPLUG
> +static inline int phys_to_target_node(u64 start)
> +{
> +	return 0;
> +}
> +#endif
> +
>  static int e820_register_one(struct resource *res, void *data)
>  {
>  	struct nd_region_desc ndr_desc;
>
diff mbox series

Patch

diff --git a/drivers/nvdimm/e820.c b/drivers/nvdimm/e820.c
index 4cd18be9d0e9..c741f029f215 100644
--- a/drivers/nvdimm/e820.c
+++ b/drivers/nvdimm/e820.c
@@ -17,6 +17,13 @@  static int e820_pmem_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifndef CONFIG_MEMORY_HOTPLUG
+static inline int phys_to_target_node(u64 start)
+{
+	return 0;
+}
+#endif
+
 static int e820_register_one(struct resource *res, void *data)
 {
 	struct nd_region_desc ndr_desc;