
From: Vivek Goyal <vgoyal@in.ibm.com>

Kexec on panic is broken on i386 in 2.6.11-rc3-mm2 because of
re-organisation of boot memory allocator code.  Primary kernel does not
boot if kexec is enabled and crashkernel=X@Y command line parameter is
passed.  After re-organization, kexec is trying to call reserve_bootmem
before boot memory allocator has initialized.

This patch fixes the problem.  I have moved the call to reserved_bootmem()
for kexec for both discontig and contig memory into new
setup_bootmem_allocator().

Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/i386/kernel/setup.c |   10 +++++-----
 25-akpm/arch/i386/mm/discontig.c |    5 -----
 2 files changed, 5 insertions(+), 10 deletions(-)

diff -puN arch/i386/kernel/setup.c~x86-crashkernel-fix arch/i386/kernel/setup.c
--- 25/arch/i386/kernel/setup.c~x86-crashkernel-fix	2005-02-24 20:29:34.000000000 -0800
+++ 25-akpm/arch/i386/kernel/setup.c	2005-02-24 20:29:34.000000000 -0800
@@ -981,11 +981,6 @@ unsigned long __init find_max_low_pfn(vo
 			printk(KERN_ERR "ignoring highmem size on non-highmem kernel!\n");
 #endif
 	}
-#ifdef CONFIG_KEXEC
-	if (crashk_res.start != crashk_res.end)
-		reserve_bootmem(crashk_res.start,
-			crashk_res.end - crashk_res.start + 1);
-#endif
 	return max_low_pfn;
 }
 
@@ -1168,6 +1163,11 @@ void __init setup_bootmem_allocator(void
 		}
 	}
 #endif
+#ifdef CONFIG_KEXEC
+	if (crashk_res.start != crashk_res.end)
+		reserve_bootmem(crashk_res.start,
+			crashk_res.end - crashk_res.start + 1);
+#endif
 }
 
 /*
diff -puN arch/i386/mm/discontig.c~x86-crashkernel-fix arch/i386/mm/discontig.c
--- 25/arch/i386/mm/discontig.c~x86-crashkernel-fix	2005-02-24 20:29:34.000000000 -0800
+++ 25-akpm/arch/i386/mm/discontig.c	2005-02-24 20:29:34.000000000 -0800
@@ -265,11 +265,6 @@ unsigned long __init setup_memory(void)
 		find_max_pfn_node(nid);
 
 	NODE_DATA(0)->bdata = &node0_bdata;
-#ifdef CONFIG_KEXEC
-	if (crashk_res.start != crashk_res.end)
-		reserve_bootmem(crashk_res.start,
-			crashk_res.end - crashk_res.start + 1);
-#endif
 	setup_bootmem_allocator();
 	return max_low_pfn;
 }
_
