public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* mm/page_alloc.c:8046:33: error: implicit declaration of function 'arch_alloc_nodedata'; did you mean 'arch_alloc_page'?
@ 2021-12-09 22:15 kernel test robot
  2021-12-10  9:18 ` Michal Hocko
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2021-12-09 22:15 UTC (permalink / raw)
  To: Michal Hocko; +Cc: kbuild-all, linux-kernel, 0day robot

tree:   https://github.com/0day-ci/linux/commits/UPDATE-20211209-184929/Alexey-Makhalov/mm-fix-panic-in-__alloc_pages/20211102-041405
head:   652e780546c1fdbe1adcbbe04106f4020e3bfb56
commit: 652e780546c1fdbe1adcbbe04106f4020e3bfb56 mm: fix panic in __alloc_pages
date:   11 hours ago
config: csky-buildonly-randconfig-r005-20211209 (https://download.01.org/0day-ci/archive/20211210/202112100657.wrZJcCEG-lkp@intel.com/config)
compiler: csky-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://github.com/0day-ci/linux/commit/652e780546c1fdbe1adcbbe04106f4020e3bfb56
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review UPDATE-20211209-184929/Alexey-Makhalov/mm-fix-panic-in-__alloc_pages/20211102-041405
        git checkout 652e780546c1fdbe1adcbbe04106f4020e3bfb56
        # 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=csky SHELL=/bin/bash

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

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

   mm/page_alloc.c:3804:15: warning: no previous prototype for 'should_fail_alloc_page' [-Wmissing-prototypes]
    3804 | noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
         |               ^~~~~~~~~~~~~~~~~~~~~~
   mm/page_alloc.c: In function 'free_area_init':
>> mm/page_alloc.c:8046:33: error: implicit declaration of function 'arch_alloc_nodedata'; did you mean 'arch_alloc_page'? [-Werror=implicit-function-declaration]
    8046 |                         pgdat = arch_alloc_nodedata(nid);
         |                                 ^~~~~~~~~~~~~~~~~~~
         |                                 arch_alloc_page
>> mm/page_alloc.c:8046:31: warning: assignment to 'pg_data_t *' {aka 'struct pglist_data *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
    8046 |                         pgdat = arch_alloc_nodedata(nid);
         |                               ^
>> mm/page_alloc.c:8052:25: error: implicit declaration of function 'arch_refresh_nodedata' [-Werror=implicit-function-declaration]
    8052 |                         arch_refresh_nodedata(nid, pgdat);
         |                         ^~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +8046 mm/page_alloc.c

  7949	
  7950	/**
  7951	 * free_area_init - Initialise all pg_data_t and zone data
  7952	 * @max_zone_pfn: an array of max PFNs for each zone
  7953	 *
  7954	 * This will call free_area_init_node() for each active node in the system.
  7955	 * Using the page ranges provided by memblock_set_node(), the size of each
  7956	 * zone in each node and their holes is calculated. If the maximum PFN
  7957	 * between two adjacent zones match, it is assumed that the zone is empty.
  7958	 * For example, if arch_max_dma_pfn == arch_max_dma32_pfn, it is assumed
  7959	 * that arch_max_dma32_pfn has no pages. It is also assumed that a zone
  7960	 * starts where the previous one ended. For example, ZONE_DMA32 starts
  7961	 * at arch_max_dma_pfn.
  7962	 */
  7963	void __init free_area_init(unsigned long *max_zone_pfn)
  7964	{
  7965		unsigned long start_pfn, end_pfn;
  7966		int i, nid, zone;
  7967		bool descending;
  7968	
  7969		/* Record where the zone boundaries are */
  7970		memset(arch_zone_lowest_possible_pfn, 0,
  7971					sizeof(arch_zone_lowest_possible_pfn));
  7972		memset(arch_zone_highest_possible_pfn, 0,
  7973					sizeof(arch_zone_highest_possible_pfn));
  7974	
  7975		start_pfn = find_min_pfn_with_active_regions();
  7976		descending = arch_has_descending_max_zone_pfns();
  7977	
  7978		for (i = 0; i < MAX_NR_ZONES; i++) {
  7979			if (descending)
  7980				zone = MAX_NR_ZONES - i - 1;
  7981			else
  7982				zone = i;
  7983	
  7984			if (zone == ZONE_MOVABLE)
  7985				continue;
  7986	
  7987			end_pfn = max(max_zone_pfn[zone], start_pfn);
  7988			arch_zone_lowest_possible_pfn[zone] = start_pfn;
  7989			arch_zone_highest_possible_pfn[zone] = end_pfn;
  7990	
  7991			start_pfn = end_pfn;
  7992		}
  7993	
  7994		/* Find the PFNs that ZONE_MOVABLE begins at in each node */
  7995		memset(zone_movable_pfn, 0, sizeof(zone_movable_pfn));
  7996		find_zone_movable_pfns_for_nodes();
  7997	
  7998		/* Print out the zone ranges */
  7999		pr_info("Zone ranges:\n");
  8000		for (i = 0; i < MAX_NR_ZONES; i++) {
  8001			if (i == ZONE_MOVABLE)
  8002				continue;
  8003			pr_info("  %-8s ", zone_names[i]);
  8004			if (arch_zone_lowest_possible_pfn[i] ==
  8005					arch_zone_highest_possible_pfn[i])
  8006				pr_cont("empty\n");
  8007			else
  8008				pr_cont("[mem %#018Lx-%#018Lx]\n",
  8009					(u64)arch_zone_lowest_possible_pfn[i]
  8010						<< PAGE_SHIFT,
  8011					((u64)arch_zone_highest_possible_pfn[i]
  8012						<< PAGE_SHIFT) - 1);
  8013		}
  8014	
  8015		/* Print out the PFNs ZONE_MOVABLE begins at in each node */
  8016		pr_info("Movable zone start for each node\n");
  8017		for (i = 0; i < MAX_NUMNODES; i++) {
  8018			if (zone_movable_pfn[i])
  8019				pr_info("  Node %d: %#018Lx\n", i,
  8020				       (u64)zone_movable_pfn[i] << PAGE_SHIFT);
  8021		}
  8022	
  8023		/*
  8024		 * Print out the early node map, and initialize the
  8025		 * subsection-map relative to active online memory ranges to
  8026		 * enable future "sub-section" extensions of the memory map.
  8027		 */
  8028		pr_info("Early memory node ranges\n");
  8029		for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, &nid) {
  8030			pr_info("  node %3d: [mem %#018Lx-%#018Lx]\n", nid,
  8031				(u64)start_pfn << PAGE_SHIFT,
  8032				((u64)end_pfn << PAGE_SHIFT) - 1);
  8033			subsection_map_init(start_pfn, end_pfn - start_pfn);
  8034		}
  8035	
  8036		/* Initialise every node */
  8037		mminit_verify_pageflags_layout();
  8038		setup_nr_node_ids();
  8039		for_each_node(nid) {
  8040			pg_data_t *pgdat;
  8041	
  8042			if (!node_online(nid)) {
  8043				pr_warn("Node %d uninitialized by the platform. Please report with boot dmesg.\n", nid);
  8044	
  8045				/* Allocator not initialized yet */
> 8046				pgdat = arch_alloc_nodedata(nid);
  8047				if (!pgdat) {
  8048					pr_err("Cannot allocate %zuB for node %d.\n",
  8049							sizeof(*pgdat), nid);
  8050					continue;
  8051				}
> 8052				arch_refresh_nodedata(nid, pgdat);
  8053				free_area_init_memoryless_node(nid);
  8054				/*
  8055				 * not marking this node online because we do not want to
  8056				 * confuse userspace by sysfs files/directories for node
  8057				 * without any memory attached to it (see topology_init)
  8058				 * The pgdat will get fully initialized when a memory is
  8059				 * hotpluged into it by hotadd_init_pgdat
  8060				 */
  8061				continue;
  8062			}
  8063	
  8064			pgdat = NODE_DATA(nid);
  8065			free_area_init_node(nid);
  8066	
  8067			/* Any memory on that node */
  8068			if (pgdat->node_present_pages)
  8069				node_set_state(nid, N_MEMORY);
  8070			check_for_memory(pgdat, nid);
  8071		}
  8072	
  8073		memmap_init();
  8074	}
  8075	

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

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

* Re: mm/page_alloc.c:8046:33: error: implicit declaration of function 'arch_alloc_nodedata'; did you mean 'arch_alloc_page'?
  2021-12-09 22:15 mm/page_alloc.c:8046:33: error: implicit declaration of function 'arch_alloc_nodedata'; did you mean 'arch_alloc_page'? kernel test robot
@ 2021-12-10  9:18 ` Michal Hocko
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2021-12-10  9:18 UTC (permalink / raw)
  To: kernel test robot; +Cc: kbuild-all, linux-kernel

Thanks for the report! I suspect this had CONFIG_MEMORY_HOTPLUG=n.
This patch should address that. Could you give it a try please?
--- 
From 404c7a5cbc886a28d53d23866ad388cf0f4d28a9 Mon Sep 17 00:00:00 2001
From: Michal Hocko <mhocko@suse.com>
Date: Fri, 10 Dec 2021 10:14:31 +0100
Subject: [PATCH] mm, memory_hotplug: make arch_alloc_nodedata independent on
 CONFIG_MEMORY_HOTPLUG

This is a preparatory patch and it doesn't introduce any functional
change. It merely pulls out arch_alloc_nodedata (and co) outside of
CONFIG_MEMORY_HOTPLUG because the following patch will need to call this
from the generic MM code.

Signed-off-by: Michal Hocko <mhocko@suse.com>
---
 arch/ia64/mm/discontig.c       |   2 -
 include/linux/memory_hotplug.h | 117 +++++++++++++++++----------------
 2 files changed, 59 insertions(+), 60 deletions(-)

diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 9a7a09e0aa52..b4c46925792f 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -608,7 +608,6 @@ void __init paging_init(void)
 	zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
 }
 
-#ifdef CONFIG_MEMORY_HOTPLUG
 pg_data_t *arch_alloc_nodedata(int nid)
 {
 	unsigned long size = compute_pernodesize(nid);
@@ -626,7 +625,6 @@ void arch_refresh_nodedata(int update_node, pg_data_t *update_pgdat)
 	pgdat_list[update_node] = update_pgdat;
 	scatter_node_data();
 }
-#endif
 
 #ifdef CONFIG_SPARSEMEM_VMEMMAP
 int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 38f8d33f0884..bea12881360f 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -16,6 +16,65 @@ struct memory_group;
 struct resource;
 struct vmem_altmap;
 
+#ifdef CONFIG_HAVE_ARCH_NODEDATA_EXTENSION
+/*
+ * For supporting node-hotadd, we have to allocate a new pgdat.
+ *
+ * If an arch has generic style NODE_DATA(),
+ * node_data[nid] = kzalloc() works well. But it depends on the architecture.
+ *
+ * In general, generic_alloc_nodedata() is used.
+ * Now, arch_free_nodedata() is just defined for error path of node_hot_add.
+ *
+ */
+extern pg_data_t *arch_alloc_nodedata(int nid);
+extern void arch_free_nodedata(pg_data_t *pgdat);
+extern void arch_refresh_nodedata(int nid, pg_data_t *pgdat);
+
+#else /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */
+
+#define arch_alloc_nodedata(nid)	generic_alloc_nodedata(nid)
+#define arch_free_nodedata(pgdat)	generic_free_nodedata(pgdat)
+
+#ifdef CONFIG_NUMA
+/*
+ * XXX: node aware allocation can't work well to get new node's memory at this time.
+ *	Because, pgdat for the new node is not allocated/initialized yet itself.
+ *	To use new node's memory, more consideration will be necessary.
+ */
+#define generic_alloc_nodedata(nid)				\
+({								\
+	memblock_alloc(sizeof(*pgdat), SMP_CACHE_BYTES);	\
+})
+/*
+ * This definition is just for error path in node hotadd.
+ * For node hotremove, we have to replace this.
+ */
+#define generic_free_nodedata(pgdat)	kfree(pgdat)
+
+extern pg_data_t *node_data[];
+static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat)
+{
+	node_data[nid] = pgdat;
+}
+
+#else /* !CONFIG_NUMA */
+
+/* never called */
+static inline pg_data_t *generic_alloc_nodedata(int nid)
+{
+	BUG();
+	return NULL;
+}
+static inline void generic_free_nodedata(pg_data_t *pgdat)
+{
+}
+static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat)
+{
+}
+#endif /* CONFIG_NUMA */
+#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */
+
 #ifdef CONFIG_MEMORY_HOTPLUG
 struct page *pfn_to_online_page(unsigned long pfn);
 
@@ -154,64 +213,6 @@ int add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
 	      struct mhp_params *params);
 #endif /* ARCH_HAS_ADD_PAGES */
 
-#ifdef CONFIG_HAVE_ARCH_NODEDATA_EXTENSION
-/*
- * For supporting node-hotadd, we have to allocate a new pgdat.
- *
- * If an arch has generic style NODE_DATA(),
- * node_data[nid] = kzalloc() works well. But it depends on the architecture.
- *
- * In general, generic_alloc_nodedata() is used.
- * Now, arch_free_nodedata() is just defined for error path of node_hot_add.
- *
- */
-extern pg_data_t *arch_alloc_nodedata(int nid);
-extern void arch_free_nodedata(pg_data_t *pgdat);
-extern void arch_refresh_nodedata(int nid, pg_data_t *pgdat);
-
-#else /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */
-
-#define arch_alloc_nodedata(nid)	generic_alloc_nodedata(nid)
-#define arch_free_nodedata(pgdat)	generic_free_nodedata(pgdat)
-
-#ifdef CONFIG_NUMA
-/*
- * XXX: node aware allocation can't work well to get new node's memory at this time.
- *	Because, pgdat for the new node is not allocated/initialized yet itself.
- *	To use new node's memory, more consideration will be necessary.
- */
-#define generic_alloc_nodedata(nid)				\
-({								\
-	memblock_alloc(sizeof(*pgdat), SMP_CACHE_BYTES);	\
-})
-/*
- * This definition is just for error path in node hotadd.
- * For node hotremove, we have to replace this.
- */
-#define generic_free_nodedata(pgdat)	kfree(pgdat)
-
-extern pg_data_t *node_data[];
-static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat)
-{
-	node_data[nid] = pgdat;
-}
-
-#else /* !CONFIG_NUMA */
-
-/* never called */
-static inline pg_data_t *generic_alloc_nodedata(int nid)
-{
-	BUG();
-	return NULL;
-}
-static inline void generic_free_nodedata(pg_data_t *pgdat)
-{
-}
-static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat)
-{
-}
-#endif /* CONFIG_NUMA */
-#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */
 
 void get_online_mems(void);
 void put_online_mems(void);
-- 
2.30.2

-- 
Michal Hocko
SUSE Labs

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

end of thread, other threads:[~2021-12-10  9:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-09 22:15 mm/page_alloc.c:8046:33: error: implicit declaration of function 'arch_alloc_nodedata'; did you mean 'arch_alloc_page'? kernel test robot
2021-12-10  9:18 ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox