linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* undefined reference to `node_data'
@ 2022-03-23 12:58 kernel test robot
  2022-03-23 14:53 ` Michal Hocko
  0 siblings, 1 reply; 8+ messages in thread
From: kernel test robot @ 2022-03-23 12:58 UTC (permalink / raw)
  To: Michal Hocko
  Cc: kbuild-all, linux-kernel, Oscar Salvador, Andrew Morton,
	Linux Memory Management List

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   6b1f86f8e9c7f9de7ca1cb987b2cf25e99b1ae3a
commit: 09f49dca570a917a8c6bccd7e8c61f5141534e3a mm: handle uninitialized numa nodes gracefully
date:   14 hours ago
config: mips-buildonly-randconfig-r004-20220323 (https://download.01.org/0day-ci/archive/20220323/202203232042.AS9SV1zv-lkp@intel.com/config)
compiler: mips64-linux-gcc (GCC) 11.2.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
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=09f49dca570a917a8c6bccd7e8c61f5141534e3a
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 09f49dca570a917a8c6bccd7e8c61f5141534e3a
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash

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 >>):

   mips64-linux-ld: mm/page_alloc.o: in function `free_area_init':
>> (.init.text+0x1680): undefined reference to `node_data'
   mips64-linux-ld: (.init.text+0x1690): undefined reference to `node_data'

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: undefined reference to `node_data'
  2022-03-23 12:58 undefined reference to `node_data' kernel test robot
@ 2022-03-23 14:53 ` Michal Hocko
  2022-03-23 16:46   ` Michal Hocko
  0 siblings, 1 reply; 8+ messages in thread
From: Michal Hocko @ 2022-03-23 14:53 UTC (permalink / raw)
  To: kernel test robot
  Cc: kbuild-all, linux-kernel, Oscar Salvador, Andrew Morton,
	Linux Memory Management List

On Wed 23-03-22 20:58:10, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   6b1f86f8e9c7f9de7ca1cb987b2cf25e99b1ae3a
> commit: 09f49dca570a917a8c6bccd7e8c61f5141534e3a mm: handle uninitialized numa nodes gracefully
> date:   14 hours ago
> config: mips-buildonly-randconfig-r004-20220323 (https://download.01.org/0day-ci/archive/20220323/202203232042.AS9SV1zv-lkp@intel.com/config)
> compiler: mips64-linux-gcc (GCC) 11.2.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
>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=09f49dca570a917a8c6bccd7e8c61f5141534e3a
>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>         git fetch --no-tags linus master
>         git checkout 09f49dca570a917a8c6bccd7e8c61f5141534e3a
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash

Didn't work for me
> 
> 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 >>):
> 
>    mips64-linux-ld: mm/page_alloc.o: in function `free_area_init':
> >> (.init.text+0x1680): undefined reference to `node_data'
>    mips64-linux-ld: (.init.text+0x1690): undefined reference to `node_data'

OK, I can see what is going here. The page allocator normally
uses NODE_DATA but arch_refresh_nodedata refers to node_data directly.
This is a problem with
arch/mips/include/asm/mach-loongson64/mmzone.h:
extern struct pglist_data *__node_data[];

#define NODE_DATA(n)            (__node_data[n])

Unfortunately we cannot use NODE_DATA there because of header inclusion
ordering. I will think about a solution.

Thanks for the report
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: undefined reference to `node_data'
  2022-03-23 14:53 ` Michal Hocko
@ 2022-03-23 16:46   ` Michal Hocko
  2022-03-24  9:04     ` Thomas Bogendoerfer
  0 siblings, 1 reply; 8+ messages in thread
From: Michal Hocko @ 2022-03-23 16:46 UTC (permalink / raw)
  To: kernel test robot
  Cc: kbuild-all, linux-kernel, Oscar Salvador, Andrew Morton,
	Linux Memory Management List, Thomas Bogendoerfer, linux-mips

Let me CC MIPS maintainers

On Wed 23-03-22 15:53:31, Michal Hocko wrote:
> On Wed 23-03-22 20:58:10, kernel test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head:   6b1f86f8e9c7f9de7ca1cb987b2cf25e99b1ae3a
> > commit: 09f49dca570a917a8c6bccd7e8c61f5141534e3a mm: handle uninitialized numa nodes gracefully
> > date:   14 hours ago
> > config: mips-buildonly-randconfig-r004-20220323 (https://download.01.org/0day-ci/archive/20220323/202203232042.AS9SV1zv-lkp@intel.com/config)
> > compiler: mips64-linux-gcc (GCC) 11.2.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
> >         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=09f49dca570a917a8c6bccd7e8c61f5141534e3a
> >         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> >         git fetch --no-tags linus master
> >         git checkout 09f49dca570a917a8c6bccd7e8c61f5141534e3a
> >         # save the config file to linux build tree
> >         mkdir build_dir
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash
> 
> Didn't work for me
> > 
> > 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 >>):
> > 
> >    mips64-linux-ld: mm/page_alloc.o: in function `free_area_init':
> > >> (.init.text+0x1680): undefined reference to `node_data'
> >    mips64-linux-ld: (.init.text+0x1690): undefined reference to `node_data'
> 
> OK, I can see what is going here. The page allocator normally
> uses NODE_DATA but arch_refresh_nodedata refers to node_data directly.
> This is a problem with
> arch/mips/include/asm/mach-loongson64/mmzone.h:
> extern struct pglist_data *__node_data[];
> 
> #define NODE_DATA(n)            (__node_data[n])
> 
> Unfortunately we cannot use NODE_DATA there because of header inclusion
> ordering. I will think about a solution.

Is there any reason why (some?) MIPS arches use __node_data rather than
node_data as most other architectures? Would it be acceptable to do the
renaming? It would help to cover the above compilation problem because
arch_refresh_nodedata could keep using node_data directly.

Thanks!
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: undefined reference to `node_data'
  2022-03-23 16:46   ` Michal Hocko
@ 2022-03-24  9:04     ` Thomas Bogendoerfer
  2022-03-24 12:40       ` Michal Hocko
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Bogendoerfer @ 2022-03-24  9:04 UTC (permalink / raw)
  To: Michal Hocko
  Cc: kernel test robot, kbuild-all, linux-kernel, Oscar Salvador,
	Andrew Morton, Linux Memory Management List, linux-mips

On Wed, Mar 23, 2022 at 05:46:59PM +0100, Michal Hocko wrote:
> > > 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 >>):
> > > 
> > >    mips64-linux-ld: mm/page_alloc.o: in function `free_area_init':
> > > >> (.init.text+0x1680): undefined reference to `node_data'
> > >    mips64-linux-ld: (.init.text+0x1690): undefined reference to `node_data'
> > 
> > OK, I can see what is going here. The page allocator normally
> > uses NODE_DATA but arch_refresh_nodedata refers to node_data directly.
> > This is a problem with
> > arch/mips/include/asm/mach-loongson64/mmzone.h:
> > extern struct pglist_data *__node_data[];
> > 
> > #define NODE_DATA(n)            (__node_data[n])
> > 
> > Unfortunately we cannot use NODE_DATA there because of header inclusion
> > ordering. I will think about a solution.
> 
> Is there any reason why (some?) MIPS arches use __node_data rather than
> node_data as most other architectures? Would it be acceptable to do the
> renaming? It would help to cover the above compilation problem because
> arch_refresh_nodedata could keep using node_data directly.

I've just checked history and I don't see a reason for __node_data.
So I'm fine with changing it to node_data.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: undefined reference to `node_data'
  2022-03-24  9:04     ` Thomas Bogendoerfer
@ 2022-03-24 12:40       ` Michal Hocko
  2022-03-25  1:16         ` [kbuild-all] " Chen, Rong A
  0 siblings, 1 reply; 8+ messages in thread
From: Michal Hocko @ 2022-03-24 12:40 UTC (permalink / raw)
  To: kernel test robot, kbuild-all, Thomas Bogendoerfer
  Cc: linux-kernel, Oscar Salvador, Andrew Morton,
	Linux Memory Management List, linux-mips

On Thu 24-03-22 10:04:43, Thomas Bogendoerfer wrote:
> On Wed, Mar 23, 2022 at 05:46:59PM +0100, Michal Hocko wrote:
> > > > 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 >>):
> > > > 
> > > >    mips64-linux-ld: mm/page_alloc.o: in function `free_area_init':
> > > > >> (.init.text+0x1680): undefined reference to `node_data'
> > > >    mips64-linux-ld: (.init.text+0x1690): undefined reference to `node_data'
> > > 
> > > OK, I can see what is going here. The page allocator normally
> > > uses NODE_DATA but arch_refresh_nodedata refers to node_data directly.
> > > This is a problem with
> > > arch/mips/include/asm/mach-loongson64/mmzone.h:
> > > extern struct pglist_data *__node_data[];
> > > 
> > > #define NODE_DATA(n)            (__node_data[n])
> > > 
> > > Unfortunately we cannot use NODE_DATA there because of header inclusion
> > > ordering. I will think about a solution.
> > 
> > Is there any reason why (some?) MIPS arches use __node_data rather than
> > node_data as most other architectures? Would it be acceptable to do the
> > renaming? It would help to cover the above compilation problem because
> > arch_refresh_nodedata could keep using node_data directly.
> 
> I've just checked history and I don't see a reason for __node_data.
> So I'm fine with changing it to node_data.

Thanks a lot for double checking Thomas! This is a dump&simple sed over
mips file. 0-day guys, could you give it a try please?
--- 
diff --git a/arch/mips/include/asm/mach-ip27/mmzone.h b/arch/mips/include/asm/mach-ip27/mmzone.h
index 08c36e50a860..a798ad379da1 100644
--- a/arch/mips/include/asm/mach-ip27/mmzone.h
+++ b/arch/mips/include/asm/mach-ip27/mmzone.h
@@ -20,9 +20,9 @@ struct node_data {
 	struct hub_data hub;
 };
 
-extern struct node_data *__node_data[];
+extern struct node_data *node_data[];
 
-#define NODE_DATA(n)		(&__node_data[(n)]->pglist)
-#define hub_data(n)		(&__node_data[(n)]->hub)
+#define NODE_DATA(n)		(&node_data[(n)]->pglist)
+#define hub_data(n)		(&node_data[(n)]->hub)
 
 #endif /* _ASM_MACH_MMZONE_H */
diff --git a/arch/mips/include/asm/mach-loongson64/mmzone.h b/arch/mips/include/asm/mach-loongson64/mmzone.h
index ebb1deaa77b9..14e2b860ad65 100644
--- a/arch/mips/include/asm/mach-loongson64/mmzone.h
+++ b/arch/mips/include/asm/mach-loongson64/mmzone.h
@@ -14,9 +14,9 @@
 #define pa_to_nid(addr)  (((addr) & 0xf00000000000) >> NODE_ADDRSPACE_SHIFT)
 #define nid_to_addrbase(nid) ((unsigned long)(nid) << NODE_ADDRSPACE_SHIFT)
 
-extern struct pglist_data *__node_data[];
+extern struct pglist_data *node_data[];
 
-#define NODE_DATA(n)		(__node_data[n])
+#define NODE_DATA(n)		(node_data[n])
 
 extern void setup_zero_pages(void);
 extern void __init prom_init_numa_memory(void);
diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c
index e8e3e48c5333..abbbc70ce980 100644
--- a/arch/mips/loongson64/numa.c
+++ b/arch/mips/loongson64/numa.c
@@ -29,8 +29,8 @@
 
 unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES];
 EXPORT_SYMBOL(__node_distances);
-struct pglist_data *__node_data[MAX_NUMNODES];
-EXPORT_SYMBOL(__node_data);
+struct pglist_data *node_data[MAX_NUMNODES];
+EXPORT_SYMBOL(node_data);
 
 cpumask_t __node_cpumask[MAX_NUMNODES];
 EXPORT_SYMBOL(__node_cpumask);
@@ -107,7 +107,7 @@ static void __init node_mem_init(unsigned int node)
 	tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT);
 	if (tnid != node)
 		pr_info("NODE_DATA(%d) on node %d\n", node, tnid);
-	__node_data[node] = nd;
+	node_data[node] = nd;
 	NODE_DATA(node)->node_start_pfn = start_pfn;
 	NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn;
 
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index adc2faeecf7c..1c3a0b92d134 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -33,9 +33,9 @@
 #define SLOT_PFNSHIFT		(SLOT_SHIFT - PAGE_SHIFT)
 #define PFN_NASIDSHFT		(NASID_SHFT - PAGE_SHIFT)
 
-struct node_data *__node_data[MAX_NUMNODES];
+struct node_data *node_data[MAX_NUMNODES];
 
-EXPORT_SYMBOL(__node_data);
+EXPORT_SYMBOL(node_data);
 
 static u64 gen_region_mask(void)
 {
@@ -358,8 +358,8 @@ static void __init node_mem_init(nasid_t node)
 	/*
 	 * Allocate the node data structures on the node first.
 	 */
-	__node_data[node] = __va(slot_freepfn << PAGE_SHIFT);
-	memset(__node_data[node], 0, PAGE_SIZE);
+	node_data[node] = __va(slot_freepfn << PAGE_SHIFT);
+	memset(node_data[node], 0, PAGE_SIZE);
 
 	NODE_DATA(node)->node_start_pfn = start_pfn;
 	NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn;
@@ -401,7 +401,7 @@ void __init prom_meminit(void)
 			node_mem_init(node);
 			continue;
 		}
-		__node_data[node] = &null_node;
+		node_data[node] = &null_node;
 	}
 }
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [kbuild-all] Re: undefined reference to `node_data'
  2022-03-24 12:40       ` Michal Hocko
@ 2022-03-25  1:16         ` Chen, Rong A
  2022-03-25  3:40           ` Tiezhu Yang
  0 siblings, 1 reply; 8+ messages in thread
From: Chen, Rong A @ 2022-03-25  1:16 UTC (permalink / raw)
  To: Michal Hocko, kernel test robot, kbuild-all, Thomas Bogendoerfer
  Cc: linux-kernel, Oscar Salvador, Andrew Morton,
	Linux Memory Management List, linux-mips



On 3/24/2022 8:40 PM, Michal Hocko wrote:
> On Thu 24-03-22 10:04:43, Thomas Bogendoerfer wrote:
>> On Wed, Mar 23, 2022 at 05:46:59PM +0100, Michal Hocko wrote:
>>>>> 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 >>):
>>>>>
>>>>>     mips64-linux-ld: mm/page_alloc.o: in function `free_area_init':
>>>>>>> (.init.text+0x1680): undefined reference to `node_data'
>>>>>     mips64-linux-ld: (.init.text+0x1690): undefined reference to `node_data'
>>>>
>>>> OK, I can see what is going here. The page allocator normally
>>>> uses NODE_DATA but arch_refresh_nodedata refers to node_data directly.
>>>> This is a problem with
>>>> arch/mips/include/asm/mach-loongson64/mmzone.h:
>>>> extern struct pglist_data *__node_data[];
>>>>
>>>> #define NODE_DATA(n)            (__node_data[n])
>>>>
>>>> Unfortunately we cannot use NODE_DATA there because of header inclusion
>>>> ordering. I will think about a solution.
>>>
>>> Is there any reason why (some?) MIPS arches use __node_data rather than
>>> node_data as most other architectures? Would it be acceptable to do the
>>> renaming? It would help to cover the above compilation problem because
>>> arch_refresh_nodedata could keep using node_data directly.
>>
>> I've just checked history and I don't see a reason for __node_data.
>> So I'm fine with changing it to node_data.
> 
> Thanks a lot for double checking Thomas! This is a dump&simple sed over
> mips file. 0-day guys, could you give it a try please?


Hi Michal,

It returns another error:

$ mkdir -p build_dir && wget 
https://download.01.org/0day-ci/archive/20220323/202203232042.AS9SV1zv-lkp@intel.com/config 
-O build_dir/.config
$ COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross 
O=build_dir ARCH=mips SHELL=/bin/bash
Compiler will be installed in /home/nfs/0day
make --keep-going CONFIG_OF_ALL_DTBS=y CONFIG_DTC=y 
CROSS_COMPILE=/home/nfs/0day/gcc-11.2.0-nolibc/mips-linux/bin/mips-linux- --jobs=72 
O=build_dir ARCH=mips SHELL=/bin/bash
...
In file included from ../arch/mips/include/asm/mmzone.h:12,
                  from ../include/linux/mmzone.h:1116,
                  from ../include/linux/gfp.h:6,
                  from ../include/linux/xarray.h:14,
                  from ../include/linux/list_lru.h:14,
                  from ../include/linux/fs.h:13,
                  from ../include/linux/compat.h:17,
                  from ../arch/mips/kernel/asm-offsets.c:12:
../arch/mips/include/asm/mach-ip27/mmzone.h:23:26: error: conflicting 
types for 'node_data'; have 'struct node_data *[]'
    23 | extern struct node_data *node_data[];
       |                          ^~~~~~~~~
In file included from ../include/linux/mmzone.h:952,
                  from ../include/linux/gfp.h:6,
                  from ../include/linux/xarray.h:14,
                  from ../include/linux/list_lru.h:14,
                  from ../include/linux/fs.h:13,
                  from ../include/linux/compat.h:17,
                  from ../arch/mips/kernel/asm-offsets.c:12:
../include/linux/memory_hotplug.h:55:19: note: previous declaration of 
'node_data' with type 'pg_data_t *[]' {aka 'struct pglist_data *[]'}
    55 | extern pg_data_t *node_data[];
       |                   ^~~~~~~~~
make[2]: *** [../scripts/Makefile.build:121: 
arch/mips/kernel/asm-offsets.s] Error 1
make[2]: Target 'missing-syscalls' not remade because of errors.
make[1]: *** [../arch/mips/Makefile:413: archprepare] Error 2
make[1]: Target '__all' not remade because of errors.
make[1]: Leaving directory '/mnt/memdrive/linux/build_dir'
make: *** [Makefile:219: __sub-make] Error 2
make: Target '__all' not remade because of errors.

Best Regards,
Rong Chen

> ---
> diff --git a/arch/mips/include/asm/mach-ip27/mmzone.h b/arch/mips/include/asm/mach-ip27/mmzone.h
> index 08c36e50a860..a798ad379da1 100644
> --- a/arch/mips/include/asm/mach-ip27/mmzone.h
> +++ b/arch/mips/include/asm/mach-ip27/mmzone.h
> @@ -20,9 +20,9 @@ struct node_data {
>   	struct hub_data hub;
>   };
>   
> -extern struct node_data *__node_data[];
> +extern struct node_data *node_data[];
>   
> -#define NODE_DATA(n)		(&__node_data[(n)]->pglist)
> -#define hub_data(n)		(&__node_data[(n)]->hub)
> +#define NODE_DATA(n)		(&node_data[(n)]->pglist)
> +#define hub_data(n)		(&node_data[(n)]->hub)
>   
>   #endif /* _ASM_MACH_MMZONE_H */
> diff --git a/arch/mips/include/asm/mach-loongson64/mmzone.h b/arch/mips/include/asm/mach-loongson64/mmzone.h
> index ebb1deaa77b9..14e2b860ad65 100644
> --- a/arch/mips/include/asm/mach-loongson64/mmzone.h
> +++ b/arch/mips/include/asm/mach-loongson64/mmzone.h
> @@ -14,9 +14,9 @@
>   #define pa_to_nid(addr)  (((addr) & 0xf00000000000) >> NODE_ADDRSPACE_SHIFT)
>   #define nid_to_addrbase(nid) ((unsigned long)(nid) << NODE_ADDRSPACE_SHIFT)
>   
> -extern struct pglist_data *__node_data[];
> +extern struct pglist_data *node_data[];
>   
> -#define NODE_DATA(n)		(__node_data[n])
> +#define NODE_DATA(n)		(node_data[n])
>   
>   extern void setup_zero_pages(void);
>   extern void __init prom_init_numa_memory(void);
> diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c
> index e8e3e48c5333..abbbc70ce980 100644
> --- a/arch/mips/loongson64/numa.c
> +++ b/arch/mips/loongson64/numa.c
> @@ -29,8 +29,8 @@
>   
>   unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES];
>   EXPORT_SYMBOL(__node_distances);
> -struct pglist_data *__node_data[MAX_NUMNODES];
> -EXPORT_SYMBOL(__node_data);
> +struct pglist_data *node_data[MAX_NUMNODES];
> +EXPORT_SYMBOL(node_data);
>   
>   cpumask_t __node_cpumask[MAX_NUMNODES];
>   EXPORT_SYMBOL(__node_cpumask);
> @@ -107,7 +107,7 @@ static void __init node_mem_init(unsigned int node)
>   	tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT);
>   	if (tnid != node)
>   		pr_info("NODE_DATA(%d) on node %d\n", node, tnid);
> -	__node_data[node] = nd;
> +	node_data[node] = nd;
>   	NODE_DATA(node)->node_start_pfn = start_pfn;
>   	NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn;
>   
> diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
> index adc2faeecf7c..1c3a0b92d134 100644
> --- a/arch/mips/sgi-ip27/ip27-memory.c
> +++ b/arch/mips/sgi-ip27/ip27-memory.c
> @@ -33,9 +33,9 @@
>   #define SLOT_PFNSHIFT		(SLOT_SHIFT - PAGE_SHIFT)
>   #define PFN_NASIDSHFT		(NASID_SHFT - PAGE_SHIFT)
>   
> -struct node_data *__node_data[MAX_NUMNODES];
> +struct node_data *node_data[MAX_NUMNODES];
>   
> -EXPORT_SYMBOL(__node_data);
> +EXPORT_SYMBOL(node_data);
>   
>   static u64 gen_region_mask(void)
>   {
> @@ -358,8 +358,8 @@ static void __init node_mem_init(nasid_t node)
>   	/*
>   	 * Allocate the node data structures on the node first.
>   	 */
> -	__node_data[node] = __va(slot_freepfn << PAGE_SHIFT);
> -	memset(__node_data[node], 0, PAGE_SIZE);
> +	node_data[node] = __va(slot_freepfn << PAGE_SHIFT);
> +	memset(node_data[node], 0, PAGE_SIZE);
>   
>   	NODE_DATA(node)->node_start_pfn = start_pfn;
>   	NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn;
> @@ -401,7 +401,7 @@ void __init prom_meminit(void)
>   			node_mem_init(node);
>   			continue;
>   		}
> -		__node_data[node] = &null_node;
> +		node_data[node] = &null_node;
>   	}
>   }
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [kbuild-all] Re: undefined reference to `node_data'
  2022-03-25  1:16         ` [kbuild-all] " Chen, Rong A
@ 2022-03-25  3:40           ` Tiezhu Yang
  2022-03-25  7:46             ` Michal Hocko
  0 siblings, 1 reply; 8+ messages in thread
From: Tiezhu Yang @ 2022-03-25  3:40 UTC (permalink / raw)
  To: Chen, Rong A, Michal Hocko, kernel test robot, kbuild-all,
	Thomas Bogendoerfer
  Cc: linux-kernel, Oscar Salvador, Andrew Morton,
	Linux Memory Management List, linux-mips, chenfeiyang



On 03/25/2022 09:16 AM, Chen, Rong A wrote:
>
>
> On 3/24/2022 8:40 PM, Michal Hocko wrote:
>> On Thu 24-03-22 10:04:43, Thomas Bogendoerfer wrote:
>>> On Wed, Mar 23, 2022 at 05:46:59PM +0100, Michal Hocko wrote:
>>>>>> 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 >>):
>>>>>>
>>>>>>     mips64-linux-ld: mm/page_alloc.o: in function `free_area_init':
>>>>>>>> (.init.text+0x1680): undefined reference to `node_data'
>>>>>>     mips64-linux-ld: (.init.text+0x1690): undefined reference to
>>>>>> `node_data'
>>>>>
>>>>> OK, I can see what is going here. The page allocator normally
>>>>> uses NODE_DATA but arch_refresh_nodedata refers to node_data directly.
>>>>> This is a problem with
>>>>> arch/mips/include/asm/mach-loongson64/mmzone.h:
>>>>> extern struct pglist_data *__node_data[];
>>>>>
>>>>> #define NODE_DATA(n)            (__node_data[n])
>>>>>
>>>>> Unfortunately we cannot use NODE_DATA there because of header
>>>>> inclusion
>>>>> ordering. I will think about a solution.
>>>>
>>>> Is there any reason why (some?) MIPS arches use __node_data rather than
>>>> node_data as most other architectures? Would it be acceptable to do the
>>>> renaming? It would help to cover the above compilation problem because
>>>> arch_refresh_nodedata could keep using node_data directly.
>>>
>>> I've just checked history and I don't see a reason for __node_data.
>>> So I'm fine with changing it to node_data.
>>
>> Thanks a lot for double checking Thomas! This is a dump&simple sed over
>> mips file. 0-day guys, could you give it a try please?
>
>
> Hi Michal,
>
> It returns another error:

Hi,

I think the following patch should fix the build error
"undefined reference to `node_data'":

https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git/commit/?id=f8f9f21c7848

Thanks,
Tiezhu


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [kbuild-all] Re: undefined reference to `node_data'
  2022-03-25  3:40           ` Tiezhu Yang
@ 2022-03-25  7:46             ` Michal Hocko
  0 siblings, 0 replies; 8+ messages in thread
From: Michal Hocko @ 2022-03-25  7:46 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Chen, Rong A, kernel test robot, kbuild-all, Thomas Bogendoerfer,
	linux-kernel, Oscar Salvador, Andrew Morton,
	Linux Memory Management List, linux-mips, chenfeiyang

On Fri 25-03-22 11:40:37, Tiezhu Yang wrote:
> 
> 
> On 03/25/2022 09:16 AM, Chen, Rong A wrote:
> > 
> > 
> > On 3/24/2022 8:40 PM, Michal Hocko wrote:
> > > On Thu 24-03-22 10:04:43, Thomas Bogendoerfer wrote:
> > > > On Wed, Mar 23, 2022 at 05:46:59PM +0100, Michal Hocko wrote:
> > > > > > > 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 >>):
> > > > > > > 
> > > > > > >     mips64-linux-ld: mm/page_alloc.o: in function `free_area_init':
> > > > > > > > > (.init.text+0x1680): undefined reference to `node_data'
> > > > > > >     mips64-linux-ld: (.init.text+0x1690): undefined reference to
> > > > > > > `node_data'
> > > > > > 
> > > > > > OK, I can see what is going here. The page allocator normally
> > > > > > uses NODE_DATA but arch_refresh_nodedata refers to node_data directly.
> > > > > > This is a problem with
> > > > > > arch/mips/include/asm/mach-loongson64/mmzone.h:
> > > > > > extern struct pglist_data *__node_data[];
> > > > > > 
> > > > > > #define NODE_DATA(n)            (__node_data[n])
> > > > > > 
> > > > > > Unfortunately we cannot use NODE_DATA there because of header
> > > > > > inclusion
> > > > > > ordering. I will think about a solution.
> > > > > 
> > > > > Is there any reason why (some?) MIPS arches use __node_data rather than
> > > > > node_data as most other architectures? Would it be acceptable to do the
> > > > > renaming? It would help to cover the above compilation problem because
> > > > > arch_refresh_nodedata could keep using node_data directly.
> > > > 
> > > > I've just checked history and I don't see a reason for __node_data.
> > > > So I'm fine with changing it to node_data.
> > > 
> > > Thanks a lot for double checking Thomas! This is a dump&simple sed over
> > > mips file. 0-day guys, could you give it a try please?
> > 
> > 
> > Hi Michal,
> > 
> > It returns another error:
> 
> Hi,
> 
> I think the following patch should fix the build error
> "undefined reference to `node_data'":
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git/commit/?id=f8f9f21c7848

Thanks that looks much better than my renaming patch. Thanks a lot.
FWIW
Acked-by: Michal Hocko <mhocko@suse.com>
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-03-25  7:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-23 12:58 undefined reference to `node_data' kernel test robot
2022-03-23 14:53 ` Michal Hocko
2022-03-23 16:46   ` Michal Hocko
2022-03-24  9:04     ` Thomas Bogendoerfer
2022-03-24 12:40       ` Michal Hocko
2022-03-25  1:16         ` [kbuild-all] " Chen, Rong A
2022-03-25  3:40           ` Tiezhu Yang
2022-03-25  7:46             ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).