aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-01-15 10:44:37 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-15 10:44:37 -0500
commit23be8c7ddf4fd31a14579a2109c89845f7a0fbb6 (patch)
tree57d28dd27783e79273c9a2c6e3c4307c0ac945e1 /arch/x86
parent5d5d80001df3fbd06bd2b8893b6e3847e38a12d6 (diff)
x86: fix boot crash on HIGHMEM4G && SPARSEMEM
Denys Fedoryshchenko reported a bootup crash when he upgraded his system from 3GB to 4GB RAM: http://lkml.org/lkml/2008/1/7/9 the bug is due to HIGHMEM4G && SPARSEMEM kernels making pfn_to_page() to return an invalid pointer when the pfn is in a memory hole. The 256 MB PCI aperture at the end of RAM was not mapped by sparsemem, and hence the pfn was not valid. But set_highmem_pages_init() iterated this range without checking the pfn's validity first. this bug was probably present in the sparsemem code ever since sparsemem has been introduced in v2.6.13. It was masked due to HIGHMEM64G using larger memory regions in sparsemem_32.h: #ifdef CONFIG_X86_PAE #define SECTION_SIZE_BITS 30 #define MAX_PHYSADDR_BITS 36 #define MAX_PHYSMEM_BITS 36 #else #define SECTION_SIZE_BITS 26 #define MAX_PHYSADDR_BITS 32 #define MAX_PHYSMEM_BITS 32 #endif which creates 1GB sparsemem regions instead of 64MB sparsemem regions. So in practice we only ever created true sparsemem holes on x86 with HIGHMEM4G - but that was rarely used by distros. ( btw., we could probably save 2MB of mem_map[]s on X86_PAE if we reduced the sparsemem region size to 256 MB. ) Signed-off-by: Ingo Molnar <mingo@elte.hu> Acked-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/mm/init_32.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index c7d19471261d..3c76d194fd2c 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -321,8 +321,13 @@ extern void set_highmem_pages_init(int);
321static void __init set_highmem_pages_init(int bad_ppro) 321static void __init set_highmem_pages_init(int bad_ppro)
322{ 322{
323 int pfn; 323 int pfn;
324 for (pfn = highstart_pfn; pfn < highend_pfn; pfn++) 324 for (pfn = highstart_pfn; pfn < highend_pfn; pfn++) {
325 add_one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro); 325 /*
326 * Holes under sparsemem might not have no mem_map[]:
327 */
328 if (pfn_valid(pfn))
329 add_one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro);
330 }
326 totalram_pages += totalhigh_pages; 331 totalram_pages += totalhigh_pages;
327} 332}
328#endif /* CONFIG_FLATMEM */ 333#endif /* CONFIG_FLATMEM */