All of lore.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


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

* [PATCH] x86: make 32bit init_memory_mapping range change more like 64bit
  2009-03-04  9:22 [PATCH] x86: fix bootmem cross node for 32bit numa Yinghai Lu
@ 2009-03-04  9:24 ` 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
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 19+ messages in thread
From: Yinghai Lu @ 2009-03-04  9:24 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton; +Cc: linux-kernel


Impact: clean up

make code more readable and more like 64bit

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

---
 arch/x86/mm/init_32.c |  126 +++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 94 insertions(+), 32 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
@@ -889,29 +889,55 @@ static void __init find_early_table_spac
 		(table_start << PAGE_SHIFT) + tables);
 }
 
+struct map_range {
+	unsigned long start;
+	unsigned long end;
+	unsigned page_size_mask;
+};
+
+#define NR_RANGE_MR 3
+
+static int save_mr(struct map_range *mr, int nr_range,
+		   unsigned long start_pfn, unsigned long end_pfn,
+		   unsigned long page_size_mask)
+{
+	if (start_pfn < end_pfn) {
+		if (nr_range >= NR_RANGE_MR)
+			panic("run out of range for init_memory_mapping\n");
+		mr[nr_range].start = start_pfn<<PAGE_SHIFT;
+		mr[nr_range].end   = end_pfn<<PAGE_SHIFT;
+		mr[nr_range].page_size_mask = page_size_mask;
+		nr_range++;
+	}
+
+	return nr_range;
+}
+
 unsigned long __init_refok init_memory_mapping(unsigned long start,
 						unsigned long end)
 {
 	pgd_t *pgd_base = swapper_pg_dir;
+	unsigned long page_size_mask = 0;
 	unsigned long start_pfn, end_pfn;
-	unsigned long big_page_start;
+	unsigned long pos;
+
+	struct map_range mr[NR_RANGE_MR];
+	int nr_range, i;
+	int use_pse;
+
+	printk(KERN_INFO "init_memory_mapping: %08lx-%08lx\n", start, end);
+
 #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KMEMCHECK)
 	/*
 	 * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages.
 	 * This will simplify cpa(), which otherwise needs to support splitting
 	 * large pages into small in interrupt context, etc.
 	 */
-	int use_pse = 0;
+	use_pse = 0;
 #else
-	int use_pse = cpu_has_pse;
+	use_pse = cpu_has_pse;
 #endif
 
-	/*
-	 * Find space for the kernel direct mapping tables.
-	 */
-	if (!after_init_bootmem)
-		find_early_table_space(end, use_pse);
-
 #ifdef CONFIG_X86_PAE
 	set_nx();
 	if (nx_enabled)
@@ -928,45 +954,81 @@ unsigned long __init_refok init_memory_m
 		__supported_pte_mask |= _PAGE_GLOBAL;
 	}
 
+	memset(mr, 0, sizeof(mr));
+	nr_range = 0;
+
+	if (use_pse)
+		page_size_mask |= 1 << PG_LEVEL_2M;
+
 	/*
 	 * Don't use a large page for the first 2/4MB of memory
 	 * because there are often fixed size MTRRs in there
 	 * and overlapping MTRRs into large pages can cause
 	 * slowdowns.
 	 */
-	big_page_start = PMD_SIZE;
-
-	if (start < big_page_start) {
-		start_pfn = start >> PAGE_SHIFT;
-		end_pfn = min(big_page_start>>PAGE_SHIFT, end>>PAGE_SHIFT);
-	} else {
-		/* head is not big page alignment ? */
-		start_pfn = start >> PAGE_SHIFT;
-		end_pfn = ((start + (PMD_SIZE - 1))>>PMD_SHIFT)
+	/* head could not be big page alignment ? */
+	start_pfn = start >> PAGE_SHIFT;
+	pos = start_pfn << PAGE_SHIFT;
+	if (pos == 0)
+		end_pfn = 1<<(PMD_SHIFT - PAGE_SHIFT);
+	else
+		end_pfn = ((pos + (PMD_SIZE - 1))>>PMD_SHIFT)
 				 << (PMD_SHIFT - PAGE_SHIFT);
+	if (end_pfn > (end>>PAGE_SHIFT))
+		end_pfn = end>>PAGE_SHIFT;
+	if (start_pfn < end_pfn) {
+		nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
+		pos = end_pfn << PAGE_SHIFT;
 	}
-	if (start_pfn < end_pfn)
-		kernel_physical_mapping_init(pgd_base, start_pfn, end_pfn, 0);
 
 	/* big page range */
-	start_pfn = ((start + (PMD_SIZE - 1))>>PMD_SHIFT)
+	start_pfn = ((pos + (PMD_SIZE - 1))>>PMD_SHIFT)
 			 << (PMD_SHIFT - PAGE_SHIFT);
-	if (start_pfn < (big_page_start >> PAGE_SHIFT))
-		start_pfn =  big_page_start >> PAGE_SHIFT;
 	end_pfn = (end>>PMD_SHIFT) << (PMD_SHIFT - PAGE_SHIFT);
-	if (start_pfn < end_pfn)
-		kernel_physical_mapping_init(pgd_base, start_pfn, end_pfn,
-					     use_pse);
+	if (start_pfn < end_pfn) {
+		nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
+				page_size_mask & (1<<PG_LEVEL_2M));
+		pos = end_pfn << PAGE_SHIFT;
+	}
 
 	/* tail is not big page alignment ? */
-	start_pfn = end_pfn;
-	if (start_pfn > (big_page_start>>PAGE_SHIFT)) {
-		end_pfn = end >> PAGE_SHIFT;
-		if (start_pfn < end_pfn)
-			kernel_physical_mapping_init(pgd_base, start_pfn,
-							 end_pfn, 0);
+	start_pfn = pos>>PAGE_SHIFT;
+	end_pfn = end>>PAGE_SHIFT;
+	if (start_pfn < end_pfn)
+		nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
+
+	/* try to merge same page size and continuous */
+	for (i = 0; nr_range > 1 && i < nr_range - 1; i++) {
+		unsigned long old_start;
+		if (mr[i].end != mr[i+1].start ||
+		    mr[i].page_size_mask != mr[i+1].page_size_mask)
+			continue;
+		/* move it */
+		old_start = mr[i].start;
+		memmove(&mr[i], &mr[i+1],
+			(nr_range - 1 - i) * sizeof(struct map_range));
+		mr[i--].start = old_start;
+		nr_range--;
 	}
 
+	for (i = 0; i < nr_range; i++)
+		printk(KERN_DEBUG " %08lx - %08lx page %s\n",
+			mr[i].start, mr[i].end,
+			(mr[i].page_size_mask & (1<<PG_LEVEL_2M)) ?
+				  "big page" : "4k");
+
+	/*
+	 * Find space for the kernel direct mapping tables.
+	 */
+	if (!after_init_bootmem)
+		find_early_table_space(end, use_pse);
+
+	for (i = 0; i < nr_range; i++)
+		kernel_physical_mapping_init(pgd_base,
+				mr[i].start >> PAGE_SHIFT,
+				mr[i].end >> PAGE_SHIFT,
+				mr[i].page_size_mask == (1<<PG_LEVEL_2M));
+
 	early_ioremap_page_table_range_init(pgd_base);
 
 	load_cr3(swapper_pg_dir);

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

* [PATCH] x86: ioremap mptable
  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:25 ` Yinghai Lu
  2009-03-04  9:25   ` [PATCH] x86: reserve exact size of mptable Yinghai Lu
                     ` (2 more replies)
  2009-03-04 18:08 ` [PATCH] x86: fix bootmem cross node for 32bit numa -v2 Yinghai Lu
  2009-03-04 20:00 ` [tip:x86/mm] x86: fix bootmem cross node for 32bit numa Yinghai Lu
  3 siblings, 3 replies; 19+ messages in thread
From: Yinghai Lu @ 2009-03-04  9:25 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton; +Cc: linux-kernel


Impact: fix boot with mptable above max_low_mapped

try to use early_ioremap to map mpc to make sure it works even it is
at end of ram on system.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Reported-and-tested-by: Kevin O'Connor <kevin@koconnor.net>

---
 arch/x86/kernel/mpparse.c |   26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

Index: linux-2.6/arch/x86/kernel/mpparse.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/mpparse.c
+++ linux-2.6/arch/x86/kernel/mpparse.c
@@ -558,6 +558,19 @@ static inline void __init construct_defa
 
 static struct mpf_intel *mpf_found;
 
+static unsigned long __init get_mpc_size(unsigned long physptr)
+{
+	struct mpc_table *mpc;
+	unsigned long size;
+
+	mpc = early_ioremap(physptr, PAGE_SIZE);
+	size = mpc->length;
+	early_iounmap(mpc, PAGE_SIZE);
+	apic_printk(APIC_VERBOSE, "  mpc: %lx-%lx\n", physptr, physptr + size);
+
+	return size;
+}
+
 /*
  * Scan the memory blocks for an SMP configuration block.
  */
@@ -611,12 +624,16 @@ static void __init __get_smp_config(unsi
 		construct_default_ISA_mptable(mpf->feature1);
 
 	} else if (mpf->physptr) {
+		struct mpc_table *mpc;
+		unsigned long size;
 
+		size = get_mpc_size(mpf->physptr);
+		mpc = early_ioremap(mpf->physptr, size);
 		/*
 		 * Read the physical hardware table.  Anything here will
 		 * override the defaults.
 		 */
-		if (!smp_read_mpc(phys_to_virt(mpf->physptr), early)) {
+		if (!smp_read_mpc(mpc, early)) {
 #ifdef CONFIG_X86_LOCAL_APIC
 			smp_found_config = 0;
 #endif
@@ -624,8 +641,10 @@ static void __init __get_smp_config(unsi
 			       "BIOS bug, MP table errors detected!...\n");
 			printk(KERN_ERR "... disabling SMP support. "
 			       "(tell your hw vendor)\n");
+			early_iounmap(mpc, size);
 			return;
 		}
+		early_iounmap(mpc, size);
 
 		if (early)
 			return;

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

* [PATCH] x86: reserve exact size of mptable
  2009-03-04  9:25 ` [PATCH] x86: ioremap mptable Yinghai Lu
@ 2009-03-04  9:25   ` 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:00   ` [tip:x86/mm] " Yinghai Lu
  2 siblings, 2 replies; 19+ messages in thread
From: Yinghai Lu @ 2009-03-04  9:25 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton; +Cc: linux-kernel


Impact: cleanup

get the exact size for reserve_bootmem

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

---
 arch/x86/kernel/mpparse.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/arch/x86/kernel/mpparse.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/mpparse.c
+++ linux-2.6/arch/x86/kernel/mpparse.c
@@ -716,10 +716,10 @@ static int __init smp_scan_config(unsign
 
 			if (!reserve)
 				return 1;
-			reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE,
+			reserve_bootmem_generic(virt_to_phys(mpf), sizeof(*mpf),
 					BOOTMEM_DEFAULT);
 			if (mpf->physptr) {
-				unsigned long size = PAGE_SIZE;
+				unsigned long size = get_mpc_size(mpf->physptr);
 #ifdef CONFIG_X86_32
 				/*
 				 * We cannot access to MPC table to compute

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

* Re: [PATCH] x86: make 32bit init_memory_mapping range change more  like 64bit
  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
  1 sibling, 0 replies; 19+ messages in thread
From: Pekka Enberg @ 2009-03-04  9:51 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton,
	linux-kernel

On Wed, Mar 4, 2009 at 11:24 AM, Yinghai Lu <yinghai@kernel.org> wrote:
>
> Impact: clean up
>
> make code more readable and more like 64bit
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>

This is a nice step towards unifying 32-bit and 64-bit
init_memory_mapping() implementations!

Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>

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

* [PATCH] x86: fix bootmem cross node for 32bit numa -v2
  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:25 ` [PATCH] x86: ioremap mptable Yinghai Lu
@ 2009-03-04 18:08 ` Yinghai Lu
  2009-03-04 19:58   ` Ingo Molnar
  2009-03-04 20:00 ` [tip:x86/mm] x86: fix bootmem cross node for 32bit numa Yinghai Lu
  3 siblings, 1 reply; 19+ messages in thread
From: Yinghai Lu @ 2009-03-04 18:08 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton; +Cc: linux-kernel


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
v2: simplify the code


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

---
 arch/x86/mm/init_32.c |   50 +++++++++++++++++++++++++++++++++++++-------------
 arch/x86/mm/numa_32.c |    5 +++--
 2 files changed, 40 insertions(+), 15 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
@@ -793,33 +793,57 @@ static void __init zone_sizes_init(void)
 	free_area_init_nodes(max_zone_pfns);
 }
 
+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;
+}
+
 void __init setup_bootmem_allocator(void)
 {
-	int i;
+	int nodeid;
 	unsigned long bootmap_size, bootmap;
 	/*
 	 * Initialize the boot-time allocator (with low memory only):
 	 */
 	bootmap_size = bootmem_bootmap_pages(max_low_pfn)<<PAGE_SHIFT;
-	bootmap = find_e820_area(min_low_pfn<<PAGE_SHIFT,
-				 max_pfn_mapped<<PAGE_SHIFT, bootmap_size,
+	bootmap = find_e820_area(0, max_pfn_mapped<<PAGE_SHIFT, bootmap_size,
 				 PAGE_SIZE);
 	if (bootmap == -1L)
 		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);
-	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);
-	early_res_to_bootmem(0, max_low_pfn<<PAGE_SHIFT);
+	printk(KERN_INFO "  low ram: 0 - %08lx\n", 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
+	bootmap = setup_node_bootmem(0, 0, max_low_pfn, bootmap);
+#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

* Re: [PATCH] x86: ioremap mptable
  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:50   ` Ingo Molnar
  2009-03-04 20:29     ` Yinghai Lu
  2009-03-04 20:00   ` [tip:x86/mm] " Yinghai Lu
  2 siblings, 1 reply; 19+ messages in thread
From: Ingo Molnar @ 2009-03-04 19:50 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton, linux-kernel


* Yinghai Lu <yinghai@kernel.org> wrote:

> 
> Impact: fix boot with mptable above max_low_mapped
> 
> try to use early_ioremap to map mpc to make sure it works even it is
> at end of ram on system.
> 
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> Reported-and-tested-by: Kevin O'Connor <kevin@koconnor.net>
> 
> ---
>  arch/x86/kernel/mpparse.c |   26 +++++++++++++++++++++++---
>  1 file changed, 23 insertions(+), 3 deletions(-)
> 
> Index: linux-2.6/arch/x86/kernel/mpparse.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/mpparse.c
> +++ linux-2.6/arch/x86/kernel/mpparse.c
> @@ -558,6 +558,19 @@ static inline void __init construct_defa
>  
>  static struct mpf_intel *mpf_found;
>  
> +static unsigned long __init get_mpc_size(unsigned long physptr)
> +{
> +	struct mpc_table *mpc;
> +	unsigned long size;
> +
> +	mpc = early_ioremap(physptr, PAGE_SIZE);
> +	size = mpc->length;
> +	early_iounmap(mpc, PAGE_SIZE);
> +	apic_printk(APIC_VERBOSE, "  mpc: %lx-%lx\n", physptr, physptr + size);
> +
> +	return size;
> +}
> +
>  /*
>   * Scan the memory blocks for an SMP configuration block.
>   */
> @@ -611,12 +624,16 @@ static void __init __get_smp_config(unsi
>  		construct_default_ISA_mptable(mpf->feature1);
>  
>  	} else if (mpf->physptr) {
> +		struct mpc_table *mpc;
> +		unsigned long size;
>  
> +		size = get_mpc_size(mpf->physptr);
> +		mpc = early_ioremap(mpf->physptr, size);
>  		/*
>  		 * Read the physical hardware table.  Anything here will
>  		 * override the defaults.
>  		 */
> -		if (!smp_read_mpc(phys_to_virt(mpf->physptr), early)) {
> +		if (!smp_read_mpc(mpc, early)) {
>  #ifdef CONFIG_X86_LOCAL_APIC
>  			smp_found_config = 0;
>  #endif
> @@ -624,8 +641,10 @@ static void __init __get_smp_config(unsi
>  			       "BIOS bug, MP table errors detected!...\n");
>  			printk(KERN_ERR "... disabling SMP support. "
>  			       "(tell your hw vendor)\n");
> +			early_iounmap(mpc, size);
>  			return;
>  		}
> +		early_iounmap(mpc, size);
>  
>  		if (early)
>  			return;

the whole "else if" branch here:

 	} else if (mpf->physptr) {

should move into a helper function, not just get_mpc_size().

	Ingo

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

* Re: [PATCH] x86: reserve exact size of mptable
  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
  1 sibling, 0 replies; 19+ messages in thread
From: Ingo Molnar @ 2009-03-04 19:51 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton, linux-kernel


* Yinghai Lu <yinghai@kernel.org> wrote:

> 
> Impact: cleanup
> 
> get the exact size for reserve_bootmem
> 
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> 
> ---
>  arch/x86/kernel/mpparse.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6/arch/x86/kernel/mpparse.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/mpparse.c
> +++ linux-2.6/arch/x86/kernel/mpparse.c
> @@ -716,10 +716,10 @@ static int __init smp_scan_config(unsign
>  
>  			if (!reserve)
>  				return 1;
> -			reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE,
> +			reserve_bootmem_generic(virt_to_phys(mpf), sizeof(*mpf),
>  					BOOTMEM_DEFAULT);
>  			if (mpf->physptr) {
> -				unsigned long size = PAGE_SIZE;
> +				unsigned long size = get_mpc_size(mpf->physptr);

I see we use get_mpc_size() here - that function can stay too.

	Ingo

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

* Re: [PATCH] x86: fix bootmem cross node for 32bit numa -v2
  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
  0 siblings, 1 reply; 19+ messages in thread
From: Ingo Molnar @ 2009-03-04 19:58 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton, linux-kernel


* Yinghai Lu <yinghai@kernel.org> wrote:

> 
> 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
> v2: simplify the code

i've already applied v1 - mind sending the simplification as a 
delta patch? Thanks.

	Ingo

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

* [tip:x86/mm] x86: fix bootmem cross node for 32bit numa
  2009-03-04  9:22 [PATCH] x86: fix bootmem cross node for 32bit numa Yinghai Lu
                   ` (2 preceding siblings ...)
  2009-03-04 18:08 ` [PATCH] x86: fix bootmem cross node for 32bit numa -v2 Yinghai Lu
@ 2009-03-04 20:00 ` Yinghai Lu
  2009-03-08 23:16   ` Yinghai Lu
  3 siblings, 1 reply; 19+ messages in thread
From: Yinghai Lu @ 2009-03-04 20:00 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, yinghai, akpm, tglx, mingo

Commit-ID:  a71edd1f46c8a599509bda478fb4eea27fb0da63
Gitweb:     http://git.kernel.org/tip/a71edd1f46c8a599509bda478fb4eea27fb0da63
Author:     "Yinghai Lu" <yinghai@kernel.org>
AuthorDate: Wed, 4 Mar 2009 01:22:35 -0800
Commit:     Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 4 Mar 2009 20:55:03 +0100

x86: fix bootmem cross node for 32bit numa

Impact: fix panic on system 2g x4 sockets

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

So try to have numa version of setup_bootmem_allocator().

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <49AE485B.8000902@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


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

diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 917c4e6..67bdb59 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -776,9 +776,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):
@@ -791,18 +819,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;
 }
diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c
index 451fe95..3daefa0 100644
--- a/arch/x86/mm/numa_32.c
+++ b/arch/x86/mm/numa_32.c
@@ -416,10 +416,11 @@ void __init initmem_init(unsigned long start_pfn,
 	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 related	[flat|nested] 19+ messages in thread

* [tip:x86/mm] x86: make 32-bit init_memory_mapping range change more like 64-bit
  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   ` Yinghai Lu
  1 sibling, 0 replies; 19+ messages in thread
From: Yinghai Lu @ 2009-03-04 20:00 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, yinghai, akpm, tglx, mingo

Commit-ID:  b68adb16f29c8ea02f21f5ebf65bcabffe217e9f
Gitweb:     http://git.kernel.org/tip/b68adb16f29c8ea02f21f5ebf65bcabffe217e9f
Author:     "Yinghai Lu" <yinghai@kernel.org>
AuthorDate: Wed, 4 Mar 2009 01:24:04 -0800
Commit:     Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 4 Mar 2009 20:55:03 +0100

x86: make 32-bit init_memory_mapping range change more like 64-bit

Impact: cleanup

make code more readable and more like 64-bit

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <49AE48B4.8010907@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/mm/init_32.c |  126 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 94 insertions(+), 32 deletions(-)

diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 67bdb59..37aeaf3 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -885,29 +885,55 @@ static void __init find_early_table_space(unsigned long end, int use_pse)
 		(table_start << PAGE_SHIFT) + tables);
 }
 
+struct map_range {
+	unsigned long start;
+	unsigned long end;
+	unsigned page_size_mask;
+};
+
+#define NR_RANGE_MR 3
+
+static int save_mr(struct map_range *mr, int nr_range,
+		   unsigned long start_pfn, unsigned long end_pfn,
+		   unsigned long page_size_mask)
+{
+	if (start_pfn < end_pfn) {
+		if (nr_range >= NR_RANGE_MR)
+			panic("run out of range for init_memory_mapping\n");
+		mr[nr_range].start = start_pfn<<PAGE_SHIFT;
+		mr[nr_range].end   = end_pfn<<PAGE_SHIFT;
+		mr[nr_range].page_size_mask = page_size_mask;
+		nr_range++;
+	}
+
+	return nr_range;
+}
+
 unsigned long __init_refok init_memory_mapping(unsigned long start,
 						unsigned long end)
 {
 	pgd_t *pgd_base = swapper_pg_dir;
+	unsigned long page_size_mask = 0;
 	unsigned long start_pfn, end_pfn;
-	unsigned long big_page_start;
+	unsigned long pos;
+
+	struct map_range mr[NR_RANGE_MR];
+	int nr_range, i;
+	int use_pse;
+
+	printk(KERN_INFO "init_memory_mapping: %08lx-%08lx\n", start, end);
+
 #ifdef CONFIG_DEBUG_PAGEALLOC
 	/*
 	 * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages.
 	 * This will simplify cpa(), which otherwise needs to support splitting
 	 * large pages into small in interrupt context, etc.
 	 */
-	int use_pse = 0;
+	use_pse = 0;
 #else
-	int use_pse = cpu_has_pse;
+	use_pse = cpu_has_pse;
 #endif
 
-	/*
-	 * Find space for the kernel direct mapping tables.
-	 */
-	if (!after_init_bootmem)
-		find_early_table_space(end, use_pse);
-
 #ifdef CONFIG_X86_PAE
 	set_nx();
 	if (nx_enabled)
@@ -924,45 +950,81 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
 		__supported_pte_mask |= _PAGE_GLOBAL;
 	}
 
+	memset(mr, 0, sizeof(mr));
+	nr_range = 0;
+
+	if (use_pse)
+		page_size_mask |= 1 << PG_LEVEL_2M;
+
 	/*
 	 * Don't use a large page for the first 2/4MB of memory
 	 * because there are often fixed size MTRRs in there
 	 * and overlapping MTRRs into large pages can cause
 	 * slowdowns.
 	 */
-	big_page_start = PMD_SIZE;
-
-	if (start < big_page_start) {
-		start_pfn = start >> PAGE_SHIFT;
-		end_pfn = min(big_page_start>>PAGE_SHIFT, end>>PAGE_SHIFT);
-	} else {
-		/* head is not big page alignment ? */
-		start_pfn = start >> PAGE_SHIFT;
-		end_pfn = ((start + (PMD_SIZE - 1))>>PMD_SHIFT)
+	/* head could not be big page alignment ? */
+	start_pfn = start >> PAGE_SHIFT;
+	pos = start_pfn << PAGE_SHIFT;
+	if (pos == 0)
+		end_pfn = 1<<(PMD_SHIFT - PAGE_SHIFT);
+	else
+		end_pfn = ((pos + (PMD_SIZE - 1))>>PMD_SHIFT)
 				 << (PMD_SHIFT - PAGE_SHIFT);
+	if (end_pfn > (end>>PAGE_SHIFT))
+		end_pfn = end>>PAGE_SHIFT;
+	if (start_pfn < end_pfn) {
+		nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
+		pos = end_pfn << PAGE_SHIFT;
 	}
-	if (start_pfn < end_pfn)
-		kernel_physical_mapping_init(pgd_base, start_pfn, end_pfn, 0);
 
 	/* big page range */
-	start_pfn = ((start + (PMD_SIZE - 1))>>PMD_SHIFT)
+	start_pfn = ((pos + (PMD_SIZE - 1))>>PMD_SHIFT)
 			 << (PMD_SHIFT - PAGE_SHIFT);
-	if (start_pfn < (big_page_start >> PAGE_SHIFT))
-		start_pfn =  big_page_start >> PAGE_SHIFT;
 	end_pfn = (end>>PMD_SHIFT) << (PMD_SHIFT - PAGE_SHIFT);
-	if (start_pfn < end_pfn)
-		kernel_physical_mapping_init(pgd_base, start_pfn, end_pfn,
-					     use_pse);
+	if (start_pfn < end_pfn) {
+		nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
+				page_size_mask & (1<<PG_LEVEL_2M));
+		pos = end_pfn << PAGE_SHIFT;
+	}
 
 	/* tail is not big page alignment ? */
-	start_pfn = end_pfn;
-	if (start_pfn > (big_page_start>>PAGE_SHIFT)) {
-		end_pfn = end >> PAGE_SHIFT;
-		if (start_pfn < end_pfn)
-			kernel_physical_mapping_init(pgd_base, start_pfn,
-							 end_pfn, 0);
+	start_pfn = pos>>PAGE_SHIFT;
+	end_pfn = end>>PAGE_SHIFT;
+	if (start_pfn < end_pfn)
+		nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
+
+	/* try to merge same page size and continuous */
+	for (i = 0; nr_range > 1 && i < nr_range - 1; i++) {
+		unsigned long old_start;
+		if (mr[i].end != mr[i+1].start ||
+		    mr[i].page_size_mask != mr[i+1].page_size_mask)
+			continue;
+		/* move it */
+		old_start = mr[i].start;
+		memmove(&mr[i], &mr[i+1],
+			(nr_range - 1 - i) * sizeof(struct map_range));
+		mr[i--].start = old_start;
+		nr_range--;
 	}
 
+	for (i = 0; i < nr_range; i++)
+		printk(KERN_DEBUG " %08lx - %08lx page %s\n",
+			mr[i].start, mr[i].end,
+			(mr[i].page_size_mask & (1<<PG_LEVEL_2M)) ?
+				  "big page" : "4k");
+
+	/*
+	 * Find space for the kernel direct mapping tables.
+	 */
+	if (!after_init_bootmem)
+		find_early_table_space(end, use_pse);
+
+	for (i = 0; i < nr_range; i++)
+		kernel_physical_mapping_init(pgd_base,
+				mr[i].start >> PAGE_SHIFT,
+				mr[i].end >> PAGE_SHIFT,
+				mr[i].page_size_mask == (1<<PG_LEVEL_2M));
+
 	early_ioremap_page_table_range_init(pgd_base);
 
 	load_cr3(swapper_pg_dir);

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

* [tip:x86/mm] x86: ioremap mptable
  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:50   ` [PATCH] x86: ioremap mptable Ingo Molnar
@ 2009-03-04 20:00   ` Yinghai Lu
  2 siblings, 0 replies; 19+ messages in thread
From: Yinghai Lu @ 2009-03-04 20:00 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, yinghai, akpm, kevin, tglx, mingo

Commit-ID:  8d4dd919b46ed982da6ef6bf6fcec454cd7a5b1b
Gitweb:     http://git.kernel.org/tip/8d4dd919b46ed982da6ef6bf6fcec454cd7a5b1b
Author:     "Yinghai Lu" <yinghai@kernel.org>
AuthorDate: Wed, 4 Mar 2009 01:25:21 -0800
Commit:     Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 4 Mar 2009 20:55:04 +0100

x86: ioremap mptable

Impact: fix boot with mptable above max_low_mapped

Try to use early_ioremap() to map MPC to make sure it works even it is
at the end of ram.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <49AE4901.3090801@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Reported-and-tested-by: Kevin O'Connor <kevin@koconnor.net>


---
 arch/x86/kernel/mpparse.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index 37cb1bd..ae9060c 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -558,6 +558,19 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type)
 
 static struct mpf_intel *mpf_found;
 
+static unsigned long __init get_mpc_size(unsigned long physptr)
+{
+	struct mpc_table *mpc;
+	unsigned long size;
+
+	mpc = early_ioremap(physptr, PAGE_SIZE);
+	size = mpc->length;
+	early_iounmap(mpc, PAGE_SIZE);
+	apic_printk(APIC_VERBOSE, "  mpc: %lx-%lx\n", physptr, physptr + size);
+
+	return size;
+}
+
 /*
  * Scan the memory blocks for an SMP configuration block.
  */
@@ -611,12 +624,16 @@ static void __init __get_smp_config(unsigned int early)
 		construct_default_ISA_mptable(mpf->feature1);
 
 	} else if (mpf->physptr) {
+		struct mpc_table *mpc;
+		unsigned long size;
 
+		size = get_mpc_size(mpf->physptr);
+		mpc = early_ioremap(mpf->physptr, size);
 		/*
 		 * Read the physical hardware table.  Anything here will
 		 * override the defaults.
 		 */
-		if (!smp_read_mpc(phys_to_virt(mpf->physptr), early)) {
+		if (!smp_read_mpc(mpc, early)) {
 #ifdef CONFIG_X86_LOCAL_APIC
 			smp_found_config = 0;
 #endif
@@ -624,8 +641,10 @@ static void __init __get_smp_config(unsigned int early)
 			       "BIOS bug, MP table errors detected!...\n");
 			printk(KERN_ERR "... disabling SMP support. "
 			       "(tell your hw vendor)\n");
+			early_iounmap(mpc, size);
 			return;
 		}
+		early_iounmap(mpc, size);
 
 		if (early)
 			return;

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

* [tip:x86/mm] x86: reserve exact size of mptable
  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     ` Yinghai Lu
  1 sibling, 0 replies; 19+ messages in thread
From: Yinghai Lu @ 2009-03-04 20:01 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, yinghai, akpm, tglx, mingo

Commit-ID:  f62432395ec54e93f113091bcb2e2017eeed7683
Gitweb:     http://git.kernel.org/tip/f62432395ec54e93f113091bcb2e2017eeed7683
Author:     "Yinghai Lu" <yinghai@kernel.org>
AuthorDate: Wed, 4 Mar 2009 01:25:54 -0800
Commit:     Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 4 Mar 2009 20:55:04 +0100

x86: reserve exact size of mptable

Impact: save a bit of RAM

Get the exact size for the reserve_bootmem() call.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <49AE4922.605@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/mpparse.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index ae9060c..e819240 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -716,10 +716,10 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
 
 			if (!reserve)
 				return 1;
-			reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE,
+			reserve_bootmem_generic(virt_to_phys(mpf), sizeof(*mpf),
 					BOOTMEM_DEFAULT);
 			if (mpf->physptr) {
-				unsigned long size = PAGE_SIZE;
+				unsigned long size = get_mpc_size(mpf->physptr);
 #ifdef CONFIG_X86_32
 				/*
 				 * We cannot access to MPC table to compute

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

* Re: [PATCH] x86: fix bootmem cross node for 32bit numa -v2
  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
  0 siblings, 1 reply; 19+ messages in thread
From: Yinghai Lu @ 2009-03-04 20:21 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton, linux-kernel

Ingo Molnar wrote:
> * Yinghai Lu <yinghai@kernel.org> wrote:
> 
>> 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
>> v2: simplify the code
> 
> i've already applied v1 - mind sending the simplification as a 
> delta patch? Thanks.
> 

please check

[PATCH] x86: fix bootmem cross node for 32bit numa - fixup

Imapct: clean up

simplify the code, reuse some lines.
remove min_low_pfn referring, it is always 0

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

---
 arch/x86/mm/init_32.c |   16 +++-------------
 1 file changed, 3 insertions(+), 13 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
@@ -776,7 +776,6 @@ 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,
@@ -802,7 +801,6 @@ static unsigned long __init setup_node_b
 
 	return bootmap + bootmap_size;
 }
-#endif
 
 void __init setup_bootmem_allocator(void)
 {
@@ -812,8 +810,7 @@ void __init setup_bootmem_allocator(void
 	 * Initialize the boot-time allocator (with low memory only):
 	 */
 	bootmap_size = bootmem_bootmap_pages(max_low_pfn)<<PAGE_SHIFT;
-	bootmap = find_e820_area(min_low_pfn<<PAGE_SHIFT,
-				 max_pfn_mapped<<PAGE_SHIFT, bootmap_size,
+	bootmap = find_e820_area(0, max_pfn_mapped<<PAGE_SHIFT, bootmap_size,
 				 PAGE_SIZE);
 	if (bootmap == -1L)
 		panic("Cannot find bootmem map of size %ld\n", bootmap_size);
@@ -821,21 +818,14 @@ void __init setup_bootmem_allocator(void
 
 	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);
+	printk(KERN_INFO "  low ram: 0 - %08lx\n", 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);
-	free_bootmem_with_active_regions(0, max_low_pfn);
-	early_res_to_bootmem(0, max_low_pfn<<PAGE_SHIFT);
+	bootmap = setup_node_bootmem(0, 0, max_low_pfn, bootmap);
 #endif
 
 	after_init_bootmem = 1;

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

* Re: [PATCH] x86: ioremap mptable
  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
  0 siblings, 1 reply; 19+ messages in thread
From: Yinghai Lu @ 2009-03-04 20:29 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton, linux-kernel

Ingo Molnar wrote:
> * Yinghai Lu <yinghai@kernel.org> wrote:
> 
>> Impact: fix boot with mptable above max_low_mapped
>>
>> try to use early_ioremap to map mpc to make sure it works even it is
>> at end of ram on system.
>>
>> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>> Reported-and-tested-by: Kevin O'Connor <kevin@koconnor.net>
>>
>> ---
>>  arch/x86/kernel/mpparse.c |   26 +++++++++++++++++++++++---
>>  1 file changed, 23 insertions(+), 3 deletions(-)
>>
>> Index: linux-2.6/arch/x86/kernel/mpparse.c
>> ===================================================================
>> --- linux-2.6.orig/arch/x86/kernel/mpparse.c
>> +++ linux-2.6/arch/x86/kernel/mpparse.c
>> @@ -558,6 +558,19 @@ static inline void __init construct_defa
>>  
>>  static struct mpf_intel *mpf_found;
>>  
>> +static unsigned long __init get_mpc_size(unsigned long physptr)
>> +{
>> +	struct mpc_table *mpc;
>> +	unsigned long size;
>> +
>> +	mpc = early_ioremap(physptr, PAGE_SIZE);
>> +	size = mpc->length;
>> +	early_iounmap(mpc, PAGE_SIZE);
>> +	apic_printk(APIC_VERBOSE, "  mpc: %lx-%lx\n", physptr, physptr + size);
>> +
>> +	return size;
>> +}
>> +
>>  /*
>>   * Scan the memory blocks for an SMP configuration block.
>>   */
>> @@ -611,12 +624,16 @@ static void __init __get_smp_config(unsi
>>  		construct_default_ISA_mptable(mpf->feature1);
>>  
>>  	} else if (mpf->physptr) {
>> +		struct mpc_table *mpc;
>> +		unsigned long size;
>>  
>> +		size = get_mpc_size(mpf->physptr);
>> +		mpc = early_ioremap(mpf->physptr, size);
>>  		/*
>>  		 * Read the physical hardware table.  Anything here will
>>  		 * override the defaults.
>>  		 */
>> -		if (!smp_read_mpc(phys_to_virt(mpf->physptr), early)) {
>> +		if (!smp_read_mpc(mpc, early)) {
>>  #ifdef CONFIG_X86_LOCAL_APIC
>>  			smp_found_config = 0;
>>  #endif
>> @@ -624,8 +641,10 @@ static void __init __get_smp_config(unsi
>>  			       "BIOS bug, MP table errors detected!...\n");
>>  			printk(KERN_ERR "... disabling SMP support. "
>>  			       "(tell your hw vendor)\n");
>> +			early_iounmap(mpc, size);
>>  			return;
>>  		}
>> +		early_iounmap(mpc, size);
>>  
>>  		if (early)
>>  			return;
> 
> the whole "else if" branch here:
> 
>  	} else if (mpf->physptr) {
> 
> should move into a helper function, not just get_mpc_size().
> 

will check that.

another solution is change smp_read_mpc interface, let it pass mpf->physptr directly.

YH

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

* Re: [PATCH] x86: ioremap mptable
  2009-03-04 20:29     ` Yinghai Lu
@ 2009-03-04 21:06       ` Ingo Molnar
  0 siblings, 0 replies; 19+ messages in thread
From: Ingo Molnar @ 2009-03-04 21:06 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton, linux-kernel


* Yinghai Lu <yinghai@kernel.org> wrote:

> Ingo Molnar wrote:
> > * Yinghai Lu <yinghai@kernel.org> wrote:
> > 
> >> Impact: fix boot with mptable above max_low_mapped
> >>
> >> try to use early_ioremap to map mpc to make sure it works even it is
> >> at end of ram on system.
> >>
> >> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> >> Reported-and-tested-by: Kevin O'Connor <kevin@koconnor.net>
> >>
> >> ---
> >>  arch/x86/kernel/mpparse.c |   26 +++++++++++++++++++++++---
> >>  1 file changed, 23 insertions(+), 3 deletions(-)
> >>
> >> Index: linux-2.6/arch/x86/kernel/mpparse.c
> >> ===================================================================
> >> --- linux-2.6.orig/arch/x86/kernel/mpparse.c
> >> +++ linux-2.6/arch/x86/kernel/mpparse.c
> >> @@ -558,6 +558,19 @@ static inline void __init construct_defa
> >>  
> >>  static struct mpf_intel *mpf_found;
> >>  
> >> +static unsigned long __init get_mpc_size(unsigned long physptr)
> >> +{
> >> +	struct mpc_table *mpc;
> >> +	unsigned long size;
> >> +
> >> +	mpc = early_ioremap(physptr, PAGE_SIZE);
> >> +	size = mpc->length;
> >> +	early_iounmap(mpc, PAGE_SIZE);
> >> +	apic_printk(APIC_VERBOSE, "  mpc: %lx-%lx\n", physptr, physptr + size);
> >> +
> >> +	return size;
> >> +}
> >> +
> >>  /*
> >>   * Scan the memory blocks for an SMP configuration block.
> >>   */
> >> @@ -611,12 +624,16 @@ static void __init __get_smp_config(unsi
> >>  		construct_default_ISA_mptable(mpf->feature1);
> >>  
> >>  	} else if (mpf->physptr) {
> >> +		struct mpc_table *mpc;
> >> +		unsigned long size;
> >>  
> >> +		size = get_mpc_size(mpf->physptr);
> >> +		mpc = early_ioremap(mpf->physptr, size);
> >>  		/*
> >>  		 * Read the physical hardware table.  Anything here will
> >>  		 * override the defaults.
> >>  		 */
> >> -		if (!smp_read_mpc(phys_to_virt(mpf->physptr), early)) {
> >> +		if (!smp_read_mpc(mpc, early)) {
> >>  #ifdef CONFIG_X86_LOCAL_APIC
> >>  			smp_found_config = 0;
> >>  #endif
> >> @@ -624,8 +641,10 @@ static void __init __get_smp_config(unsi
> >>  			       "BIOS bug, MP table errors detected!...\n");
> >>  			printk(KERN_ERR "... disabling SMP support. "
> >>  			       "(tell your hw vendor)\n");
> >> +			early_iounmap(mpc, size);
> >>  			return;
> >>  		}
> >> +		early_iounmap(mpc, size);
> >>  
> >>  		if (early)
> >>  			return;
> > 
> > the whole "else if" branch here:
> > 
> >  	} else if (mpf->physptr) {
> > 
> > should move into a helper function, not just get_mpc_size().
> > 
> 
> will check that.
> 
> another solution is change smp_read_mpc interface, let it pass 
> mpf->physptr directly.

ok. Please pick the cleaner variant.

	Ingo

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

* [tip:x86/mm] x86: fix bootmem cross node for 32bit numa, cleanup
  2009-03-04 20:21     ` Yinghai Lu
@ 2009-03-04 21:12       ` Yinghai Lu
  0 siblings, 0 replies; 19+ messages in thread
From: Yinghai Lu @ 2009-03-04 21:12 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, yinghai, akpm, tglx, mingo

Commit-ID:  fc5efe3941c47c0278fe1bbcf8cc02a03a74fcda
Gitweb:     http://git.kernel.org/tip/fc5efe3941c47c0278fe1bbcf8cc02a03a74fcda
Author:     "Yinghai Lu" <yinghai@kernel.org>
AuthorDate: Wed, 4 Mar 2009 12:21:24 -0800
Commit:     Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 4 Mar 2009 22:09:59 +0100

x86: fix bootmem cross node for 32bit numa, cleanup

Impact: clean up

Simplify the code, reuse some lines.
Remove min_low_pfn reference, it is always 0

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <49AEE2C4.2030602@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/mm/init_32.c |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index c69c6b1..c351456 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -776,7 +776,6 @@ 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,
@@ -802,7 +801,6 @@ static unsigned long __init setup_node_bootmem(int nodeid,
 
 	return bootmap + bootmap_size;
 }
-#endif
 
 void __init setup_bootmem_allocator(void)
 {
@@ -812,8 +810,7 @@ void __init setup_bootmem_allocator(void)
 	 * Initialize the boot-time allocator (with low memory only):
 	 */
 	bootmap_size = bootmem_bootmap_pages(max_low_pfn)<<PAGE_SHIFT;
-	bootmap = find_e820_area(min_low_pfn<<PAGE_SHIFT,
-				 max_pfn_mapped<<PAGE_SHIFT, bootmap_size,
+	bootmap = find_e820_area(0, max_pfn_mapped<<PAGE_SHIFT, bootmap_size,
 				 PAGE_SIZE);
 	if (bootmap == -1L)
 		panic("Cannot find bootmem map of size %ld\n", bootmap_size);
@@ -821,21 +818,14 @@ void __init setup_bootmem_allocator(void)
 
 	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);
+	printk(KERN_INFO "  low ram: 0 - %08lx\n", 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);
-	free_bootmem_with_active_regions(0, max_low_pfn);
-	early_res_to_bootmem(0, max_low_pfn<<PAGE_SHIFT);
+	bootmap = setup_node_bootmem(0, 0, max_low_pfn, bootmap);
 #endif
 
 	after_init_bootmem = 1;

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

* Re: [tip:x86/mm] x86: fix bootmem cross node for 32bit numa
  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
  0 siblings, 1 reply; 19+ messages in thread
From: Yinghai Lu @ 2009-03-08 23:16 UTC (permalink / raw)
  To: linux-tip-commits, Ingo Molnar, Greg KH
  Cc: linux-kernel, hpa, mingo, yinghai, akpm, tglx, stable

we may need this one (and two followings one)  to be applied for
stable with 2.6.27, 2.6.28, 2.6.29.

YH

On Wed, Mar 4, 2009 at 1:00 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> Commit-ID:  a71edd1f46c8a599509bda478fb4eea27fb0da63
> Gitweb:     http://git.kernel.org/tip/a71edd1f46c8a599509bda478fb4eea27fb0da63
> Author:     "Yinghai Lu" <yinghai@kernel.org>
> AuthorDate: Wed, 4 Mar 2009 01:22:35 -0800
> Commit:     Ingo Molnar <mingo@elte.hu>
> CommitDate: Wed, 4 Mar 2009 20:55:03 +0100
>
> x86: fix bootmem cross node for 32bit numa
>
> Impact: fix panic on system 2g x4 sockets
>
> Found one system with 4 sockets and every sockets has 2g can not boot
> with numa32 because boot mem is crossing nodes.
>
> So try to have numa version of setup_bootmem_allocator().
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> LKML-Reference: <49AE485B.8000902@kernel.org>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
>
>
> ---
>  arch/x86/mm/init_32.c |   46 ++++++++++++++++++++++++++++++++++++++++------
>  arch/x86/mm/numa_32.c |    5 +++--
>  2 files changed, 43 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
> index 917c4e6..67bdb59 100644
> --- a/arch/x86/mm/init_32.c
> +++ b/arch/x86/mm/init_32.c
> @@ -776,9 +776,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):
> @@ -791,18 +819,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;
>  }
> diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c
> index 451fe95..3daefa0 100644
> --- a/arch/x86/mm/numa_32.c
> +++ b/arch/x86/mm/numa_32.c
> @@ -416,10 +416,11 @@ void __init initmem_init(unsigned long start_pfn,
>        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();
>  }
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

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

* Re: [tip:x86/mm] x86: fix bootmem cross node for 32bit numa
  2009-03-08 23:16   ` Yinghai Lu
@ 2009-03-09  6:58     ` Ingo Molnar
  0 siblings, 0 replies; 19+ messages in thread
From: Ingo Molnar @ 2009-03-09  6:58 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: linux-tip-commits, Greg KH, linux-kernel, hpa, mingo, akpm, tglx, stable


* Yinghai Lu <yinghai@kernel.org> wrote:

> we may need this one (and two followings one) to be applied 
> for stable with 2.6.27, 2.6.28, 2.6.29.

I'm not sure - they are rather complex and intrusive, and the 
further we go back the more conflicting they become.

	Ingo

^ 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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.