x86: fix bootmem cross node for 32bit numa
PATCH 1/1 x86: fix bootmem cross node for 32bit numa
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
--- arch/x86/mm/init_32.c | 46 ++++++++++++++++++++++++++++++++++++++++------ arch/x86/mm/numa_32.c | 5 +++-- 2 files changed, 43 insertions(+), 8 deletions(-)
arch/x86/mm/init_32.c +40 -6
@@ -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(voidpanic ("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 ; }
arch/x86/mm/numa_32.c +3 -2
@@ -416,10 +416,11 @@ void __init initmem_init(unsigned long sfor_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 (); }
PATCH 1/1 x86: make 32bit init_memory_mapping range change more like 64bit
Impact: clean up
make code more readable and more like 64bit
--- arch/x86/mm/init_32.c | 126 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 94 insertions(+), 32 deletions(-)
arch/x86/mm/init_32.c +94 -32
@@ -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);
Re: [PATCH] x86: make 32bit init_memory_mapping range change more like 64bit
Quoted 6 lines · Yinghai Lu
Impact: clean up
make code more readable and more like 64bit
Signed-off-by Yinghai Lu <[email protected]>
This is a nice step towards unifying 32-bit and 64-bit init_memory_mapping() implementations!
[tip:x86/mm] x86: make 32-bit init_memory_mapping range change more like 64-bit
In reply to Yinghai LuCommit-ID: b68adb16f29c8ea02f21f5ebf65bcabffe217e9f Gitweb: http://git.kernel.org/tip/b68adb16f29c8ea02f21f5ebf65bcabffe217e9f Author: "Yinghai Lu" <[email protected]> AuthorDate: Wed, 4 Mar 2009 01:24:04 -0800 Commit: Ingo Molnar <[email protected]> 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
LKML-Reference: <[email protected]>
--- arch/x86/mm/init_32.c | 126 ++++++++++++++++++++++++++++++++++++------------ 1 files changed, 94 insertions(+), 32 deletions(-)
arch/x86/mm/init_32.c +94 -32
@@ -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);
PATCH 1/1 x86: ioremap mptable
In reply to Yinghai LuImpact: 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.
--- arch/x86/kernel/mpparse.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)
arch/x86/kernel/mpparse.c +20 -1
@@ -558,6 +558,19 @@ static inline void __init construct_defastatic 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(unsiconstruct_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 ;
PATCH 1/1 x86: reserve exact size of mptable
Impact: cleanup
get the exact size for reserve_bootmem
--- arch/x86/kernel/mpparse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/mpparse.c +2 -2
@@ -716,10 +716,10 @@ static int __init smp_scan_config(unsignif (!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
Re: [PATCH] x86: reserve exact size of mptable
Quoted 16 lines · Yinghai Lu
Impact: cleanup
get the exact size for
reserve_bootmemSigned-off-by Yinghai Lu <[email protected]>--- arch/x86/kernel/mpparse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Index:
linux-2.6/arch/x86/kernel/mpparse.c
===================================================================
arch/x86/kernel/mpparse.c static int __init smp_scan_config(unsign · line 722
Quoted 9 lines
arch/x86/kernel/mpparse.c +2
-2@@ -716,10 +716,10 @@ static int __init smp_scan_config(unsignif (!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
[tip:x86/mm] x86: reserve exact size of mptable
In reply to Yinghai LuCommit-ID: f62432395ec54e93f113091bcb2e2017eeed7683 Gitweb: http://git.kernel.org/tip/f62432395ec54e93f113091bcb2e2017eeed7683 Author: "Yinghai Lu" <[email protected]> AuthorDate: Wed, 4 Mar 2009 01:25:54 -0800 Commit: Ingo Molnar <[email protected]> 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.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/mpparse.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/mpparse.c +2 -2
@@ -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
Re: [PATCH] x86: ioremap mptable
In reply to Yinghai LuQuoted 56 lines · Yinghai Lu
Impact: fix boot with mptable above
max_low_mappedtry to use
early_ioremapto map mpc to make sure it works even it is at end of ram on system.Signed-off-by Yinghai Lu <[email protected]>Reported-and-tested-by Kevin O'Connor <[email protected]>--- arch/x86/kernel/mpparse.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)Index:
linux-2.6/arch/x86/kernel/mpparse.c
===================================================================arch/x86/kernel/mpparse.c +18
-1@@ -558,6 +558,19 @@ static inline void __init construct_defastatic 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(unsiconstruct_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
arch/x86/kernel/mpparse.c static void __init __get_smp_config(unsi · line 650
Quoted 10 lines
arch/x86/kernel/mpparse.c +2
-0@@ -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
Re: [PATCH] x86: ioremap mptable
Quoted 65 lines · Ingo Molnar
Quoted 63 lines · Yinghai Lu
Impact: fix boot with mptable above
max_low_mappedtry to use
early_ioremapto map mpc to make sure it works even it is at end of ram on system.Signed-off-by Yinghai Lu <[email protected]>Reported-and-tested-by Kevin O'Connor <[email protected]>--- arch/x86/kernel/mpparse.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)Index:
linux-2.6/arch/x86/kernel/mpparse.c
===================================================================arch/x86/kernel/mpparse.c +20
-1@@ -558,6 +558,19 @@ static inline void __init construct_defastatic 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(unsiconstruct_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);
Quoted 9 lines
arch/x86/kernel/mpparse.c static void __init __get_smp_config(unsi · line 650
Quoted 2 lines
arch/x86/kernel/mpparse.c +0
-0if (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
Re: [PATCH] x86: ioremap mptable
Quoted 73 lines · Yinghai Lu
Quoted 72 lines · Ingo Molnar
Quoted 55 lines · Yinghai Lu
Impact: fix boot with mptable above
max_low_mappedtry to use
early_ioremapto map mpc to make sure it works even it is at end of ram on system.Signed-off-by Yinghai Lu <[email protected]>Reported-and-tested-by Kevin O'Connor <[email protected]>--- arch/x86/kernel/mpparse.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)Index:
linux-2.6/arch/x86/kernel/mpparse.c
===================================================================arch/x86/kernel/mpparse.c +18
-1@@ -558,6 +558,19 @@ static inline void __init construct_defastatic 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(unsiconstruct_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 arch/x86/kernel/mpparse.c static void __init __get_smp_config(unsi · line 650
Quoted 10 lines
arch/x86/kernel/mpparse.c +2
-0@@ -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) {
Quoted 7 lines
Quoted 2 lines
should move into a helper function, not just
get_mpc_size().will check that.
another solution is change
smp_read_mpcinterface, let it passmpf->physptrdirectly.
ok. Please pick the cleaner variant.
Ingo
[tip:x86/mm] x86: ioremap mptable
In reply to Yinghai LuCommit-ID: 8d4dd919b46ed982da6ef6bf6fcec454cd7a5b1b Gitweb: http://git.kernel.org/tip/8d4dd919b46ed982da6ef6bf6fcec454cd7a5b1b Author: "Yinghai Lu" <[email protected]> AuthorDate: Wed, 4 Mar 2009 01:25:21 -0800 Commit: Ingo Molnar <[email protected]> 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.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/mpparse.c | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-)
arch/x86/kernel/mpparse.c +20 -1
@@ -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 ;
PATCH 1/1 x86: fix bootmem cross node for 32bit numa -v2
In reply to Yinghai LuImapct: 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
--- arch/x86/mm/init_32.c | 50 +++++++++++++++++++++++++++++++++++++------------- arch/x86/mm/numa_32.c | 5 +++-- 2 files changed, 40 insertions(+), 15 deletions(-)
arch/x86/mm/init_32.c +37 -13
@@ -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 ; }
arch/x86/mm/numa_32.c +3 -2
@@ -416,10 +416,11 @@ void __init initmem_init(unsigned long sfor_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 (); }
Re: [PATCH] x86: fix bootmem cross node for 32bit numa -v2
Quoted 8 lines · Yinghai Lu
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
Re: [PATCH] x86: fix bootmem cross node for 32bit numa -v2
Quoted 4 lines · Ingo Molnar
Quoted 2 lines · Yinghai Lu
Imapct: fix panic on system 2g x4 sockets
Quoted 9 lines
Quoted 5 lines
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 codei'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
--- arch/x86/mm/init_32.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
arch/x86/mm/init_32.c +3 -13
@@ -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_breturn 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(voidprintk (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 ;
[tip:x86/mm] x86: fix bootmem cross node for 32bit numa, cleanup
Commit-ID: fc5efe3941c47c0278fe1bbcf8cc02a03a74fcda Gitweb: http://git.kernel.org/tip/fc5efe3941c47c0278fe1bbcf8cc02a03a74fcda Author: "Yinghai Lu" <[email protected]> AuthorDate: Wed, 4 Mar 2009 12:21:24 -0800 Commit: Ingo Molnar <[email protected]> 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
LKML-Reference: <[email protected]>
--- arch/x86/mm/init_32.c | 16 +++------------- 1 files changed, 3 insertions(+), 13 deletions(-)
arch/x86/mm/init_32.c +3 -13
@@ -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 ;
Commit-ID: a71edd1f46c8a599509bda478fb4eea27fb0da63 Gitweb: http://git.kernel.org/tip/a71edd1f46c8a599509bda478fb4eea27fb0da63 Author: "Yinghai Lu" <[email protected]> AuthorDate: Wed, 4 Mar 2009 01:22:35 -0800 Commit: Ingo Molnar <[email protected]> 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().
LKML-Reference: <[email protected]>
--- arch/x86/mm/init_32.c | 46 ++++++++++++++++++++++++++++++++++++++++------ arch/x86/mm/numa_32.c | 5 +++-- 2 files changed, 43 insertions(+), 8 deletions(-)
arch/x86/mm/init_32.c +40 -6
@@ -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 ; }
arch/x86/mm/numa_32.c +3 -2
@@ -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 (); }
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
Quoted 124 lines · Yinghai Lu
Commit-ID: a71edd1f46c8a599509bda478fb4eea27fb0da63
Gitweb: http://git.kernel.org/tip/a71edd1f46c8a599509bda478fb4eea27fb0da63
Author: "Yinghai Lu" <[email protected]>
AuthorDate: Wed, 4 Mar 2009 01:22:35 -0800
Commit: Ingo Molnar <[email protected]>
CommitDate: Wed, 4 Mar 2009 20:55:03 +0100x86: 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 <[email protected]>Cc Andrew Morton <[email protected]>LKML-Reference: <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>---
arch/x86/mm/init_32.c | 46 ++++++++++++++++++++++++++++++++++++++++------arch/x86/mm/numa_32.c| 5 +++--2 files changed, 43 insertions(+), 8 deletions(-)arch/x86/mm/init_32.c +40
-6@@ -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; }arch/x86/mm/numa_32.c +3
-3@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 2 lines · Yinghai Lu
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