Skip to contentSkip to conversation

ld.lld: error: undefined symbol: phys_to_target_node

PATCH kernel test robot 3 participants 5 messages Sep 3, 2020 – Sep 6, 2020

Subsystems (2)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   4442749a203151a319a5bb8d0b983b84253a6931
commit: bd295a352cfa24e5110a53f978edb48b7c21ff8f [2890/4758] ACPI: HMAT: attach a device for each soft-reserved range
config: x86_64-randconfig-a002-20200902 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 224d8153b53b16cf535ea1a55afdfe1ec5b1374f)

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
git checkout bd295a352cfa24e5110a53f978edb48b7c21ff8f
# 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

All errors (new ones prefixed by >>):

>> ld.lld: error: undefined symbol: phys_to_target_node
   >>> referenced by device.c:84 (drivers/dax/hmem/device.c:84)
   >>>               dax/hmem/device.o:(hmem_register_one) in archive drivers/built-in.a

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

#1 lore raw
Quoted 14 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   4442749a203151a319a5bb8d0b983b84253a6931
commit: bd295a352cfa24e5110a53f978edb48b7c21ff8f [2890/4758] ACPI: HMAT: attach a device for each soft-reserved range
config: x86_64-randconfig-a002-20200902 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 224d8153b53b16cf535ea1a55afdfe1ec5b1374f)

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
git checkout bd295a352cfa24e5110a53f978edb48b7c21ff8f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

Quoted 9 lines

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

Quoted 3 lines
Quoted 3 lines

ld.lld: error: undefined symbol: phys_to_target_node

Quoted 2 lines

referenced by device.c:84 (drivers/dax/hmem/device.c:84)
dax/hmem/device.o:(hmem_register_one) in archive drivers/built-in.a

This would require the proposed fix below the scissors mark.

I had reported this failure before, but it needed an adjustment so I'm re-sending it.

--------------------------->8----------------------------

Quoted 1 line

From 622c1297b7d76a319b07a29192fe9bfe5c2b6b7c Mon Sep 17 00:00:00 2001

From: Joao Martins <[email protected]>
Date: Tue, 1 Sep 2020 08:06:35 -0400
Subject: [PATCH] device-dax: Require NUMA_KEEP_MEMINFO for
phys_to_target_node()

phys_to_target_node() and memory_add_physaddr_to_nid() are only defined with both CONFIG_NUMA=y and CONFIG_MEMORY_HOTPLUG=y. Oherwise we see:

drivers/dax/hmem/device.o: in function `hmem_register_one':
drivers/dax/hmem/device.c:85: undefined reference to `phys_to_target_node'

lkp also reports such build failures:

ld.lld: error: undefined symbol: phys_to_target_node

X86 is a special case in which both can be defined without depending on MEMORY_HOTPLUG=y. The other case is powerpc (for memory_add_physaddr_to_nid) but like ARM64 dependencies, the arch-specific override requires CONFIG_NUMA and CONFIG_MEMORY_HOTPLUG.

In all cases this ends up depending on CONFIG_NUMA_KEEP_MEMINFO to signal the presence of phys_to_target_node() which is what CONFIG_DEV_DAX_HMEM_DEVICES should depend on. Additionally, the X86 arch-override is not selected unless X86_PMEM_LEGACY=y. So on CONFIG_DEV_DAX_HMEM we select CONFIG_NUMA_KEEP_INFO ourselves if both NUMA and X86 are set.

---
 drivers/dax/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
drivers/dax/Kconfig +2 -0
index a66dff78f298..567428e10b7b 100644
@@ -35,6 +35,7 @@ config DEV_DAX_PMEM
 config DEV_DAX_HMEM
        tristate "HMEM DAX: direct access to 'specific purpose' memory"
        depends on EFI_SOFT_RESERVE
+       select NUMA_KEEP_MEMINFO if (NUMA && X86)
        default DEV_DAX
        help
          EFI 2.8 platforms, and others, may advertise 'specific purpose'
@@ -49,6 +50,7 @@ config DEV_DAX_HMEM
          Say M if unsure.
 
 config DEV_DAX_HMEM_DEVICES
+       depends on NUMA_KEEP_MEMINFO # for phys_to_target_node()
        depends on DEV_DAX_HMEM && DAX=y
        def_bool y
 
Signature · 1 line
2.17.1
#2 lore raw
Quoted 77 lines · Joao Martins
Quoted 14 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   4442749a203151a319a5bb8d0b983b84253a6931
commit: bd295a352cfa24e5110a53f978edb48b7c21ff8f [2890/4758] ACPI: HMAT: attach a device for each soft-reserved range
config: x86_64-randconfig-a002-20200902 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 224d8153b53b16cf535ea1a55afdfe1ec5b1374f)

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
git checkout bd295a352cfa24e5110a53f978edb48b7c21ff8f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

Quoted 9 lines

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

Quoted 3 lines
Quoted 3 lines

ld.lld: error: undefined symbol: phys_to_target_node

Quoted 2 lines

referenced by device.c:84 (drivers/dax/hmem/device.c:84)
dax/hmem/device.o:(hmem_register_one) in archive drivers/built-in.a

This would require the proposed fix below the scissors mark.

I had reported this failure before, but it needed an adjustment so I'm re-sending it.

--------------------------->8----------------------------

From 622c1297b7d76a319b07a29192fe9bfe5c2b6b7c Mon Sep 17 00:00:00 2001
From: Joao Martins <[email protected]>
Date: Tue, 1 Sep 2020 08:06:35 -0400
Subject: [PATCH] device-dax: Require NUMA_KEEP_MEMINFO for
phys_to_target_node()

phys_to_target_node() and memory_add_physaddr_to_nid() are only defined with both CONFIG_NUMA=y and CONFIG_MEMORY_HOTPLUG=y. Oherwise we see:

drivers/dax/hmem/device.o: in function `hmem_register_one':
drivers/dax/hmem/device.c:85: undefined reference to `phys_to_target_node'

lkp also reports such build failures:

ld.lld: error: undefined symbol: phys_to_target_node

X86 is a special case in which both can be defined without depending on MEMORY_HOTPLUG=y. The other case is powerpc (for memory_add_physaddr_to_nid) but like ARM64 dependencies, the arch-specific override requires CONFIG_NUMA and CONFIG_MEMORY_HOTPLUG.

In all cases this ends up depending on CONFIG_NUMA_KEEP_MEMINFO to signal the presence of phys_to_target_node() which is what CONFIG_DEV_DAX_HMEM_DEVICES should depend on. Additionally, the X86 arch-override is not selected unless X86_PMEM_LEGACY=y. So on CONFIG_DEV_DAX_HMEM we select CONFIG_NUMA_KEEP_INFO ourselves if both NUMA and X86 are set.

---
 drivers/dax/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
drivers/dax/Kconfig +1 -0
index a66dff78f298..567428e10b7b 100644
@@ -35,6 +35,7 @@ config DEV_DAX_PMEM
 config DEV_DAX_HMEM
        tristate "HMEM DAX: direct access to 'specific purpose' memory"
        depends on EFI_SOFT_RESERVE
+       select NUMA_KEEP_MEMINFO if (NUMA && X86)
        default DEV_DAX
        help
          EFI 2.8 platforms, and others, may advertise 'specific purpose'

drivers/dax/Kconfig config DEV_DAX_HMEM · line 56

Quoted 7 lines
drivers/dax/Kconfig +1 -0
@@ -49,6 +50,7 @@ config DEV_DAX_HMEM
          Say M if unsure.
 
 config DEV_DAX_HMEM_DEVICES
+       depends on NUMA_KEEP_MEMINFO # for phys_to_target_node()
        depends on DEV_DAX_HMEM && DAX=y
        def_bool y
 

Hi,

There is also this patch from Matt Fleming from last year that I have successfully tested (built) on ppc64 and arch/sh/, where build errors were reported.

https://lore.kernel.org/lkml/20191223164220.GA14394(a)codeblueprint.co.uk/

but Matt doesn't seem to be replying to any emails about this patch...

Signature · 1 line
~Randy
#3 lore raw
Quoted 88 lines · Randy Dunlap
Quoted 77 lines · Joao Martins
Quoted 14 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   4442749a203151a319a5bb8d0b983b84253a6931
commit: bd295a352cfa24e5110a53f978edb48b7c21ff8f [2890/4758] ACPI: HMAT: attach a device for each soft-reserved range
config: x86_64-randconfig-a002-20200902 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 224d8153b53b16cf535ea1a55afdfe1ec5b1374f)

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
git checkout bd295a352cfa24e5110a53f978edb48b7c21ff8f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

Quoted 9 lines

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

Quoted 3 lines
Quoted 3 lines

ld.lld: error: undefined symbol: phys_to_target_node

Quoted 2 lines

referenced by device.c:84 (drivers/dax/hmem/device.c:84)
dax/hmem/device.o:(hmem_register_one) in archive drivers/built-in.a

This would require the proposed fix below the scissors mark.

I had reported this failure before, but it needed an adjustment so I'm re-sending it.

--------------------------->8----------------------------

From 622c1297b7d76a319b07a29192fe9bfe5c2b6b7c Mon Sep 17 00:00:00 2001
From: Joao Martins <[email protected]>
Date: Tue, 1 Sep 2020 08:06:35 -0400
Subject: [PATCH] device-dax: Require NUMA_KEEP_MEMINFO for
phys_to_target_node()

phys_to_target_node() and memory_add_physaddr_to_nid() are only defined with both CONFIG_NUMA=y and CONFIG_MEMORY_HOTPLUG=y. Oherwise we see:

drivers/dax/hmem/device.o: in function `hmem_register_one':
drivers/dax/hmem/device.c:85: undefined reference to `phys_to_target_node'

lkp also reports such build failures:

ld.lld: error: undefined symbol: phys_to_target_node

X86 is a special case in which both can be defined without depending on MEMORY_HOTPLUG=y. The other case is powerpc (for memory_add_physaddr_to_nid) but like ARM64 dependencies, the arch-specific override requires CONFIG_NUMA and CONFIG_MEMORY_HOTPLUG.

In all cases this ends up depending on CONFIG_NUMA_KEEP_MEMINFO to signal the presence of phys_to_target_node() which is what CONFIG_DEV_DAX_HMEM_DEVICES should depend on. Additionally, the X86 arch-override is not selected unless X86_PMEM_LEGACY=y. So on CONFIG_DEV_DAX_HMEM we select CONFIG_NUMA_KEEP_INFO ourselves if both NUMA and X86 are set.

---
 drivers/dax/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
drivers/dax/Kconfig +1 -0
index a66dff78f298..567428e10b7b 100644
@@ -35,6 +35,7 @@ config DEV_DAX_PMEM
 config DEV_DAX_HMEM
        tristate "HMEM DAX: direct access to 'specific purpose' memory"
        depends on EFI_SOFT_RESERVE
+       select NUMA_KEEP_MEMINFO if (NUMA && X86)
        default DEV_DAX
        help
          EFI 2.8 platforms, and others, may advertise 'specific purpose'

drivers/dax/Kconfig config DEV_DAX_HMEM · line 56

Quoted 7 lines
drivers/dax/Kconfig +1 -0
@@ -49,6 +50,7 @@ config DEV_DAX_HMEM
          Say M if unsure.
 
 config DEV_DAX_HMEM_DEVICES
+       depends on NUMA_KEEP_MEMINFO # for phys_to_target_node()
        depends on DEV_DAX_HMEM && DAX=y
        def_bool y
 

Hi,

Quoted 7 lines

There is also this patch from Matt Fleming from last year that I have successfully tested (built) on ppc64 and arch/sh/, where build errors were reported.

https://lore.kernel.org/lkml/20191223164220.GA14394(a)codeblueprint.co.uk/

but Matt doesn't seem to be replying to any emails about this patch...

OK, Matt's patch doesn't fix this x86_64 dax + hmem build error, so apparently Joao's patch is needed.

Signature · 1 line
~Randy
#4 lore raw
Quoted 92 lines · Randy Dunlap
Quoted 91 lines · Randy Dunlap
Quoted 77 lines · Joao Martins
Quoted 14 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   4442749a203151a319a5bb8d0b983b84253a6931
commit: bd295a352cfa24e5110a53f978edb48b7c21ff8f [2890/4758] ACPI: HMAT: attach a device for each soft-reserved range
config: x86_64-randconfig-a002-20200902 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 224d8153b53b16cf535ea1a55afdfe1ec5b1374f)

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
git checkout bd295a352cfa24e5110a53f978edb48b7c21ff8f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

Quoted 9 lines

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

Quoted 3 lines
Quoted 3 lines

ld.lld: error: undefined symbol: phys_to_target_node

Quoted 2 lines

referenced by device.c:84 (drivers/dax/hmem/device.c:84)
dax/hmem/device.o:(hmem_register_one) in archive drivers/built-in.a

This would require the proposed fix below the scissors mark.

I had reported this failure before, but it needed an adjustment so I'm re-sending it.

--------------------------->8----------------------------

From 622c1297b7d76a319b07a29192fe9bfe5c2b6b7c Mon Sep 17 00:00:00 2001
From: Joao Martins <[email protected]>
Date: Tue, 1 Sep 2020 08:06:35 -0400
Subject: [PATCH] device-dax: Require NUMA_KEEP_MEMINFO for
phys_to_target_node()

phys_to_target_node() and memory_add_physaddr_to_nid() are only defined with both CONFIG_NUMA=y and CONFIG_MEMORY_HOTPLUG=y. Oherwise we see:

drivers/dax/hmem/device.o: in function `hmem_register_one':
drivers/dax/hmem/device.c:85: undefined reference to `phys_to_target_node'

lkp also reports such build failures:

ld.lld: error: undefined symbol: phys_to_target_node

X86 is a special case in which both can be defined without depending on MEMORY_HOTPLUG=y. The other case is powerpc (for memory_add_physaddr_to_nid) but like ARM64 dependencies, the arch-specific override requires CONFIG_NUMA and CONFIG_MEMORY_HOTPLUG.

In all cases this ends up depending on CONFIG_NUMA_KEEP_MEMINFO to signal the presence of phys_to_target_node() which is what CONFIG_DEV_DAX_HMEM_DEVICES should depend on. Additionally, the X86 arch-override is not selected unless X86_PMEM_LEGACY=y. So on CONFIG_DEV_DAX_HMEM we select CONFIG_NUMA_KEEP_INFO ourselves if both NUMA and X86 are set.

---
 drivers/dax/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
drivers/dax/Kconfig +1 -0
index a66dff78f298..567428e10b7b 100644
@@ -35,6 +35,7 @@ config DEV_DAX_PMEM
 config DEV_DAX_HMEM
        tristate "HMEM DAX: direct access to 'specific purpose' memory"
        depends on EFI_SOFT_RESERVE
+       select NUMA_KEEP_MEMINFO if (NUMA && X86)
        default DEV_DAX
        help
          EFI 2.8 platforms, and others, may advertise 'specific purpose'

drivers/dax/Kconfig config DEV_DAX_HMEM · line 56

Quoted 7 lines
drivers/dax/Kconfig +1 -0
@@ -49,6 +50,7 @@ config DEV_DAX_HMEM
          Say M if unsure.
 
 config DEV_DAX_HMEM_DEVICES
+       depends on NUMA_KEEP_MEMINFO # for phys_to_target_node()
        depends on DEV_DAX_HMEM && DAX=y
        def_bool y
 

Hi,

There is also this patch from Matt Fleming from last year that I have successfully tested (built) on ppc64 and arch/sh/, where build errors were reported.

Quoted 8 lines
Quoted 4 lines

https://lore.kernel.org/lkml/20191223164220.GA14394(a)codeblueprint.co.uk/

but Matt doesn't seem to be replying to any emails about this patch...

OK, Matt's patch doesn't fix this x86_64 dax + hmem build error, so apparently Joao's patch is needed.

OTOH, Joao's patch doesn't fix the ppc64 and arch/sh/ build errors.

I'd prefer to see one patch to fix all of these build errors...

Signature · 1 line
~Randy