public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: fix bootmem cross node for 32bit numa
@ 2009-03-04  9:22 Yinghai Lu
  2009-03-04  9:24 ` [PATCH] x86: make 32bit init_memory_mapping range change more like 64bit Yinghai Lu
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Yinghai Lu @ 2009-03-04  9:22 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton
  Cc: linux-kernel@vger.kernel.org


Imapct: fix panic on system 2g x4 sockets

Found one system with 4 sockets and every sockets has 2g can boot with numa32
because boot mem is crossing nodes.

so try to have numa version setup_bootmem_allocator

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/mm/init_32.c |   46 ++++++++++++++++++++++++++++++++++++++++------
 arch/x86/mm/numa_32.c |    5 +++--
 2 files changed, 43 insertions(+), 8 deletions(-)

Index: linux-2.6/arch/x86/mm/init_32.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/init_32.c
+++ linux-2.6/arch/x86/mm/init_32.c
@@ -814,9 +814,37 @@ static void __init zone_sizes_init(void)
 	free_area_init_nodes(max_zone_pfns);
 }
 
+#ifdef CONFIG_NEED_MULTIPLE_NODES
+static unsigned long __init setup_node_bootmem(int nodeid,
+				 unsigned long start_pfn,
+				 unsigned long end_pfn,
+				 unsigned long bootmap)
+{
+	unsigned long bootmap_size;
+
+	if (start_pfn > max_low_pfn)
+		return bootmap;
+	if (end_pfn > max_low_pfn)
+		end_pfn = max_low_pfn;
+
+	/* don't touch min_low_pfn */
+	bootmap_size = init_bootmem_node(NODE_DATA(nodeid),
+					 bootmap >> PAGE_SHIFT,
+					 start_pfn, end_pfn);
+	printk(KERN_INFO "  node %d low ram: %08lx - %08lx\n",
+		nodeid, start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
+	printk(KERN_INFO "  node %d bootmap %08lx - %08lx\n",
+		 nodeid, bootmap, bootmap + bootmap_size);
+	free_bootmem_with_active_regions(nodeid, end_pfn);
+	early_res_to_bootmem(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
+
+	return bootmap + bootmap_size;
+}
+#endif
+
 void __init setup_bootmem_allocator(void)
 {
-	int i;
+	int nodeid;
 	unsigned long bootmap_size, bootmap;
 	/*
 	 * Initialize the boot-time allocator (with low memory only):
@@ -829,18 +857,24 @@ void __init setup_bootmem_allocator(void
 		panic("Cannot find bootmem map of size %ld\n", bootmap_size);
 	reserve_early(bootmap, bootmap + bootmap_size, "BOOTMAP");
 
-	/* don't touch min_low_pfn */
-	bootmap_size = init_bootmem_node(NODE_DATA(0), bootmap >> PAGE_SHIFT,
-					 min_low_pfn, max_low_pfn);
 	printk(KERN_INFO "  mapped low ram: 0 - %08lx\n",
 		 max_pfn_mapped<<PAGE_SHIFT);
 	printk(KERN_INFO "  low ram: %08lx - %08lx\n",
 		 min_low_pfn<<PAGE_SHIFT, max_low_pfn<<PAGE_SHIFT);
+
+#ifdef CONFIG_NEED_MULTIPLE_NODES
+	for_each_online_node(nodeid)
+		bootmap = setup_node_bootmem(nodeid, node_start_pfn[nodeid],
+					node_end_pfn[nodeid], bootmap);
+#else
+	/* don't touch min_low_pfn */
+	bootmap_size = init_bootmem_node(NODE_DATA(0), bootmap >> PAGE_SHIFT,
+					 min_low_pfn, max_low_pfn);
 	printk(KERN_INFO "  bootmap %08lx - %08lx\n",
 		 bootmap, bootmap + bootmap_size);
-	for_each_online_node(i)
-		free_bootmem_with_active_regions(i, max_low_pfn);
+	free_bootmem_with_active_regions(0, max_low_pfn);
 	early_res_to_bootmem(0, max_low_pfn<<PAGE_SHIFT);
+#endif
 
 	after_init_bootmem = 1;
 }
Index: linux-2.6/arch/x86/mm/numa_32.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/numa_32.c
+++ linux-2.6/arch/x86/mm/numa_32.c
@@ -416,10 +416,11 @@ void __init initmem_init(unsigned long s
 	for_each_online_node(nid)
 		propagate_e820_map_node(nid);
 
-	for_each_online_node(nid)
+	for_each_online_node(nid) {
 		memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
+		NODE_DATA(nid)->bdata = &bootmem_node_data[nid];
+	}
 
-	NODE_DATA(0)->bdata = &bootmem_node_data[0];
 	setup_bootmem_allocator();
 }
 

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

end of thread, other threads:[~2009-03-09  6:59 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-04  9:22 [PATCH] x86: fix bootmem cross node for 32bit numa Yinghai Lu
2009-03-04  9:24 ` [PATCH] x86: make 32bit init_memory_mapping range change more like 64bit Yinghai Lu
2009-03-04  9:51   ` Pekka Enberg
2009-03-04 20:00   ` [tip:x86/mm] x86: make 32-bit init_memory_mapping range change more like 64-bit Yinghai Lu
2009-03-04  9:25 ` [PATCH] x86: ioremap mptable Yinghai Lu
2009-03-04  9:25   ` [PATCH] x86: reserve exact size of mptable Yinghai Lu
2009-03-04 19:51     ` Ingo Molnar
2009-03-04 20:01     ` [tip:x86/mm] " Yinghai Lu
2009-03-04 19:50   ` [PATCH] x86: ioremap mptable Ingo Molnar
2009-03-04 20:29     ` Yinghai Lu
2009-03-04 21:06       ` Ingo Molnar
2009-03-04 20:00   ` [tip:x86/mm] " Yinghai Lu
2009-03-04 18:08 ` [PATCH] x86: fix bootmem cross node for 32bit numa -v2 Yinghai Lu
2009-03-04 19:58   ` Ingo Molnar
2009-03-04 20:21     ` Yinghai Lu
2009-03-04 21:12       ` [tip:x86/mm] x86: fix bootmem cross node for 32bit numa, cleanup Yinghai Lu
2009-03-04 20:00 ` [tip:x86/mm] x86: fix bootmem cross node for 32bit numa Yinghai Lu
2009-03-08 23:16   ` Yinghai Lu
2009-03-09  6:58     ` Ingo Molnar

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