All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] fix memmap init for handling memory hole v2
@ 2009-02-12  7:19 ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 20+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-02-12  7:19 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm, kosaki.motohiro, akpm, davem, heiko.carstens

This set is a replacement for

mm-fix-memmap-init-to-initialize-valid-memmap-for-memory-hole.patch (dropped)

I think this version is much cleaner than previous one.

This is a fix for routines in boot, so this can add a terrible error.
Please test when you have time. I tested on x86-64+fake NUMA.

-Kame
== from this problem.

What's happening is that the assertion in mm/page_alloc.c:move_freepages()
is triggering:

	BUG_ON(page_zone(start_page) != page_zone(end_page));

Once I knew this is what was happening, I added some annotations:

	if (unlikely(page_zone(start_page) != page_zone(end_page))) {
		printk(KERN_ERR "move_freepages: Bogus zones: "
		       "start_page[%p] end_page[%p] zone[%p]\n",
		       start_page, end_page, zone);
		printk(KERN_ERR "move_freepages: "
		       "start_zone[%p] end_zone[%p]\n",
		       page_zone(start_page), page_zone(end_page));
		printk(KERN_ERR "move_freepages: "
		       "start_pfn[0x%lx] end_pfn[0x%lx]\n",
		       page_to_pfn(start_page), page_to_pfn(end_page));
		printk(KERN_ERR "move_freepages: "
		       "start_nid[%d] end_nid[%d]\n",
		       page_to_nid(start_page), page_to_nid(end_page));
 ...

And here's what I got:

	move_freepages: Bogus zones: start_page[2207d0000] end_page[2207dffc0] zone[fffff8103effcb00]
	move_freepages: start_zone[fffff8103effcb00] end_zone[fffff8003fffeb00]
	move_freepages: start_pfn[0x81f600] end_pfn[0x81f7ff]
	move_freepages: start_nid[1] end_nid[0]

My memory layout on this box is:

[    0.000000] Zone PFN ranges:
[    0.000000]   Normal   0x00000000 -> 0x0081ff5d
[    0.000000] Movable zone start PFN for each node
[    0.000000] early_node_map[8] active PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00020000
[    0.000000]     1: 0x00800000 -> 0x0081f7ff
[    0.000000]     1: 0x0081f800 -> 0x0081fe50
[    0.000000]     1: 0x0081fed1 -> 0x0081fed8
[    0.000000]     1: 0x0081feda -> 0x0081fedb
[    0.000000]     1: 0x0081fedd -> 0x0081fee5
[    0.000000]     1: 0x0081fee7 -> 0x0081ff51
[    0.000000]     1: 0x0081ff59 -> 0x0081ff5d

So it's a block move in that 0x81f600-->0x81f7ff region which triggers
the problem.


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

* [PATCH 0/2] fix memmap init for handling memory hole v2
@ 2009-02-12  7:19 ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 20+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-02-12  7:19 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm, kosaki.motohiro, akpm, davem, heiko.carstens

This set is a replacement for

mm-fix-memmap-init-to-initialize-valid-memmap-for-memory-hole.patch (dropped)

I think this version is much cleaner than previous one.

This is a fix for routines in boot, so this can add a terrible error.
Please test when you have time. I tested on x86-64+fake NUMA.

-Kame
== from this problem.

What's happening is that the assertion in mm/page_alloc.c:move_freepages()
is triggering:

	BUG_ON(page_zone(start_page) != page_zone(end_page));

Once I knew this is what was happening, I added some annotations:

	if (unlikely(page_zone(start_page) != page_zone(end_page))) {
		printk(KERN_ERR "move_freepages: Bogus zones: "
		       "start_page[%p] end_page[%p] zone[%p]\n",
		       start_page, end_page, zone);
		printk(KERN_ERR "move_freepages: "
		       "start_zone[%p] end_zone[%p]\n",
		       page_zone(start_page), page_zone(end_page));
		printk(KERN_ERR "move_freepages: "
		       "start_pfn[0x%lx] end_pfn[0x%lx]\n",
		       page_to_pfn(start_page), page_to_pfn(end_page));
		printk(KERN_ERR "move_freepages: "
		       "start_nid[%d] end_nid[%d]\n",
		       page_to_nid(start_page), page_to_nid(end_page));
 ...

And here's what I got:

	move_freepages: Bogus zones: start_page[2207d0000] end_page[2207dffc0] zone[fffff8103effcb00]
	move_freepages: start_zone[fffff8103effcb00] end_zone[fffff8003fffeb00]
	move_freepages: start_pfn[0x81f600] end_pfn[0x81f7ff]
	move_freepages: start_nid[1] end_nid[0]

My memory layout on this box is:

[    0.000000] Zone PFN ranges:
[    0.000000]   Normal   0x00000000 -> 0x0081ff5d
[    0.000000] Movable zone start PFN for each node
[    0.000000] early_node_map[8] active PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00020000
[    0.000000]     1: 0x00800000 -> 0x0081f7ff
[    0.000000]     1: 0x0081f800 -> 0x0081fe50
[    0.000000]     1: 0x0081fed1 -> 0x0081fed8
[    0.000000]     1: 0x0081feda -> 0x0081fedb
[    0.000000]     1: 0x0081fedd -> 0x0081fee5
[    0.000000]     1: 0x0081fee7 -> 0x0081ff51
[    0.000000]     1: 0x0081ff59 -> 0x0081ff5d

So it's a block move in that 0x81f600-->0x81f7ff region which triggers
the problem.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH 1/2] clean up for early_pfn_to_nid
  2009-02-12  7:19 ` KAMEZAWA Hiroyuki
@ 2009-02-12  7:22   ` KAMEZAWA Hiroyuki
  -1 siblings, 0 replies; 20+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-02-12  7:22 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: linux-kernel, linux-mm, kosaki.motohiro, akpm, davem, heiko.carstens

From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Declaration of early_pfn_to_nid() is scattered over per-arch include files,
and it seems it's complicated to know when the declaration is used.
I think it makes fix-for-memmap-init not easy.

This patch moves all declaration to include/linux/mm.h

After this,
  if !CONFIG_NODES_POPULATES_NODE_MAP && !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
     -> Use static definition in include/linux/mm.h
  else if !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
     -> Use generic definition in mm/page_alloc.c
  else
     -> per-arch back end function will be called.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

---
 arch/ia64/include/asm/mmzone.h   |    4 ----
 arch/ia64/mm/numa.c              |    2 +-
 arch/x86/include/asm/mmzone_32.h |    2 --
 arch/x86/include/asm/mmzone_64.h |    2 --
 arch/x86/mm/numa_64.c            |    2 +-
 include/linux/mm.h               |   19 ++++++++++++++++---
 mm/page_alloc.c                  |    8 +++++++-
 7 files changed, 25 insertions(+), 14 deletions(-)

Index: mmotm-2.6.29-Feb11/include/linux/mm.h
===================================================================
--- mmotm-2.6.29-Feb11.orig/include/linux/mm.h
+++ mmotm-2.6.29-Feb11/include/linux/mm.h
@@ -1047,10 +1047,23 @@ extern void free_bootmem_with_active_reg
 typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
 extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
 extern void sparse_memory_present_with_active_regions(int nid);
-#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
-extern int early_pfn_to_nid(unsigned long pfn);
-#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
 #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
+
+#if !defined(CONFIG_ARCH_POPULATES_NODE_MAP) && \
+    !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID)
+static inline int __early_pfn_to_nid(unsigned long pfn)
+{
+	return 0;
+}
+#else
+/* please see mm/page_alloc.c */
+extern int __meminit early_pfn_to_nid(unsigned long pfn);
+#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
+/* there is a per-arch backend function. */
+extern int __meminit __early_pfn_to_nid(unsigned long pfn);
+#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
+#endif
+
 extern void set_dma_reserve(unsigned long new_dma_reserve);
 extern void memmap_init_zone(unsigned long, int, unsigned long,
 				unsigned long, enum memmap_context);
Index: mmotm-2.6.29-Feb11/arch/x86/include/asm/mmzone_32.h
===================================================================
--- mmotm-2.6.29-Feb11.orig/arch/x86/include/asm/mmzone_32.h
+++ mmotm-2.6.29-Feb11/arch/x86/include/asm/mmzone_32.h
@@ -32,8 +32,6 @@ static inline void get_memcfg_numa(void)
 	get_memcfg_numa_flat();
 }
 
-extern int early_pfn_to_nid(unsigned long pfn);
-
 extern void resume_map_numa_kva(pgd_t *pgd);
 
 #else /* !CONFIG_NUMA */
Index: mmotm-2.6.29-Feb11/arch/x86/include/asm/mmzone_64.h
===================================================================
--- mmotm-2.6.29-Feb11.orig/arch/x86/include/asm/mmzone_64.h
+++ mmotm-2.6.29-Feb11/arch/x86/include/asm/mmzone_64.h
@@ -40,8 +40,6 @@ static inline __attribute__((pure)) int 
 #define node_end_pfn(nid)       (NODE_DATA(nid)->node_start_pfn +	\
 				 NODE_DATA(nid)->node_spanned_pages)
 
-extern int early_pfn_to_nid(unsigned long pfn);
-
 #ifdef CONFIG_NUMA_EMU
 #define FAKE_NODE_MIN_SIZE	(64 * 1024 * 1024)
 #define FAKE_NODE_MIN_HASH_MASK	(~(FAKE_NODE_MIN_SIZE - 1UL))
Index: mmotm-2.6.29-Feb11/arch/ia64/include/asm/mmzone.h
===================================================================
--- mmotm-2.6.29-Feb11.orig/arch/ia64/include/asm/mmzone.h
+++ mmotm-2.6.29-Feb11/arch/ia64/include/asm/mmzone.h
@@ -31,10 +31,6 @@ static inline int pfn_to_nid(unsigned lo
 #endif
 }
 
-#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
-extern int early_pfn_to_nid(unsigned long pfn);
-#endif
-
 #ifdef CONFIG_IA64_DIG /* DIG systems are small */
 # define MAX_PHYSNODE_ID	8
 # define NR_NODE_MEMBLKS	(MAX_NUMNODES * 8)
Index: mmotm-2.6.29-Feb11/arch/ia64/mm/numa.c
===================================================================
--- mmotm-2.6.29-Feb11.orig/arch/ia64/mm/numa.c
+++ mmotm-2.6.29-Feb11/arch/ia64/mm/numa.c
@@ -58,7 +58,7 @@ paddr_to_nid(unsigned long paddr)
  * SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where
  * the section resides.
  */
-int early_pfn_to_nid(unsigned long pfn)
+int __meminit __early_pfn_to_nid(unsigned long pfn)
 {
 	int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec;
 
Index: mmotm-2.6.29-Feb11/arch/x86/mm/numa_64.c
===================================================================
--- mmotm-2.6.29-Feb11.orig/arch/x86/mm/numa_64.c
+++ mmotm-2.6.29-Feb11/arch/x86/mm/numa_64.c
@@ -166,7 +166,7 @@ int __init compute_hash_shift(struct boo
 	return shift;
 }
 
-int early_pfn_to_nid(unsigned long pfn)
+int __meminit  __early_pfn_to_nid(unsigned long pfn)
 {
 	return phys_to_nid(pfn << PAGE_SHIFT);
 }
Index: mmotm-2.6.29-Feb11/mm/page_alloc.c
===================================================================
--- mmotm-2.6.29-Feb11.orig/mm/page_alloc.c
+++ mmotm-2.6.29-Feb11/mm/page_alloc.c
@@ -2974,7 +2974,7 @@ static int __meminit next_active_region_
  * was used and there are no special requirements, this is a convenient
  * alternative
  */
-int __meminit early_pfn_to_nid(unsigned long pfn)
+int __meminit __early_pfn_to_nid(unsigned long pfn)
 {
 	int i;
 
@@ -2990,6 +2990,12 @@ int __meminit early_pfn_to_nid(unsigned 
 }
 #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
 
+int __meminit early_pfn_to_nid(unsigned long pfn)
+{
+	return __early_pfn_to_nid(pfn);
+}
+
+
 /* Basic iterator support to walk early_node_map[] */
 #define for_each_active_range_index_in_nid(i, nid) \
 	for (i = first_active_region_index_in_nid(nid); i != -1; \


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

* [PATCH 1/2] clean up for early_pfn_to_nid
@ 2009-02-12  7:22   ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 20+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-02-12  7:22 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: linux-kernel, linux-mm, kosaki.motohiro, akpm, davem, heiko.carstens

From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Declaration of early_pfn_to_nid() is scattered over per-arch include files,
and it seems it's complicated to know when the declaration is used.
I think it makes fix-for-memmap-init not easy.

This patch moves all declaration to include/linux/mm.h

After this,
  if !CONFIG_NODES_POPULATES_NODE_MAP && !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
     -> Use static definition in include/linux/mm.h
  else if !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
     -> Use generic definition in mm/page_alloc.c
  else
     -> per-arch back end function will be called.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

---
 arch/ia64/include/asm/mmzone.h   |    4 ----
 arch/ia64/mm/numa.c              |    2 +-
 arch/x86/include/asm/mmzone_32.h |    2 --
 arch/x86/include/asm/mmzone_64.h |    2 --
 arch/x86/mm/numa_64.c            |    2 +-
 include/linux/mm.h               |   19 ++++++++++++++++---
 mm/page_alloc.c                  |    8 +++++++-
 7 files changed, 25 insertions(+), 14 deletions(-)

Index: mmotm-2.6.29-Feb11/include/linux/mm.h
===================================================================
--- mmotm-2.6.29-Feb11.orig/include/linux/mm.h
+++ mmotm-2.6.29-Feb11/include/linux/mm.h
@@ -1047,10 +1047,23 @@ extern void free_bootmem_with_active_reg
 typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
 extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
 extern void sparse_memory_present_with_active_regions(int nid);
-#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
-extern int early_pfn_to_nid(unsigned long pfn);
-#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
 #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
+
+#if !defined(CONFIG_ARCH_POPULATES_NODE_MAP) && \
+    !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID)
+static inline int __early_pfn_to_nid(unsigned long pfn)
+{
+	return 0;
+}
+#else
+/* please see mm/page_alloc.c */
+extern int __meminit early_pfn_to_nid(unsigned long pfn);
+#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
+/* there is a per-arch backend function. */
+extern int __meminit __early_pfn_to_nid(unsigned long pfn);
+#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
+#endif
+
 extern void set_dma_reserve(unsigned long new_dma_reserve);
 extern void memmap_init_zone(unsigned long, int, unsigned long,
 				unsigned long, enum memmap_context);
Index: mmotm-2.6.29-Feb11/arch/x86/include/asm/mmzone_32.h
===================================================================
--- mmotm-2.6.29-Feb11.orig/arch/x86/include/asm/mmzone_32.h
+++ mmotm-2.6.29-Feb11/arch/x86/include/asm/mmzone_32.h
@@ -32,8 +32,6 @@ static inline void get_memcfg_numa(void)
 	get_memcfg_numa_flat();
 }
 
-extern int early_pfn_to_nid(unsigned long pfn);
-
 extern void resume_map_numa_kva(pgd_t *pgd);
 
 #else /* !CONFIG_NUMA */
Index: mmotm-2.6.29-Feb11/arch/x86/include/asm/mmzone_64.h
===================================================================
--- mmotm-2.6.29-Feb11.orig/arch/x86/include/asm/mmzone_64.h
+++ mmotm-2.6.29-Feb11/arch/x86/include/asm/mmzone_64.h
@@ -40,8 +40,6 @@ static inline __attribute__((pure)) int 
 #define node_end_pfn(nid)       (NODE_DATA(nid)->node_start_pfn +	\
 				 NODE_DATA(nid)->node_spanned_pages)
 
-extern int early_pfn_to_nid(unsigned long pfn);
-
 #ifdef CONFIG_NUMA_EMU
 #define FAKE_NODE_MIN_SIZE	(64 * 1024 * 1024)
 #define FAKE_NODE_MIN_HASH_MASK	(~(FAKE_NODE_MIN_SIZE - 1UL))
Index: mmotm-2.6.29-Feb11/arch/ia64/include/asm/mmzone.h
===================================================================
--- mmotm-2.6.29-Feb11.orig/arch/ia64/include/asm/mmzone.h
+++ mmotm-2.6.29-Feb11/arch/ia64/include/asm/mmzone.h
@@ -31,10 +31,6 @@ static inline int pfn_to_nid(unsigned lo
 #endif
 }
 
-#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
-extern int early_pfn_to_nid(unsigned long pfn);
-#endif
-
 #ifdef CONFIG_IA64_DIG /* DIG systems are small */
 # define MAX_PHYSNODE_ID	8
 # define NR_NODE_MEMBLKS	(MAX_NUMNODES * 8)
Index: mmotm-2.6.29-Feb11/arch/ia64/mm/numa.c
===================================================================
--- mmotm-2.6.29-Feb11.orig/arch/ia64/mm/numa.c
+++ mmotm-2.6.29-Feb11/arch/ia64/mm/numa.c
@@ -58,7 +58,7 @@ paddr_to_nid(unsigned long paddr)
  * SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where
  * the section resides.
  */
-int early_pfn_to_nid(unsigned long pfn)
+int __meminit __early_pfn_to_nid(unsigned long pfn)
 {
 	int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec;
 
Index: mmotm-2.6.29-Feb11/arch/x86/mm/numa_64.c
===================================================================
--- mmotm-2.6.29-Feb11.orig/arch/x86/mm/numa_64.c
+++ mmotm-2.6.29-Feb11/arch/x86/mm/numa_64.c
@@ -166,7 +166,7 @@ int __init compute_hash_shift(struct boo
 	return shift;
 }
 
-int early_pfn_to_nid(unsigned long pfn)
+int __meminit  __early_pfn_to_nid(unsigned long pfn)
 {
 	return phys_to_nid(pfn << PAGE_SHIFT);
 }
Index: mmotm-2.6.29-Feb11/mm/page_alloc.c
===================================================================
--- mmotm-2.6.29-Feb11.orig/mm/page_alloc.c
+++ mmotm-2.6.29-Feb11/mm/page_alloc.c
@@ -2974,7 +2974,7 @@ static int __meminit next_active_region_
  * was used and there are no special requirements, this is a convenient
  * alternative
  */
-int __meminit early_pfn_to_nid(unsigned long pfn)
+int __meminit __early_pfn_to_nid(unsigned long pfn)
 {
 	int i;
 
@@ -2990,6 +2990,12 @@ int __meminit early_pfn_to_nid(unsigned 
 }
 #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
 
+int __meminit early_pfn_to_nid(unsigned long pfn)
+{
+	return __early_pfn_to_nid(pfn);
+}
+
+
 /* Basic iterator support to walk early_node_map[] */
 #define for_each_active_range_index_in_nid(i, nid) \
 	for (i = first_active_region_index_in_nid(nid); i != -1; \

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH 2/2] fix memmap init for handling memory hole
  2009-02-12  7:19 ` KAMEZAWA Hiroyuki
@ 2009-02-12  7:24   ` KAMEZAWA Hiroyuki
  -1 siblings, 0 replies; 20+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-02-12  7:24 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: linux-kernel, linux-mm, kosaki.motohiro, akpm, davem, heiko.carstens

From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Now, early_pfn_in_nid(PFN, NID) may returns false if PFN is a hole.
and memmap initialization was not done. This was a trouble for
sparc boot.

To fix this, the PFN should be initialized and marked as PG_reserved.
This patch changes early_pfn_in_nid() return true if PFN is a hole.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
 arch/ia64/mm/numa.c    |    2 +-
 include/linux/mmzone.h |    2 +-
 mm/page_alloc.c        |   23 ++++++++++++++++++++---
 3 files changed, 22 insertions(+), 5 deletions(-)

Index: mmotm-2.6.29-Feb11/mm/page_alloc.c
===================================================================
--- mmotm-2.6.29-Feb11.orig/mm/page_alloc.c
+++ mmotm-2.6.29-Feb11/mm/page_alloc.c
@@ -2985,16 +2985,33 @@ int __meminit __early_pfn_to_nid(unsigne
 		if (start_pfn <= pfn && pfn < end_pfn)
 			return early_node_map[i].nid;
 	}
-
-	return 0;
+	/* This is a memory hole */
+	return -1;
 }
 #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
 
 int __meminit early_pfn_to_nid(unsigned long pfn)
 {
-	return __early_pfn_to_nid(pfn);
+	int nid;
+
+	nid = __early_pfn_to_nid(pfn);
+	if (nid >= 0)
+		return nid;
+	/* just returns 0 */
+	return 0;
 }
 
+#ifdef CONFIG_NODES_SPAN_OTHER_NODES
+bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
+{
+	int nid;
+
+	nid = __early_pfn_to_nid(pfn);
+	if (nid >= 0 && nid != node)
+		return false;
+	return true;
+}
+#endif
 
 /* Basic iterator support to walk early_node_map[] */
 #define for_each_active_range_index_in_nid(i, nid) \
Index: mmotm-2.6.29-Feb11/include/linux/mmzone.h
===================================================================
--- mmotm-2.6.29-Feb11.orig/include/linux/mmzone.h
+++ mmotm-2.6.29-Feb11/include/linux/mmzone.h
@@ -1079,7 +1079,7 @@ void sparse_init(void);
 #endif /* CONFIG_SPARSEMEM */
 
 #ifdef CONFIG_NODES_SPAN_OTHER_NODES
-#define early_pfn_in_nid(pfn, nid)	(early_pfn_to_nid(pfn) == (nid))
+bool early_pfn_in_nid(unsigned long pfn, int nid);
 #else
 #define early_pfn_in_nid(pfn, nid)	(1)
 #endif
Index: mmotm-2.6.29-Feb11/arch/ia64/mm/numa.c
===================================================================
--- mmotm-2.6.29-Feb11.orig/arch/ia64/mm/numa.c
+++ mmotm-2.6.29-Feb11/arch/ia64/mm/numa.c
@@ -70,7 +70,7 @@ int __meminit __early_pfn_to_nid(unsigne
 			return node_memblk[i].nid;
 	}
 
-	return 0;
+	return -1;
 }
 
 #ifdef CONFIG_MEMORY_HOTPLUG


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

* [PATCH 2/2] fix memmap init for handling memory hole
@ 2009-02-12  7:24   ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 20+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-02-12  7:24 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: linux-kernel, linux-mm, kosaki.motohiro, akpm, davem, heiko.carstens

From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Now, early_pfn_in_nid(PFN, NID) may returns false if PFN is a hole.
and memmap initialization was not done. This was a trouble for
sparc boot.

To fix this, the PFN should be initialized and marked as PG_reserved.
This patch changes early_pfn_in_nid() return true if PFN is a hole.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
 arch/ia64/mm/numa.c    |    2 +-
 include/linux/mmzone.h |    2 +-
 mm/page_alloc.c        |   23 ++++++++++++++++++++---
 3 files changed, 22 insertions(+), 5 deletions(-)

Index: mmotm-2.6.29-Feb11/mm/page_alloc.c
===================================================================
--- mmotm-2.6.29-Feb11.orig/mm/page_alloc.c
+++ mmotm-2.6.29-Feb11/mm/page_alloc.c
@@ -2985,16 +2985,33 @@ int __meminit __early_pfn_to_nid(unsigne
 		if (start_pfn <= pfn && pfn < end_pfn)
 			return early_node_map[i].nid;
 	}
-
-	return 0;
+	/* This is a memory hole */
+	return -1;
 }
 #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
 
 int __meminit early_pfn_to_nid(unsigned long pfn)
 {
-	return __early_pfn_to_nid(pfn);
+	int nid;
+
+	nid = __early_pfn_to_nid(pfn);
+	if (nid >= 0)
+		return nid;
+	/* just returns 0 */
+	return 0;
 }
 
+#ifdef CONFIG_NODES_SPAN_OTHER_NODES
+bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
+{
+	int nid;
+
+	nid = __early_pfn_to_nid(pfn);
+	if (nid >= 0 && nid != node)
+		return false;
+	return true;
+}
+#endif
 
 /* Basic iterator support to walk early_node_map[] */
 #define for_each_active_range_index_in_nid(i, nid) \
Index: mmotm-2.6.29-Feb11/include/linux/mmzone.h
===================================================================
--- mmotm-2.6.29-Feb11.orig/include/linux/mmzone.h
+++ mmotm-2.6.29-Feb11/include/linux/mmzone.h
@@ -1079,7 +1079,7 @@ void sparse_init(void);
 #endif /* CONFIG_SPARSEMEM */
 
 #ifdef CONFIG_NODES_SPAN_OTHER_NODES
-#define early_pfn_in_nid(pfn, nid)	(early_pfn_to_nid(pfn) == (nid))
+bool early_pfn_in_nid(unsigned long pfn, int nid);
 #else
 #define early_pfn_in_nid(pfn, nid)	(1)
 #endif
Index: mmotm-2.6.29-Feb11/arch/ia64/mm/numa.c
===================================================================
--- mmotm-2.6.29-Feb11.orig/arch/ia64/mm/numa.c
+++ mmotm-2.6.29-Feb11/arch/ia64/mm/numa.c
@@ -70,7 +70,7 @@ int __meminit __early_pfn_to_nid(unsigne
 			return node_memblk[i].nid;
 	}
 
-	return 0;
+	return -1;
 }
 
 #ifdef CONFIG_MEMORY_HOTPLUG

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 1/2] clean up for early_pfn_to_nid
  2009-02-12  7:22   ` KAMEZAWA Hiroyuki
@ 2009-02-13  6:14     ` KOSAKI Motohiro
  -1 siblings, 0 replies; 20+ messages in thread
From: KOSAKI Motohiro @ 2009-02-13  6:14 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: kosaki.motohiro, linux-kernel, linux-mm, akpm, davem,
	heiko.carstens, Mel Gorman

> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> Declaration of early_pfn_to_nid() is scattered over per-arch include files,
> and it seems it's complicated to know when the declaration is used.
> I think it makes fix-for-memmap-init not easy.
> 
> This patch moves all declaration to include/linux/mm.h
> 
> After this,
>   if !CONFIG_NODES_POPULATES_NODE_MAP && !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
>      -> Use static definition in include/linux/mm.h
>   else if !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
>      -> Use generic definition in mm/page_alloc.c
>   else
>      -> per-arch back end function will be called.
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

at least, this patch works fine on my ia64 box.

	Tested-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>




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

* Re: [PATCH 1/2] clean up for early_pfn_to_nid
@ 2009-02-13  6:14     ` KOSAKI Motohiro
  0 siblings, 0 replies; 20+ messages in thread
From: KOSAKI Motohiro @ 2009-02-13  6:14 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: kosaki.motohiro, linux-kernel, linux-mm, akpm, davem,
	heiko.carstens, Mel Gorman

> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> Declaration of early_pfn_to_nid() is scattered over per-arch include files,
> and it seems it's complicated to know when the declaration is used.
> I think it makes fix-for-memmap-init not easy.
> 
> This patch moves all declaration to include/linux/mm.h
> 
> After this,
>   if !CONFIG_NODES_POPULATES_NODE_MAP && !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
>      -> Use static definition in include/linux/mm.h
>   else if !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
>      -> Use generic definition in mm/page_alloc.c
>   else
>      -> per-arch back end function will be called.
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

at least, this patch works fine on my ia64 box.

	Tested-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>



--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 2/2] fix memmap init for handling memory hole
  2009-02-12  7:24   ` KAMEZAWA Hiroyuki
@ 2009-02-13  6:15     ` KOSAKI Motohiro
  -1 siblings, 0 replies; 20+ messages in thread
From: KOSAKI Motohiro @ 2009-02-13  6:15 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: kosaki.motohiro, linux-kernel, linux-mm, akpm, davem,
	heiko.carstens, Mel Gorman

> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> Now, early_pfn_in_nid(PFN, NID) may returns false if PFN is a hole.
> and memmap initialization was not done. This was a trouble for
> sparc boot.
> 
> To fix this, the PFN should be initialized and marked as PG_reserved.
> This patch changes early_pfn_in_nid() return true if PFN is a hole.
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

at least, this patch works fine on my ia64 box.

	Tested-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>





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

* Re: [PATCH 2/2] fix memmap init for handling memory hole
@ 2009-02-13  6:15     ` KOSAKI Motohiro
  0 siblings, 0 replies; 20+ messages in thread
From: KOSAKI Motohiro @ 2009-02-13  6:15 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: kosaki.motohiro, linux-kernel, linux-mm, akpm, davem,
	heiko.carstens, Mel Gorman

> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> Now, early_pfn_in_nid(PFN, NID) may returns false if PFN is a hole.
> and memmap initialization was not done. This was a trouble for
> sparc boot.
> 
> To fix this, the PFN should be initialized and marked as PG_reserved.
> This patch changes early_pfn_in_nid() return true if PFN is a hole.
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

at least, this patch works fine on my ia64 box.

	Tested-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>




--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 1/2] clean up for early_pfn_to_nid
  2009-02-12  7:22   ` KAMEZAWA Hiroyuki
@ 2009-02-13 22:20     ` Andrew Morton
  -1 siblings, 0 replies; 20+ messages in thread
From: Andrew Morton @ 2009-02-13 22:20 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: kamezawa.hiroyu, linux-kernel, linux-mm, kosaki.motohiro, davem,
	heiko.carstens, stable

On Thu, 12 Feb 2009 16:22:03 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:

> Declaration of early_pfn_to_nid() is scattered over per-arch include files,
> and it seems it's complicated to know when the declaration is used.
> I think it makes fix-for-memmap-init not easy.
> 
> This patch moves all declaration to include/linux/mm.h
> 
> After this,
>   if !CONFIG_NODES_POPULATES_NODE_MAP && !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
>      -> Use static definition in include/linux/mm.h
>   else if !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
>      -> Use generic definition in mm/page_alloc.c
>   else
>      -> per-arch back end function will be called.
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> ---
>  arch/ia64/include/asm/mmzone.h   |    4 ----
>  arch/ia64/mm/numa.c              |    2 +-
>  arch/x86/include/asm/mmzone_32.h |    2 --
>  arch/x86/include/asm/mmzone_64.h |    2 --
>  arch/x86/mm/numa_64.c            |    2 +-
>  include/linux/mm.h               |   19 ++++++++++++++++---
>  mm/page_alloc.c                  |    8 +++++++-
>  7 files changed, 25 insertions(+), 14 deletions(-)

It's rather unfortunate that this bugfix includes a fair-sized cleanup
patch, because we should backport it into 2.6.28.x.

Oh well.

I queued these as

mm-clean-up-for-early_pfn_to_nid.patch
mm-fix-memmap-init-for-handling-memory-hole.patch

and tagged them as needed-in-2.6.28.x.  I don't recall whether they are
needed in earlier -stable releases?

I don't have a record here of davem having tested these new patches, btw ;)

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

* Re: [PATCH 1/2] clean up for early_pfn_to_nid
@ 2009-02-13 22:20     ` Andrew Morton
  0 siblings, 0 replies; 20+ messages in thread
From: Andrew Morton @ 2009-02-13 22:20 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: linux-kernel, linux-mm, kosaki.motohiro, davem, heiko.carstens, stable

On Thu, 12 Feb 2009 16:22:03 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:

> Declaration of early_pfn_to_nid() is scattered over per-arch include files,
> and it seems it's complicated to know when the declaration is used.
> I think it makes fix-for-memmap-init not easy.
> 
> This patch moves all declaration to include/linux/mm.h
> 
> After this,
>   if !CONFIG_NODES_POPULATES_NODE_MAP && !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
>      -> Use static definition in include/linux/mm.h
>   else if !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
>      -> Use generic definition in mm/page_alloc.c
>   else
>      -> per-arch back end function will be called.
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> ---
>  arch/ia64/include/asm/mmzone.h   |    4 ----
>  arch/ia64/mm/numa.c              |    2 +-
>  arch/x86/include/asm/mmzone_32.h |    2 --
>  arch/x86/include/asm/mmzone_64.h |    2 --
>  arch/x86/mm/numa_64.c            |    2 +-
>  include/linux/mm.h               |   19 ++++++++++++++++---
>  mm/page_alloc.c                  |    8 +++++++-
>  7 files changed, 25 insertions(+), 14 deletions(-)

It's rather unfortunate that this bugfix includes a fair-sized cleanup
patch, because we should backport it into 2.6.28.x.

Oh well.

I queued these as

mm-clean-up-for-early_pfn_to_nid.patch
mm-fix-memmap-init-for-handling-memory-hole.patch

and tagged them as needed-in-2.6.28.x.  I don't recall whether they are
needed in earlier -stable releases?

I don't have a record here of davem having tested these new patches, btw ;)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 1/2] clean up for early_pfn_to_nid
  2009-02-13 22:20     ` Andrew Morton
@ 2009-02-13 23:38       ` KAMEZAWA Hiroyuki
  -1 siblings, 0 replies; 20+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-02-13 23:38 UTC (permalink / raw)
  To: Andrew Morton
  Cc: KAMEZAWA Hiroyuki, linux-kernel, linux-mm, kosaki.motohiro,
	davem, heiko.carstens, stable

Andrew Morton wrote:
> On Thu, 12 Feb 2009 16:22:03 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
>> Declaration of early_pfn_to_nid() is scattered over per-arch include
>> files,
>> and it seems it's complicated to know when the declaration is used.
>> I think it makes fix-for-memmap-init not easy.
>>
>> This patch moves all declaration to include/linux/mm.h
>>
>> After this,
>>   if !CONFIG_NODES_POPULATES_NODE_MAP &&
>> !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
>>      -> Use static definition in include/linux/mm.h
>>   else if !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
>>      -> Use generic definition in mm/page_alloc.c
>>   else
>>      -> per-arch back end function will be called.
>>
>> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>>
>> ---
>>  arch/ia64/include/asm/mmzone.h   |    4 ----
>>  arch/ia64/mm/numa.c              |    2 +-
>>  arch/x86/include/asm/mmzone_32.h |    2 --
>>  arch/x86/include/asm/mmzone_64.h |    2 --
>>  arch/x86/mm/numa_64.c            |    2 +-
>>  include/linux/mm.h               |   19 ++++++++++++++++---
>>  mm/page_alloc.c                  |    8 +++++++-
>>  7 files changed, 25 insertions(+), 14 deletions(-)
>
> It's rather unfortunate that this bugfix includes a fair-sized cleanup
> patch, because we should backport it into 2.6.28.x.
>
> Oh well.
>
Sorry..but this part was too ugly to write a patch that convince me
this patch is correct. If I should rewrite, I'll do.

> I queued these as
>
> mm-clean-up-for-early_pfn_to_nid.patch
> mm-fix-memmap-init-for-handling-memory-hole.patch
>
> and tagged them as needed-in-2.6.28.x.  I don't recall whether they are
> needed in earlier -stable releases?
>
Maybe necessary for some machines, which may access memory holes.

> I don't have a record here of davem having tested these new patches, btw
> ;)
Sorry for bad CC.
This fix's logic itself is not different from original one.

-Kame






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

* Re: [PATCH 1/2] clean up for early_pfn_to_nid
@ 2009-02-13 23:38       ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 20+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-02-13 23:38 UTC (permalink / raw)
  To: Andrew Morton
  Cc: KAMEZAWA Hiroyuki, linux-kernel, linux-mm, kosaki.motohiro,
	davem, heiko.carstens, stable

Andrew Morton wrote:
> On Thu, 12 Feb 2009 16:22:03 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
>> Declaration of early_pfn_to_nid() is scattered over per-arch include
>> files,
>> and it seems it's complicated to know when the declaration is used.
>> I think it makes fix-for-memmap-init not easy.
>>
>> This patch moves all declaration to include/linux/mm.h
>>
>> After this,
>>   if !CONFIG_NODES_POPULATES_NODE_MAP &&
>> !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
>>      -> Use static definition in include/linux/mm.h
>>   else if !CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
>>      -> Use generic definition in mm/page_alloc.c
>>   else
>>      -> per-arch back end function will be called.
>>
>> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>>
>> ---
>>  arch/ia64/include/asm/mmzone.h   |    4 ----
>>  arch/ia64/mm/numa.c              |    2 +-
>>  arch/x86/include/asm/mmzone_32.h |    2 --
>>  arch/x86/include/asm/mmzone_64.h |    2 --
>>  arch/x86/mm/numa_64.c            |    2 +-
>>  include/linux/mm.h               |   19 ++++++++++++++++---
>>  mm/page_alloc.c                  |    8 +++++++-
>>  7 files changed, 25 insertions(+), 14 deletions(-)
>
> It's rather unfortunate that this bugfix includes a fair-sized cleanup
> patch, because we should backport it into 2.6.28.x.
>
> Oh well.
>
Sorry..but this part was too ugly to write a patch that convince me
this patch is correct. If I should rewrite, I'll do.

> I queued these as
>
> mm-clean-up-for-early_pfn_to_nid.patch
> mm-fix-memmap-init-for-handling-memory-hole.patch
>
> and tagged them as needed-in-2.6.28.x.  I don't recall whether they are
> needed in earlier -stable releases?
>
Maybe necessary for some machines, which may access memory holes.

> I don't have a record here of davem having tested these new patches, btw
> ;)
Sorry for bad CC.
This fix's logic itself is not different from original one.

-Kame





--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 1/2] clean up for early_pfn_to_nid
  2009-02-13 22:20     ` Andrew Morton
@ 2009-02-14  6:12       ` David Miller
  -1 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2009-02-14  6:12 UTC (permalink / raw)
  To: akpm
  Cc: kamezawa.hiroyu, linux-kernel, linux-mm, kosaki.motohiro, davem,
	heiko.carstens, stable

From: Andrew Morton <akpm@linux-foundation.org>
Date: Fri, 13 Feb 2009 14:20:32 -0800

> I queued these as
> 
> mm-clean-up-for-early_pfn_to_nid.patch
> mm-fix-memmap-init-for-handling-memory-hole.patch
> 
> and tagged them as needed-in-2.6.28.x.  I don't recall whether they are
> needed in earlier -stable releases?

Every kernel going back to at least 2.6.24 has this bug.  It's likely
been around even longer, I didn't bother checking.

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

* Re: [PATCH 1/2] clean up for early_pfn_to_nid
@ 2009-02-14  6:12       ` David Miller
  0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2009-02-14  6:12 UTC (permalink / raw)
  To: akpm
  Cc: kamezawa.hiroyu, linux-kernel, linux-mm, kosaki.motohiro, davem,
	heiko.carstens, stable

From: Andrew Morton <akpm@linux-foundation.org>
Date: Fri, 13 Feb 2009 14:20:32 -0800

> I queued these as
> 
> mm-clean-up-for-early_pfn_to_nid.patch
> mm-fix-memmap-init-for-handling-memory-hole.patch
> 
> and tagged them as needed-in-2.6.28.x.  I don't recall whether they are
> needed in earlier -stable releases?

Every kernel going back to at least 2.6.24 has this bug.  It's likely
been around even longer, I didn't bother checking.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 1/2] clean up for early_pfn_to_nid
  2009-02-14  6:12       ` David Miller
@ 2009-02-16  0:50         ` KAMEZAWA Hiroyuki
  -1 siblings, 0 replies; 20+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-02-16  0:50 UTC (permalink / raw)
  To: David Miller
  Cc: akpm, linux-kernel, linux-mm, kosaki.motohiro, davem,
	heiko.carstens, stable

On Fri, 13 Feb 2009 22:12:26 -0800 (PST)
David Miller <davem@davemloft.net> wrote:

> From: Andrew Morton <akpm@linux-foundation.org>
> Date: Fri, 13 Feb 2009 14:20:32 -0800
> 
> > I queued these as
> > 
> > mm-clean-up-for-early_pfn_to_nid.patch
> > mm-fix-memmap-init-for-handling-memory-hole.patch
> > 
> > and tagged them as needed-in-2.6.28.x.  I don't recall whether they are
> > needed in earlier -stable releases?
> 
> Every kernel going back to at least 2.6.24 has this bug.  It's likely
> been around even longer, I didn't bother checking.
> 

Sparc64's one is broken from this commit.

09337f501ebdd224cd69df6d168a5c4fe75d86fa
sparc64: Kill CONFIG_SPARC32_COMPAT

CONFIG_NODES_SPAN_OTEHR_NODES is set and config allows following kind of NUMA
This is requirements from powerpc.

low address ---<-   max order     ->---- high address
               [Node0][Node1][Node0]
So, nid is checked at memmap init.

But it included this bug in following case.
low address ---<-   max order     ->---- high address
               [Node0][Hole][Node0]

Hmm..I'm not sure how many kind of machines will see this bug. But there may be
some.

[kamezawa@bluextal linux-2.6.28]$ grep  -R CONFIG_NODES_SPAN arch/*
arch/powerpc/configs/celleb_defconfig:CONFIG_NODES_SPAN_OTHER_NODES=y
arch/powerpc/configs/pseries_defconfig:CONFIG_NODES_SPAN_OTHER_NODES=y
arch/powerpc/configs/cell_defconfig:CONFIG_NODES_SPAN_OTHER_NODES=y
arch/sparc64/defconfig:CONFIG_NODES_SPAN_OTHER_NODES=y
arch/x86/configs/x86_64_defconfig:CONFIG_NODES_SPAN_OTHER_NODES=y

powerpc/sparc64/x86 can see this bug.

IMHO, following 2 arch will be safe because..
On x86-64, it seems it doesn't allows above style of memmap. (BUG_ON() will hit)
Powerpc is originator of this CONFIG_NODES_SPAN_OTHER_NODES and they did test.

Thanks,
-Kame


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

* Re: [PATCH 1/2] clean up for early_pfn_to_nid
@ 2009-02-16  0:50         ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 20+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-02-16  0:50 UTC (permalink / raw)
  To: David Miller
  Cc: akpm, linux-kernel, linux-mm, kosaki.motohiro, davem,
	heiko.carstens, stable

On Fri, 13 Feb 2009 22:12:26 -0800 (PST)
David Miller <davem@davemloft.net> wrote:

> From: Andrew Morton <akpm@linux-foundation.org>
> Date: Fri, 13 Feb 2009 14:20:32 -0800
> 
> > I queued these as
> > 
> > mm-clean-up-for-early_pfn_to_nid.patch
> > mm-fix-memmap-init-for-handling-memory-hole.patch
> > 
> > and tagged them as needed-in-2.6.28.x.  I don't recall whether they are
> > needed in earlier -stable releases?
> 
> Every kernel going back to at least 2.6.24 has this bug.  It's likely
> been around even longer, I didn't bother checking.
> 

Sparc64's one is broken from this commit.

09337f501ebdd224cd69df6d168a5c4fe75d86fa
sparc64: Kill CONFIG_SPARC32_COMPAT

CONFIG_NODES_SPAN_OTEHR_NODES is set and config allows following kind of NUMA
This is requirements from powerpc.

low address ---<-   max order     ->---- high address
               [Node0][Node1][Node0]
So, nid is checked at memmap init.

But it included this bug in following case.
low address ---<-   max order     ->---- high address
               [Node0][Hole][Node0]

Hmm..I'm not sure how many kind of machines will see this bug. But there may be
some.

[kamezawa@bluextal linux-2.6.28]$ grep  -R CONFIG_NODES_SPAN arch/*
arch/powerpc/configs/celleb_defconfig:CONFIG_NODES_SPAN_OTHER_NODES=y
arch/powerpc/configs/pseries_defconfig:CONFIG_NODES_SPAN_OTHER_NODES=y
arch/powerpc/configs/cell_defconfig:CONFIG_NODES_SPAN_OTHER_NODES=y
arch/sparc64/defconfig:CONFIG_NODES_SPAN_OTHER_NODES=y
arch/x86/configs/x86_64_defconfig:CONFIG_NODES_SPAN_OTHER_NODES=y

powerpc/sparc64/x86 can see this bug.

IMHO, following 2 arch will be safe because..
On x86-64, it seems it doesn't allows above style of memmap. (BUG_ON() will hit)
Powerpc is originator of this CONFIG_NODES_SPAN_OTHER_NODES and they did test.

Thanks,
-Kame

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 1/2] clean up for early_pfn_to_nid
  2009-02-16  0:50         ` KAMEZAWA Hiroyuki
@ 2009-02-27  6:37           ` David Miller
  -1 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2009-02-27  6:37 UTC (permalink / raw)
  To: kamezawa.hiroyu
  Cc: akpm, linux-kernel, linux-mm, kosaki.motohiro, davem,
	heiko.carstens, stable

From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Date: Mon, 16 Feb 2009 09:50:42 +0900

> On Fri, 13 Feb 2009 22:12:26 -0800 (PST)
> David Miller <davem@davemloft.net> wrote:
> 
> > From: Andrew Morton <akpm@linux-foundation.org>
> > Date: Fri, 13 Feb 2009 14:20:32 -0800
> > 
> > > I queued these as
> > > 
> > > mm-clean-up-for-early_pfn_to_nid.patch
> > > mm-fix-memmap-init-for-handling-memory-hole.patch
> > > 
> > > and tagged them as needed-in-2.6.28.x.  I don't recall whether they are
> > > needed in earlier -stable releases?
> > 
> > Every kernel going back to at least 2.6.24 has this bug.  It's likely
> > been around even longer, I didn't bother checking.
> > 
> 
> Sparc64's one is broken from this commit.
> 
> 09337f501ebdd224cd69df6d168a5c4fe75d86fa
> sparc64: Kill CONFIG_SPARC32_COMPAT
> 
> CONFIG_NODES_SPAN_OTEHR_NODES is set and config allows following kind of NUMA
> This is requirements from powerpc.

Well, actually this means that what broke sparc64 was the addition of
NUMA support then.  Users could and were enabling these options
on sparc64 beforehand, I just updated defconfig to reflect the
fact that my workstation was NUMA capable :)

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

* Re: [PATCH 1/2] clean up for early_pfn_to_nid
@ 2009-02-27  6:37           ` David Miller
  0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2009-02-27  6:37 UTC (permalink / raw)
  To: kamezawa.hiroyu
  Cc: akpm, linux-kernel, linux-mm, kosaki.motohiro, davem,
	heiko.carstens, stable

From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Date: Mon, 16 Feb 2009 09:50:42 +0900

> On Fri, 13 Feb 2009 22:12:26 -0800 (PST)
> David Miller <davem@davemloft.net> wrote:
> 
> > From: Andrew Morton <akpm@linux-foundation.org>
> > Date: Fri, 13 Feb 2009 14:20:32 -0800
> > 
> > > I queued these as
> > > 
> > > mm-clean-up-for-early_pfn_to_nid.patch
> > > mm-fix-memmap-init-for-handling-memory-hole.patch
> > > 
> > > and tagged them as needed-in-2.6.28.x.  I don't recall whether they are
> > > needed in earlier -stable releases?
> > 
> > Every kernel going back to at least 2.6.24 has this bug.  It's likely
> > been around even longer, I didn't bother checking.
> > 
> 
> Sparc64's one is broken from this commit.
> 
> 09337f501ebdd224cd69df6d168a5c4fe75d86fa
> sparc64: Kill CONFIG_SPARC32_COMPAT
> 
> CONFIG_NODES_SPAN_OTEHR_NODES is set and config allows following kind of NUMA
> This is requirements from powerpc.

Well, actually this means that what broke sparc64 was the addition of
NUMA support then.  Users could and were enabling these options
on sparc64 beforehand, I just updated defconfig to reflect the
fact that my workstation was NUMA capable :)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2009-02-27  6:37 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-12  7:19 [PATCH 0/2] fix memmap init for handling memory hole v2 KAMEZAWA Hiroyuki
2009-02-12  7:19 ` KAMEZAWA Hiroyuki
2009-02-12  7:22 ` [PATCH 1/2] clean up for early_pfn_to_nid KAMEZAWA Hiroyuki
2009-02-12  7:22   ` KAMEZAWA Hiroyuki
2009-02-13  6:14   ` KOSAKI Motohiro
2009-02-13  6:14     ` KOSAKI Motohiro
2009-02-13 22:20   ` Andrew Morton
2009-02-13 22:20     ` Andrew Morton
2009-02-13 23:38     ` KAMEZAWA Hiroyuki
2009-02-13 23:38       ` KAMEZAWA Hiroyuki
2009-02-14  6:12     ` David Miller
2009-02-14  6:12       ` David Miller
2009-02-16  0:50       ` KAMEZAWA Hiroyuki
2009-02-16  0:50         ` KAMEZAWA Hiroyuki
2009-02-27  6:37         ` David Miller
2009-02-27  6:37           ` David Miller
2009-02-12  7:24 ` [PATCH 2/2] fix memmap init for handling memory hole KAMEZAWA Hiroyuki
2009-02-12  7:24   ` KAMEZAWA Hiroyuki
2009-02-13  6:15   ` KOSAKI Motohiro
2009-02-13  6:15     ` KOSAKI Motohiro

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.