x86: don't reallocate pgt for node0
PATCH 1/1 x86: don't reallocate pgt for node0
kva ram already mapped right after away, so don't need to get that for low ram. avoid wasting one copy pgdat.
also add node id in early_res name in case get it from find_e820_area.
--- arch/x86/mm/discontig_32.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
arch/x86/mm/discontig_32.c +7 -4
@@ -156,17 +156,20 @@ static void __init propagate_e820_map_no*/ static void __init allocate_pgdat (int nid) { -if (nid &&node_has_online_mem (nid) && node_remap_start_vaddr[nid]) +char buf[16 ]; + +if (node_has_online_mem (nid) && node_remap_start_vaddr[nid])NODE_DATA (nid) = (pg_data_t *)node_remap_start_vaddr[nid];else {unsigned long pgdat_phys; pgdat_phys =find_e820_area (min_low_pfn<<PAGE_SHIFT , - (nid ? max_low_pfn:max_pfn_mapped)<<PAGE_SHIFT , + max_pfn_mapped<<PAGE_SHIFT ,sizeof (pg_data_t),PAGE_SIZE );NODE_DATA (nid) = (pg_data_t *)(pfn_to_kaddr (pgdat_phys>>PAGE_SHIFT )); -reserve_early (pgdat_phys, pgdat_phys +sizeof (pg_data_t), -"NODE_DATA" ); +memset (buf,0 ,sizeof (buf)); +sprintf (buf,"NODE_DATA %d" , nid); +reserve_early (pgdat_phys, pgdat_phys +sizeof (pg_data_t), buf); }printk (KERN_DEBUG "allocate_pgdat: node %d NODE_DATA %08lx\n" , nid, (unsigned long )NODE_DATA (nid));
Ingo Molnar
AppliedQuoted 4 lines · Yinghai Lu
kva ram already mapped right after away, so don't need to get that for low ram. avoid wasting one copy pgdat.
also add node id in
early_resname in case get it fromfind_e820_area.
applied to tip/x86/unify-setup - thanks Yinghai.
Ingo
PATCH 1/1 x86: change copy_e820_map to append_e820_map
In reply to Yinghai Luso it has meaningfull name.
also change it to static
--- arch/x86/kernel/e820.c | 15 ++++++++------- include/asm-x86/e820.h | 1 - 2 files changed, 8 insertions(+), 8 deletions(-)
arch/x86/kernel/e820.c +6 -5
@@ -360,7 +360,7 @@ int __init sanitize_e820_map(struct e820return 0 ; } -static int __init __copy_e820_map (struct e820entry *biosmap,int nr_map) +static int __init __append_e820_map (struct e820entry *biosmap,int nr_map) {while (nr_map) {u64 start = biosmap->addr;
@@ -389,13 +389,13 @@ static int __init __copy_e820_map(struct* will have given us a memory map that we can use to properly * set up memory. If we aren't, we'll fake a memory map. */ -int __init copy_e820_map (struct e820entry *biosmap,int nr_map) +static int __init append_e820_map (struct e820entry *biosmap,int nr_map) {/* Only one memory region (or negative)? Ignore it */ if (nr_map <2 )return -1 ; -return __copy_e820_map (biosmap, nr_map); +return __append_e820_map (biosmap, nr_map); } u64 __init e820_update_range(u64 start, u64 size, unsigned old_type,
@@ -581,7 +581,7 @@ void __init parse_e820_ext(struct setup_if (map_len >PAGE_SIZE ) sdata =early_ioremap (pa_data, map_len); extmap = (struct e820entry *)(sdata->data); -__copy_e820_map (extmap, entries); +__append_e820_map (extmap, entries);sanitize_e820_map (e820.map,ARRAY_SIZE (e820.map), &e820.nr_map);if (map_len >PAGE_SIZE )early_iounmap (sdata, map_len);
@@ -1245,7 +1245,8 @@ char *__init default_machine_specific_meARRAY_SIZE (boot_params.e820_map), &new_nr); boot_params.e820_entries = new_nr; -if (copy_e820_map (boot_params.e820_map, boot_params.e820_entries) <0 ) { +if (append_e820_map (boot_params.e820_map, boot_params.e820_entries) + <0 ) {u64 mem_size;/* compare results from other methods and take the greater */
include/asm-x86/e820.h +0 -1
@@ -67,7 +67,6 @@ extern void e820_add_region(u64 start, uextern void e820_print_map (char *who);extern int sanitize_e820_map (struct e820entry *biosmap,int max_nr_map,int *pnr_map); -extern int copy_e820_map (struct e820entry *biosmap,int nr_map);extern u64 e820_update_range (u64 start,u64 size,unsigned old_type,unsigned new_type); extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type,
Ingo Molnar
AppliedRe: [PATCH] x86: change copy_e820_map to append_e820_map
Quoted 2 lines · Yinghai Lu
so it has meaningfull name.
also change it to static
applied to tip/x86/unify-setup - thanks,
Ingo
PATCH 1/1 x86: make early_res_to_bootmem print out less 80 width chars
In reply to Yinghai Lu--- arch/x86/kernel/e820.c | 15 ++++++++------- include/asm-x86/e820.h | 1 - 2 files changed, 8 insertions(+), 8 deletions(-)
arch/x86/kernel/e820.c +2 -2
@@ -839,7 +839,7 @@ void __init early_res_to_bootmem(u64 staprintk (KERN_INFO "(%d early reservations) ==> bootmem\n" , count);for (i =0 ; i < count; i++) {struct early_res *r = &early_res[i]; -printk (KERN_INFO " #%d [ %010llx - %010llx ] %16s" , i, +printk (KERN_INFO " #%d [%010llx - %010llx] %16s" , i, r->start, r->end, r->name); final_start =max (start, r->start); final_end =min (end, r->end);
@@ -847,7 +847,7 @@ void __init early_res_to_bootmem(u64 staprintk (KERN_CONT "\n" );continue ; } -printk (KERN_CONT " ===> [ %010llx - %010llx ]\n" , +printk (KERN_CONT " ==> [%010llx - %010llx]\n" , final_start, final_end);reserve_bootmem_generic (final_start, final_end - final_start,BOOTMEM_DEFAULT );
Ingo Molnar
AppliedRe: [PATCH] x86: make early_res_to_bootmem print out less 80 width chars
arch/x86/kernel/e820.c void __init early_res_to_bootmem(u64 sta · line 843
Quoted 4 lines · Yinghai Lu
arch/x86/kernel/e820.c +1
-1struct early_res *r = &early_res[i]; -printk (KERN_INFO " #%d [ %010llx - %010llx ] %16s" , i, +printk (KERN_INFO " #%d [%010llx - %010llx] %16s" , i, r->start, r->end, r->name);
applied to tip/x86/unify-setup - thanks,
Ingo
PATCH 1/1 x86: not printout if not finding setup_data
In reply to Yinghai Lu--- arch/x86/kernel/setup.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/kernel/setup.c +5 -0
@@ -399,6 +399,7 @@ static void __init reserve_setup_data(vostruct setup_data *data;u64 pa_data;char buf[32 ]; +int found =0 ;if (boot_params.hdr.version <0x0209 )return ;
@@ -409,9 +410,13 @@ static void __init reserve_setup_data(voreserve_early (pa_data, pa_data+sizeof (*data)+data->len, buf);e820_update_range (pa_data,sizeof (*data)+data->len,E820_RAM ,E820_RESERVED_KERN ); + found =1 ; pa_data = data->next;early_iounmap (data,sizeof (*data)); } +if (!found) +return ; +sanitize_e820_map (e820.map,ARRAY_SIZE (e820.map), &e820.nr_map);printk (KERN_INFO "extended physical RAM map:\n" );e820_print_map ("reserve setup_data" );
Ingo Molnar
AppliedRe: [PATCH] x86: not printout if not finding setup_data
arch/x86/kernel/setup.c static void __init reserve_setup_data(vo · line 422
Quoted 13 lines · Yinghai Lu
arch/x86/kernel/setup.c +4
-0reserve_early (pa_data, pa_data+sizeof (*data)+data->len, buf);e820_update_range (pa_data,sizeof (*data)+data->len,E820_RAM ,E820_RESERVED_KERN ); + found =1 ; pa_data = data->next;early_iounmap (data,sizeof (*data)); } +if (!found) +return ; +sanitize_e820_map (e820.map,ARRAY_SIZE (e820.map), &e820.nr_map);printk (KERN_INFO "extended physical RAM map:\n" );e820_print_map ("reserve setup_data" );
applied to tip/x86/unify-setup - thanks,
Ingo
PATCH 1/1 x86: merge zones_sizes_init for numa and non numa on 32bit
In reply to Yinghai Lumove out e820_register_active_regions from non numa zones_sizes_init() and remove numa version zones_sizes_init().
and let 32 bit call remove_all_active_ranges in setup_arch directly like 64 bit
--- arch/x86/kernel/setup.c | 2 -- arch/x86/mm/discontig_32.c | 16 ---------------- arch/x86/mm/init_32.c | 10 ++++------ include/asm-x86/page_32.h | 1 - 4 files changed, 4 insertions(+), 25 deletions(-)
arch/x86/kernel/setup.c +0 -2
@@ -719,10 +719,8 @@ void __init setup_arch(char **cmdline_p)*/ acpi_boot_table_init (); -#ifdef CONFIG_X86_64 /* Remove active ranges so rediscovery with NUMA-awareness happens */ remove_all_active_ranges (); -#endif #ifdef CONFIG_ACPI_NUMA /*
arch/x86/mm/discontig_32.c +0 -16
@@ -327,7 +327,6 @@ void __init initmem_init(unsigned long s* and ZONE_HIGHMEM. */ -remove_all_active_ranges ();get_memcfg_numa (); kva_pages =round_up (calculate_numa_remap_pages (),PTRS_PER_PTE );
@@ -390,21 +389,6 @@ void __init initmem_init(unsigned long ssetup_bootmem_allocator (); } -void __init zone_sizes_init (void ) -{ -unsigned long max_zone_pfns[MAX_NR_ZONES ]; -memset (max_zone_pfns,0 ,sizeof (max_zone_pfns)); - max_zone_pfns[ZONE_DMA ] = -virt_to_phys ((char *)MAX_DMA_ADDRESS ) >>PAGE_SHIFT ; - max_zone_pfns[ZONE_NORMAL ] = max_low_pfn; -#ifdef CONFIG_HIGHMEM - max_zone_pfns[ZONE_HIGHMEM ] = highend_pfn; -#endif - -free_area_init_nodes (max_zone_pfns); -return ; -} -void __init set_highmem_pages_init (void ) {#ifdef CONFIG_HIGHMEM
arch/x86/mm/init_32.c +4 -6
@@ -660,12 +660,14 @@ void __init initmem_init(unsigned long sif (max_pfn > max_low_pfn) highstart_pfn = max_low_pfn;memory_present (0 ,0 , highend_pfn); +e820_register_active_regions (0 ,0 , highend_pfn);printk (KERN_NOTICE "%ldMB HIGHMEM available.\n" ,pages_to_mb (highend_pfn - highstart_pfn)); num_physpages = highend_pfn; high_memory = (void *)__va (highstart_pfn *PAGE_SIZE -1 ) +1 ;#else memory_present (0 ,0 , max_low_pfn); +e820_register_active_regions (0 ,0 , max_low_pfn); num_physpages = max_low_pfn; high_memory = (void *)__va (max_low_pfn *PAGE_SIZE -1 ) +1 ;#endif
@@ -677,25 +679,21 @@ void __init initmem_init(unsigned long s setup_bootmem_allocator(); } +#endif /* !CONFIG_NEED_MULTIPLE_NODES */ -void __init zone_sizes_init (void ) +static void __init zone_sizes_init (void ) {unsigned long max_zone_pfns[MAX_NR_ZONES ];memset (max_zone_pfns,0 ,sizeof (max_zone_pfns)); max_zone_pfns[ZONE_DMA ] =virt_to_phys ((char *)MAX_DMA_ADDRESS ) >>PAGE_SHIFT ; max_zone_pfns[ZONE_NORMAL ] = max_low_pfn; -remove_all_active_ranges ();#ifdef CONFIG_HIGHMEM max_zone_pfns[ZONE_HIGHMEM ] = highend_pfn; -e820_register_active_regions (0 ,0 , highend_pfn); -#else -e820_register_active_regions (0 ,0 , max_low_pfn);#endif free_area_init_nodes (max_zone_pfns); } -#endif /* !CONFIG_NEED_MULTIPLE_NODES */ void __init setup_bootmem_allocator (void ) {
include/asm-x86/page_32.h +0 -1
@@ -101,7 +101,6 @@ extern void find_low_pfn_range(void);extern unsigned long init_memory_mapping (unsigned long start,unsigned long end);extern void initmem_init (unsigned long ,unsigned long ); -extern void zone_sizes_init (void );extern void setup_bootmem_allocator (void );
Ingo Molnar
AppliedRe: [PATCH] x86: merge zones_sizes_init for numa and non numa on 32bit
Quoted 5 lines · Yinghai Lu
move out
e820_register_active_regionsfrom non numazones_sizes_init()and remove numa versionzones_sizes_init().and let 32 bit call
remove_all_active_rangesinsetup_archdirectly like 64 bit
applied to tip/x86/unify-setup - thanks,
Ingo
PATCH 1/1 x86: move init_cpu_to_node after get_smp_config
In reply to Yinghai Luwhen acpi=off, cpu_to_apicid is ready after get_smp_config so need to move init_cpu_to_node after it.
otherwise, we will get wrong cpu->node mapping. and it will rely on amd_detect_cmp to correct it. but that is too late. setup_per_cpu_data is already called before that.
we will get per_cpu_data on wrong node.
--- arch/x86/kernel/setup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/setup.c +4 -4
@@ -780,10 +780,6 @@ void __init setup_arch(char **cmdline_p)*/ acpi_boot_init (); -#ifdef CONFIG_X86_64 -init_cpu_to_node (); -#endif -#if defined(CONFIG_X86_MPPARSE ) || defined(CONFIG_X86_VISWS )/* * get boot-time SMP configuration:
@@ -792,6 +788,10 @@ void __init setup_arch(char **cmdline_p)get_smp_config ();#endif +#ifdef CONFIG_X86_64 +init_cpu_to_node (); +#endif +init_apic_mappings ();ioapic_init_mappings ();
Ingo Molnar
AppliedRe: [PATCH] x86: move init_cpu_to_node after get_smp_config
Quoted 6 lines · Yinghai Lu
when acpi=off,
cpu_to_apicidis ready afterget_smp_configso need to moveinit_cpu_to_nodeafter it.otherwise, we will get wrong
cpu->nodemapping. and it will rely onamd_detect_cmpto correct it. but that is too late.setup_per_cpu_datais already called before that. we will getper_cpu_dataon wrong node.
applied to tip/x86/unify-setup - thanks Yinghai,
Ingo
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 x86: move prefill_possible_map calling early
call it right after we done with MADT/mptable handling, instead of doing that in setup_per_cpu_areas later...
so for_possible_cpu could be used early.
--- arch/x86/kernel/setup.c | 1 + arch/x86/kernel/setup_percpu.c | 10 ---------- arch/x86/kernel/smpboot.c | 8 ++++++++ include/asm-x86/smp.h | 4 ++++ 4 files changed, 13 insertions(+), 10 deletions(-)
arch/x86/kernel/setup.c +1 -0
@@ -788,6 +788,7 @@ void __init setup_arch(char **cmdline_p)get_smp_config ();#endif +prefill_possible_map ();#ifdef CONFIG_X86_64 init_cpu_to_node ();#endif
arch/x86/kernel/setup_percpu.c +0 -10
@@ -162,16 +162,6 @@ void __init setup_per_cpu_areas(void)char *ptr;int cpu; -/* no processor from mptable or madt */ -if (!num_processors) - num_processors =1 ; - -#ifdef CONFIG_HOTPLUG_CPU -prefill_possible_map (); -#else - nr_cpu_ids = num_processors; -#endif -/* Setup cpu_pda map */ setup_cpu_pda_map ();
arch/x86/kernel/smpboot.c +8 -0
@@ -1278,12 +1278,20 @@ __init void prefill_possible_map(void)int i;int possible; +/* no processor from mptable or madt */ +if (!num_processors) + num_processors =1 ; + +#ifdef CONFIG_HOTPLUG_CPU if (additional_cpus ==-1 ) {if (disabled_cpus >0 ) additional_cpus = disabled_cpus;else additional_cpus =0 ; } +#else + additional_cpus =0 ; +#endif possible = num_processors + additional_cpus;if (possible >NR_CPUS ) possible =NR_CPUS ;
include/asm-x86/smp.h +4 -0
@@ -124,6 +124,10 @@ static inline int num_booting_cpus(void) {return cpus_weight (cpu_callout_map); } +#else +static inline void prefill_possible_map (void ) +{ +}#endif /* CONFIG_SMP */ extern unsigned disabled_cpus__cpuinitdata ;
Ingo Molnar
AppliedRe: [PATCH] x86: move prefill_possible_map calling early
Quoted 3 lines · Yinghai Lu
call it right after we done with MADT/mptable handling, instead of doing that in
setup_per_cpu_areaslater... sofor_possible_cpucould be used early.
applied to tip/x86/unify-setup - thanks Yinghai,
Ingo
Re: [PATCH] x86: move prefill_possible_map calling early
FYI, this one needed the small fixlet below. (prefill_possible_map() is dependent on both CONFIG_SMP and CONFIG_HOTPLUG_CPU - not just CONFIG_SMP)
Ingo
-------------->
commit bb42b7bdee9decad536c1e747e2ce2f3daebb76f
Author: Ingo Molnar <[email protected]> Date: Thu Jul 3 15:57:47 2008 +0200
x86: move prefill_possible_map calling early, fix
fix:
arch/x86/kernel/built-in.o: In function `setup_arch':
: undefined reference to `prefill_possible_map'
include/asm-x86/smp.h +5 -3
@@ -114,8 +114,6 @@ void native_send_call_func_single_ipi(int cpu);extern int __cpu_disable (void );extern void __cpu_die (unsigned int cpu); -extern void prefill_possible_map (void ); -void smp_store_cpu_info (int id);#define cpu_physical_id (cpu) per_cpu(x86_cpu_to_apicid, cpu)
@@ -124,11 +122,15 @@ static inline int num_booting_cpus(void) {return cpus_weight (cpu_callout_map); } +#endif /* CONFIG_SMP */ + +#if defined(CONFIG_SMP ) && defined(CONFIG_HOTPLUG_CPU ) +extern void prefill_possible_map (void );#else static inline void prefill_possible_map (void ) { } -#endif /* CONFIG_SMP */ +#endif extern unsigned disabled_cpus__cpuinitdata ;