* [PATCH 0/1] x86: fix remove cpu_pda table patch
@ 2008-04-28 21:09 Mike Travis
2008-04-28 21:09 ` [PATCH 1/1] x86: remove static boot_cpu_pda array v2 Mike Travis
2008-04-28 21:45 ` [PATCH 0/1] x86: fix remove cpu_pda table patch Ingo Molnar
0 siblings, 2 replies; 10+ messages in thread
From: Mike Travis @ 2008-04-28 21:09 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Andrew Morton, Thomas Gleixner, H. Peter Anvin, linux-kernel
[Ingo - please replace "PATCH 07/11" with this one.]
* Remove 544k bytes from the kernel by removing the boot_cpu_pda
array from the data section and allocating it during startup.
Fixed panic in setup_per_cpu_areas when HOTPLUG_CPU not set.
For inclusion into sched-devel/latest tree.
Based on:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
+ sched-devel/latest .../mingo/linux-2.6-sched-devel.git
Signed-off-by: Mike Travis <travis@sgi.com>
---
--
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 1/1] x86: remove static boot_cpu_pda array v2 2008-04-28 21:09 [PATCH 0/1] x86: fix remove cpu_pda table patch Mike Travis @ 2008-04-28 21:09 ` Mike Travis 2008-04-28 21:45 ` [PATCH 0/1] x86: fix remove cpu_pda table patch Ingo Molnar 1 sibling, 0 replies; 10+ messages in thread From: Mike Travis @ 2008-04-28 21:09 UTC (permalink / raw) To: Ingo Molnar; +Cc: Andrew Morton, Thomas Gleixner, H. Peter Anvin, linux-kernel [-- Attachment #1: rm-boot_pdas --] [-- Type: text/plain, Size: 9833 bytes --] * Remove the boot_cpu_pda array and pointer table from the data section. Allocate the pointer table and array during init. do_boot_cpu() will reallocate the pda in node local memory and if the cpu is being brought up before the bootmem array is released (after_bootmem = 0), then it will free the initial pda. This will happen for all cpus present at system startup. This removes 512k + 32k bytes from the data section. For inclusion into sched-devel/latest tree. Based on: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git + sched-devel/latest .../mingo/linux-2.6-sched-devel.git Signed-off-by: Mike Travis <travis@sgi.com> --- v2: Fixed panic in setup_per_cpu_areas when HOTPLUG_CPU not set. --- arch/x86/kernel/head64.c | 26 ++++++++++++++-- arch/x86/kernel/setup.c | 73 +++++++++++++++++++++++++++++++++++----------- arch/x86/kernel/setup64.c | 8 +++-- arch/x86/kernel/smpboot.c | 59 ++++++++++++++++++++++++++++--------- include/asm-x86/pda.h | 6 +-- include/linux/mm.h | 1 6 files changed, 135 insertions(+), 38 deletions(-) --- linux-2.6.sched.orig/arch/x86/kernel/head64.c +++ linux-2.6.sched/arch/x86/kernel/head64.c @@ -25,6 +25,24 @@ #include <asm/e820.h> #include <asm/bios_ebda.h> +/* boot cpu pda */ +static struct x8664_pda _boot_cpu_pda __read_mostly; + +#ifdef CONFIG_SMP +#ifdef CONFIG_DEBUG_PER_CPU_MAPS +/* + * We install an empty cpu_pda pointer table to trap references before + * the actual cpu_pda pointer table is created in setup_cpu_pda_map(). + */ +static struct x8664_pda *__cpu_pda[NR_CPUS] __initdata; +#else +static struct x8664_pda *__cpu_pda[1] __read_mostly; +#endif + +#else /* !CONFIG_SMP (NR_CPUS will be 1) */ +static struct x8664_pda *__cpu_pda[NR_CPUS] __read_mostly; +#endif + static void __init zap_identity_mappings(void) { pgd_t *pgd = pgd_offset_k(0UL); @@ -156,10 +174,12 @@ void __init x86_64_start_kernel(char * r early_printk("Kernel alive\n"); - for (i = 0; i < NR_CPUS; i++) - cpu_pda(i) = &boot_cpu_pda[i]; - + _cpu_pda = __cpu_pda; + cpu_pda(0) = &_boot_cpu_pda; pda_init(0); + + early_printk("Kernel really alive\n"); + copy_bootdata(__va(real_mode_data)); reserve_early(__pa_symbol(&_text), __pa_symbol(&_end), "TEXT DATA BSS"); --- linux-2.6.sched.orig/arch/x86/kernel/setup.c +++ linux-2.6.sched/arch/x86/kernel/setup.c @@ -100,6 +100,50 @@ static inline void setup_cpumask_of_cpu( */ unsigned long __per_cpu_offset[NR_CPUS] __read_mostly; EXPORT_SYMBOL(__per_cpu_offset); +static inline void setup_cpu_pda_map(void) { } + +#elif !defined(CONFIG_SMP) +static inline void setup_cpu_pda_map(void) { } + +#else /* CONFIG_SMP && CONFIG_X86_64 */ + +/* + * Allocate cpu_pda pointer table and array via alloc_bootmem. + */ +static void __init setup_cpu_pda_map(void) +{ + char *pda; + struct x8664_pda **new_cpu_pda; + unsigned long size; + int cpu; + + size = roundup(sizeof(struct x8664_pda), cache_line_size()); + + /* allocate cpu_pda array and pointer table */ + { + unsigned long tsize = nr_cpu_ids * sizeof(void *); + unsigned long asize = size * (nr_cpu_ids - 1); + + tsize = roundup(tsize, cache_line_size()); + new_cpu_pda = alloc_bootmem(tsize + asize); + pda = (char *)new_cpu_pda + tsize; + } + + /* initialize pointer table to static pda's */ + for_each_possible_cpu(cpu) { + if (cpu == 0) { + /* leave boot cpu pda in place */ + new_cpu_pda[0] = cpu_pda(0); + continue; + } + new_cpu_pda[cpu] = (struct x8664_pda *)pda; + new_cpu_pda[cpu]->in_bootmem = 1; + pda += size; + } + + /* point to new pointer table */ + _cpu_pda = new_cpu_pda; +} #endif /* @@ -109,46 +153,43 @@ EXPORT_SYMBOL(__per_cpu_offset); */ void __init setup_per_cpu_areas(void) { - int i, highest_cpu = 0; - unsigned long size; + ssize_t size = PERCPU_ENOUGH_ROOM; + char *ptr; + int cpu; #ifdef CONFIG_HOTPLUG_CPU prefill_possible_map(); +#else + nr_cpu_ids = num_processors; #endif + /* Setup cpu_pda map */ + setup_cpu_pda_map(); + /* Copy section for each CPU (we discard the original) */ size = PERCPU_ENOUGH_ROOM; printk(KERN_INFO "PERCPU: Allocating %lu bytes of per cpu data\n", size); - for_each_possible_cpu(i) { - char *ptr; + for_each_possible_cpu(cpu) { #ifndef CONFIG_NEED_MULTIPLE_NODES ptr = alloc_bootmem_pages(size); #else - int node = early_cpu_to_node(i); + int node = early_cpu_to_node(cpu); if (!node_online(node) || !NODE_DATA(node)) { ptr = alloc_bootmem_pages(size); printk(KERN_INFO "cpu %d has no node %d or node-local memory\n", - i, node); + cpu, node); } else ptr = alloc_bootmem_pages_node(NODE_DATA(node), size); #endif - if (!ptr) - panic("Cannot allocate cpu data for CPU %d\n", i); -#ifdef CONFIG_X86_64 - cpu_pda(i)->data_offset = ptr - __per_cpu_start; -#else - __per_cpu_offset[i] = ptr - __per_cpu_start; -#endif + per_cpu_offset(cpu) = ptr - __per_cpu_start; memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); - highest_cpu = i; } - nr_cpu_ids = highest_cpu + 1; printk(KERN_DEBUG "NR_CPUS: %d, nr_cpu_ids: %d, nr_node_ids %d\n", NR_CPUS, nr_cpu_ids, nr_node_ids); @@ -198,7 +239,7 @@ void __cpuinit numa_set_node(int cpu, in { int *cpu_to_node_map = early_per_cpu_ptr(x86_cpu_to_node_map); - if (node != NUMA_NO_NODE) + if (cpu_pda(cpu) && node != NUMA_NO_NODE) cpu_pda(cpu)->nodenumber = node; if (cpu_to_node_map) --- linux-2.6.sched.orig/arch/x86/kernel/setup64.c +++ linux-2.6.sched/arch/x86/kernel/setup64.c @@ -12,6 +12,7 @@ #include <linux/bitops.h> #include <linux/module.h> #include <linux/kgdb.h> +#include <linux/topology.h> #include <asm/pda.h> #include <asm/pgtable.h> #include <asm/processor.h> @@ -34,9 +35,8 @@ struct boot_params boot_params; cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; -struct x8664_pda *_cpu_pda[NR_CPUS] __read_mostly; +struct x8664_pda **_cpu_pda __read_mostly; EXPORT_SYMBOL(_cpu_pda); -struct x8664_pda boot_cpu_pda[NR_CPUS] __cacheline_aligned; struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table }; @@ -114,8 +114,10 @@ void pda_init(int cpu) __get_free_pages(GFP_ATOMIC, IRQSTACK_ORDER); if (!pda->irqstackptr) panic("cannot allocate irqstack for cpu %d", cpu); - } + if (pda->nodenumber == 0 && cpu_to_node(cpu) != NUMA_NO_NODE) + pda->nodenumber = cpu_to_node(cpu); + } pda->irqstackptr += IRQSTACKSIZE-64; } --- linux-2.6.sched.orig/arch/x86/kernel/smpboot.c +++ linux-2.6.sched/arch/x86/kernel/smpboot.c @@ -809,6 +809,43 @@ static void __cpuinit do_fork_idle(struc complete(&c_idle->done); } +/* + * Allocate node local memory for the AP pda. + * + * Must be called after the _cpu_pda pointer table is initialized. + */ +static int __cpuinit get_local_pda(int cpu) +{ + struct x8664_pda *oldpda, *newpda; + unsigned long size = sizeof(struct x8664_pda); + int node = cpu_to_node(cpu); + + if (cpu_pda(cpu) && !cpu_pda(cpu)->in_bootmem) + return 0; + + oldpda = cpu_pda(cpu); + newpda = kmalloc_node(size, GFP_ATOMIC, node); + if (!newpda) { + printk(KERN_ERR "Could not allocate node local PDA " + "for CPU %d on node %d\n", cpu, node); + + if (oldpda) + return 0; /* have a usable pda */ + else + return -1; + } + + if (oldpda) { + memcpy(newpda, oldpda, size); + if (!after_bootmem) + free_bootmem((unsigned long)oldpda, size); + } + + newpda->in_bootmem = 0; + cpu_pda(cpu) = newpda; + return 0; +} + static int __cpuinit do_boot_cpu(int apicid, int cpu) /* * NOTE - on most systems this is a PHYSICAL apic ID, but on multiquad @@ -834,19 +871,11 @@ static int __cpuinit do_boot_cpu(int api } /* Allocate node local memory for AP pdas */ - if (cpu_pda(cpu) == &boot_cpu_pda[cpu]) { - struct x8664_pda *newpda, *pda; - int node = cpu_to_node(cpu); - pda = cpu_pda(cpu); - newpda = kmalloc_node(sizeof(struct x8664_pda), GFP_ATOMIC, - node); - if (newpda) { - memcpy(newpda, pda, sizeof(struct x8664_pda)); - cpu_pda(cpu) = newpda; - } else - printk(KERN_ERR - "Could not allocate node local PDA for CPU %d on node %d\n", - cpu, node); + if (cpu > 0) { + boot_error = get_local_pda(cpu); + if (boot_error) + goto restore_state; + /* if can't get pda memory, can't start cpu */ } #endif @@ -965,6 +994,8 @@ do_rest: } } +restore_state: + if (boot_error) { /* Try to put things back the way they were before ... */ unmap_cpu_to_logical_apicid(cpu); @@ -1338,6 +1369,8 @@ __init void prefill_possible_map(void) for (i = 0; i < possible; i++) cpu_set(i, cpu_possible_map); + + nr_cpu_ids = possible; } static void __ref remove_cpu_from_maps(int cpu) --- linux-2.6.sched.orig/include/asm-x86/pda.h +++ linux-2.6.sched/include/asm-x86/pda.h @@ -20,7 +20,8 @@ struct x8664_pda { /* gcc-ABI: this canary MUST be at offset 40!!! */ char *irqstackptr; - int nodenumber; /* number of current node */ + short nodenumber; /* number of current node (32k max) */ + short in_bootmem; /* pda lives in bootmem */ unsigned int __softirq_pending; unsigned int __nmi_count; /* number of NMI on this CPUs */ short mmu_state; @@ -36,8 +37,7 @@ struct x8664_pda { unsigned irq_spurious_count; } ____cacheline_aligned_in_smp; -extern struct x8664_pda *_cpu_pda[]; -extern struct x8664_pda boot_cpu_pda[]; +extern struct x8664_pda **_cpu_pda; extern void pda_init(int); #define cpu_pda(i) (_cpu_pda[i]) --- linux-2.6.sched.orig/include/linux/mm.h +++ linux-2.6.sched/include/linux/mm.h @@ -1002,6 +1002,7 @@ extern void mem_init(void); extern void show_mem(void); extern void si_meminfo(struct sysinfo * val); extern void si_meminfo_node(struct sysinfo *val, int nid); +extern int after_bootmem; #ifdef CONFIG_NUMA extern void setup_per_cpu_pageset(void); -- ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/1] x86: fix remove cpu_pda table patch 2008-04-28 21:09 [PATCH 0/1] x86: fix remove cpu_pda table patch Mike Travis 2008-04-28 21:09 ` [PATCH 1/1] x86: remove static boot_cpu_pda array v2 Mike Travis @ 2008-04-28 21:45 ` Ingo Molnar 2008-04-29 16:07 ` Mike Travis 2008-04-29 17:38 ` Mike Travis 1 sibling, 2 replies; 10+ messages in thread From: Ingo Molnar @ 2008-04-28 21:45 UTC (permalink / raw) To: Mike Travis; +Cc: Andrew Morton, Thomas Gleixner, H. Peter Anvin, linux-kernel * Mike Travis <travis@sgi.com> wrote: > [Ingo - please replace "PATCH 07/11" with this one.] > > * Remove 544k bytes from the kernel by removing the boot_cpu_pda > array from the data section and allocating it during startup. > > Fixed panic in setup_per_cpu_areas when HOTPLUG_CPU not set. > > For inclusion into sched-devel/latest tree. sched-devel.git randconfig testing found another crash with your queue: [ 0.111060] Brought up 1 CPUs [ 0.111986] Total of 1 processors activated (4022.73 BogoMIPS). [ 0.112987] Testing NMI watchdog ... <1>BUG: unable to handle kernel NULL pointer dereference at 0000000000000040 [ 0.114982] IP: [<ffffffff8180d4a0>] check_nmi_watchdog+0xb0/0x210 [ 0.114982] PGD 0 [ 0.114982] Oops: 0000 [1] SMP [ 0.114982] CPU 0 [............] http://redhat.com/~mingo/misc/config-Mon_Apr_28_23_25_25_CEST_2008.bad http://redhat.com/~mingo/misc/log-Mon_Apr_28_23_25_25_CEST_2008.bad Ingo ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/1] x86: fix remove cpu_pda table patch 2008-04-28 21:45 ` [PATCH 0/1] x86: fix remove cpu_pda table patch Ingo Molnar @ 2008-04-29 16:07 ` Mike Travis 2008-04-29 17:38 ` Mike Travis 1 sibling, 0 replies; 10+ messages in thread From: Mike Travis @ 2008-04-29 16:07 UTC (permalink / raw) To: Ingo Molnar; +Cc: Andrew Morton, Thomas Gleixner, H. Peter Anvin, linux-kernel Ingo Molnar wrote: > * Mike Travis <travis@sgi.com> wrote: > >> [Ingo - please replace "PATCH 07/11" with this one.] >> >> * Remove 544k bytes from the kernel by removing the boot_cpu_pda >> array from the data section and allocating it during startup. >> >> Fixed panic in setup_per_cpu_areas when HOTPLUG_CPU not set. >> >> For inclusion into sched-devel/latest tree. > > sched-devel.git randconfig testing found another crash with your queue: > > [ 0.111060] Brought up 1 CPUs > [ 0.111986] Total of 1 processors activated (4022.73 BogoMIPS). > [ 0.112987] Testing NMI watchdog ... <1>BUG: unable to handle kernel NULL pointer dereference at 0000000000000040 > [ 0.114982] IP: [<ffffffff8180d4a0>] check_nmi_watchdog+0xb0/0x210 > [ 0.114982] PGD 0 > [ 0.114982] Oops: 0000 [1] SMP > [ 0.114982] CPU 0 > [............] > > http://redhat.com/~mingo/misc/config-Mon_Apr_28_23_25_25_CEST_2008.bad > http://redhat.com/~mingo/misc/log-Mon_Apr_28_23_25_25_CEST_2008.bad > > Ingo Ouch! ;-) Ok, I'll check it out. Thanks, Mike ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/1] x86: fix remove cpu_pda table patch 2008-04-28 21:45 ` [PATCH 0/1] x86: fix remove cpu_pda table patch Ingo Molnar 2008-04-29 16:07 ` Mike Travis @ 2008-04-29 17:38 ` Mike Travis 2008-04-29 18:53 ` Mike Travis 1 sibling, 1 reply; 10+ messages in thread From: Mike Travis @ 2008-04-29 17:38 UTC (permalink / raw) To: Ingo Molnar; +Cc: Andrew Morton, Thomas Gleixner, H. Peter Anvin, linux-kernel Ingo Molnar wrote: > * Mike Travis <travis@sgi.com> wrote: > >> [Ingo - please replace "PATCH 07/11" with this one.] >> >> * Remove 544k bytes from the kernel by removing the boot_cpu_pda >> array from the data section and allocating it during startup. >> >> Fixed panic in setup_per_cpu_areas when HOTPLUG_CPU not set. >> >> For inclusion into sched-devel/latest tree. > > sched-devel.git randconfig testing found another crash with your queue: > > [ 0.111060] Brought up 1 CPUs > [ 0.111986] Total of 1 processors activated (4022.73 BogoMIPS). > [ 0.112987] Testing NMI watchdog ... <1>BUG: unable to handle kernel NULL pointer dereference at 0000000000000040 > [ 0.114982] IP: [<ffffffff8180d4a0>] check_nmi_watchdog+0xb0/0x210 > [ 0.114982] PGD 0 > [ 0.114982] Oops: 0000 [1] SMP > [ 0.114982] CPU 0 > [............] > > http://redhat.com/~mingo/misc/config-Mon_Apr_28_23_25_25_CEST_2008.bad > http://redhat.com/~mingo/misc/log-Mon_Apr_28_23_25_25_CEST_2008.bad > > Ingo Hi Ingo, I need a bit more information on your hardware configuration. Building a kernel with the above config file started up fine on both the Intel and AMD boxes. Based on the above output it looks like it might be a UP machine? Thanks, Mike ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/1] x86: fix remove cpu_pda table patch 2008-04-29 17:38 ` Mike Travis @ 2008-04-29 18:53 ` Mike Travis 2008-04-29 21:44 ` Ingo Molnar 0 siblings, 1 reply; 10+ messages in thread From: Mike Travis @ 2008-04-29 18:53 UTC (permalink / raw) To: Ingo Molnar; +Cc: Andrew Morton, Thomas Gleixner, H. Peter Anvin, linux-kernel Mike Travis wrote: > Ingo Molnar wrote: >> * Mike Travis <travis@sgi.com> wrote: >> >>> [Ingo - please replace "PATCH 07/11" with this one.] >>> >>> * Remove 544k bytes from the kernel by removing the boot_cpu_pda >>> array from the data section and allocating it during startup. >>> >>> Fixed panic in setup_per_cpu_areas when HOTPLUG_CPU not set. >>> >>> For inclusion into sched-devel/latest tree. >> sched-devel.git randconfig testing found another crash with your queue: >> >> [ 0.111060] Brought up 1 CPUs >> [ 0.111986] Total of 1 processors activated (4022.73 BogoMIPS). >> [ 0.112987] Testing NMI watchdog ... <1>BUG: unable to handle kernel NULL pointer dereference at 0000000000000040 >> [ 0.114982] IP: [<ffffffff8180d4a0>] check_nmi_watchdog+0xb0/0x210 >> [ 0.114982] PGD 0 >> [ 0.114982] Oops: 0000 [1] SMP >> [ 0.114982] CPU 0 >> [............] >> >> http://redhat.com/~mingo/misc/config-Mon_Apr_28_23_25_25_CEST_2008.bad >> http://redhat.com/~mingo/misc/log-Mon_Apr_28_23_25_25_CEST_2008.bad >> >> Ingo > > Hi Ingo, > > I need a bit more information on your hardware configuration. Building a > kernel with the above config file started up fine on both the Intel and AMD > boxes. > > Based on the above output it looks like it might be a UP machine? ... Ok, I think I found it. In check_nmi_watchdog(): for (cpu = 0; cpu < NR_CPUS; cpu++) prev_nmi_count[cpu] = cpu_pda(cpu)->__nmi_count; As I mentioned it works fine on both of my systems so could you try it out? Thanks! Mike -- Subject: [PATCH 1/1] x86: change check_nmi_watchdog to use nr_cpu_ids * Change function check_nmi_watchdog() to use nr_cpu_ids instead of NR_CPUS. Based on: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git + sched-devel/latest .../mingo/linux-2.6-sched-devel.git Signed-off-by: Mike Travis <travis@sgi.com> --- arch/x86/kernel/nmi_64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- linux-2.6.sched.orig/arch/x86/kernel/nmi_64.c +++ linux-2.6.sched/arch/x86/kernel/nmi_64.c @@ -88,7 +88,7 @@ int __init check_nmi_watchdog(void) if (!atomic_read(&nmi_active)) return 0; - prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL); + prev_nmi_count = kmalloc(nr_cpu_ids * sizeof(int), GFP_KERNEL); if (!prev_nmi_count) return -1; @@ -99,7 +99,7 @@ int __init check_nmi_watchdog(void) smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0); #endif - for (cpu = 0; cpu < NR_CPUS; cpu++) + for (cpu = 0; cpu < nr_cpu_ids; cpu++) prev_nmi_count[cpu] = cpu_pda(cpu)->__nmi_count; local_irq_enable(); mdelay((20*1000)/nmi_hz); // wait 20 ticks ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/1] x86: fix remove cpu_pda table patch 2008-04-29 18:53 ` Mike Travis @ 2008-04-29 21:44 ` Ingo Molnar 2008-04-30 6:04 ` Ingo Molnar 0 siblings, 1 reply; 10+ messages in thread From: Ingo Molnar @ 2008-04-29 21:44 UTC (permalink / raw) To: Mike Travis; +Cc: Andrew Morton, Thomas Gleixner, H. Peter Anvin, linux-kernel * Mike Travis <travis@sgi.com> wrote: > - prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL); > + prev_nmi_count = kmalloc(nr_cpu_ids * sizeof(int), GFP_KERNEL); yeah, that makes sense ... i'll reinstate your patches and check. Ingo ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/1] x86: fix remove cpu_pda table patch 2008-04-29 21:44 ` Ingo Molnar @ 2008-04-30 6:04 ` Ingo Molnar 2008-04-30 14:15 ` Mike Travis 2008-04-30 15:02 ` [PATCH 1/1] x86: leave initial __cpu_pda array in place until cpus are booted Mike Travis 0 siblings, 2 replies; 10+ messages in thread From: Ingo Molnar @ 2008-04-30 6:04 UTC (permalink / raw) To: Mike Travis; +Cc: Andrew Morton, Thomas Gleixner, H. Peter Anvin, linux-kernel * Ingo Molnar <mingo@elte.hu> wrote: > * Mike Travis <travis@sgi.com> wrote: > > > - prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL); > > + prev_nmi_count = kmalloc(nr_cpu_ids * sizeof(int), GFP_KERNEL); > > yeah, that makes sense ... i'll reinstate your patches and check. they crashed after about 3 randconfig iterations with: early res: 4 [8000-afff] PGTABLE early res: 5 [b000-b87f] MEMNODEMAP PANIC: early exception 0e rip 10:ffffffff8077a150 error 2 cr2 37 Pid: 0, comm: swapper Not tainted 2.6.25-sched-devel.git-x86-latest.git #14 Call Trace: [<ffffffff81466196>] early_idt_handler+0x56/0x6a [<ffffffff8077a150>] ? numa_set_node+0x30/0x60 [<ffffffff8077a129>] ? numa_set_node+0x9/0x60 [<ffffffff8147a543>] numa_init_array+0x93/0xf0 [<ffffffff8147b039>] acpi_scan_nodes+0x3b9/0x3f0 [<ffffffff8147a496>] numa_initmem_init+0x136/0x150 [<ffffffff8146da5f>] setup_arch+0x48f/0x700 [<ffffffff802566ea>] ? clockevents_register_notifier+0x3a/0x50 [<ffffffff81466a87>] start_kernel+0xd7/0x440 [<ffffffff81466422>] x86_64_start_kernel+0x222/0x280 RIP 0x10 http://redhat.com/~mingo/misc/log-Wed_Apr_30_00_28_09_CEST_2008.bad http://redhat.com/~mingo/misc/config-Wed_Apr_30_00_28_09_CEST_2008.bad Ingo ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/1] x86: fix remove cpu_pda table patch 2008-04-30 6:04 ` Ingo Molnar @ 2008-04-30 14:15 ` Mike Travis 2008-04-30 15:02 ` [PATCH 1/1] x86: leave initial __cpu_pda array in place until cpus are booted Mike Travis 1 sibling, 0 replies; 10+ messages in thread From: Mike Travis @ 2008-04-30 14:15 UTC (permalink / raw) To: Ingo Molnar; +Cc: Andrew Morton, Thomas Gleixner, H. Peter Anvin, linux-kernel Ingo Molnar wrote: > * Ingo Molnar <mingo@elte.hu> wrote: > >> * Mike Travis <travis@sgi.com> wrote: >> >>> - prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL); >>> + prev_nmi_count = kmalloc(nr_cpu_ids * sizeof(int), GFP_KERNEL); >> yeah, that makes sense ... i'll reinstate your patches and check. > > they crashed after about 3 randconfig iterations with: > > early res: 4 [8000-afff] PGTABLE > early res: 5 [b000-b87f] MEMNODEMAP > PANIC: early exception 0e rip 10:ffffffff8077a150 error 2 cr2 37 > Pid: 0, comm: swapper Not tainted 2.6.25-sched-devel.git-x86-latest.git #14 > > Call Trace: > [<ffffffff81466196>] early_idt_handler+0x56/0x6a > [<ffffffff8077a150>] ? numa_set_node+0x30/0x60 > [<ffffffff8077a129>] ? numa_set_node+0x9/0x60 > [<ffffffff8147a543>] numa_init_array+0x93/0xf0 > [<ffffffff8147b039>] acpi_scan_nodes+0x3b9/0x3f0 > [<ffffffff8147a496>] numa_initmem_init+0x136/0x150 > [<ffffffff8146da5f>] setup_arch+0x48f/0x700 > [<ffffffff802566ea>] ? clockevents_register_notifier+0x3a/0x50 > [<ffffffff81466a87>] start_kernel+0xd7/0x440 > [<ffffffff81466422>] x86_64_start_kernel+0x222/0x280 > > RIP 0x10 > > > http://redhat.com/~mingo/misc/log-Wed_Apr_30_00_28_09_CEST_2008.bad > http://redhat.com/~mingo/misc/config-Wed_Apr_30_00_28_09_CEST_2008.bad > > Ingo Thanks, I'll check it out asap. I might have to change the approach of the "remove pdas" patch a bit to make it more "fail safe". Thanks, Mike ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/1] x86: leave initial __cpu_pda array in place until cpus are booted 2008-04-30 6:04 ` Ingo Molnar 2008-04-30 14:15 ` Mike Travis @ 2008-04-30 15:02 ` Mike Travis 1 sibling, 0 replies; 10+ messages in thread From: Mike Travis @ 2008-04-30 15:02 UTC (permalink / raw) To: Ingo Molnar; +Cc: Andrew Morton, Thomas Gleixner, H. Peter Anvin, linux-kernel Ingo Molnar wrote: ... > they crashed after about 3 randconfig iterations with: > > early res: 4 [8000-afff] PGTABLE > early res: 5 [b000-b87f] MEMNODEMAP > PANIC: early exception 0e rip 10:ffffffff8077a150 error 2 cr2 37 > Pid: 0, comm: swapper Not tainted 2.6.25-sched-devel.git-x86-latest.git #14 > > Call Trace: > [<ffffffff81466196>] early_idt_handler+0x56/0x6a > [<ffffffff8077a150>] ? numa_set_node+0x30/0x60 > [<ffffffff8077a129>] ? numa_set_node+0x9/0x60 > [<ffffffff8147a543>] numa_init_array+0x93/0xf0 > [<ffffffff8147b039>] acpi_scan_nodes+0x3b9/0x3f0 > [<ffffffff8147a496>] numa_initmem_init+0x136/0x150 > [<ffffffff8146da5f>] setup_arch+0x48f/0x700 > [<ffffffff802566ea>] ? clockevents_register_notifier+0x3a/0x50 > [<ffffffff81466a87>] start_kernel+0xd7/0x440 > [<ffffffff81466422>] x86_64_start_kernel+0x222/0x280 ... Here's the fixup... This one should follow the previous patches. Thanks, Mike --- Subject: [PATCH 1/1] x86: leave initial __cpu_pda array in place until cpus are booted * The __cpu_pda table must be a set of NULL entries (except for the boot cpu) to indicate to numa_set_node during early system initialization that the cpu pdas are not yet setup. The pda nodenumber is set later in pda_init(). Based on: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git + sched-devel/latest .../mingo/linux-2.6-sched-devel.git Signed-off-by: Mike Travis <travis@sgi.com> --- arch/x86/kernel/head64.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) --- linux-2.6.sched.orig/arch/x86/kernel/head64.c +++ linux-2.6.sched/arch/x86/kernel/head64.c @@ -29,17 +29,13 @@ static struct x8664_pda _boot_cpu_pda __read_mostly; #ifdef CONFIG_SMP -#ifdef CONFIG_DEBUG_PER_CPU_MAPS /* - * We install an empty cpu_pda pointer table to trap references before - * the actual cpu_pda pointer table is created in setup_cpu_pda_map(). + * We install an empty cpu_pda pointer table to indicate to early users + * (numa_set_node) that the cpu_pda pointer table for cpus other than + * the boot cpu is not yet setup. */ static struct x8664_pda *__cpu_pda[NR_CPUS] __initdata; #else -static struct x8664_pda *__cpu_pda[1] __read_mostly; -#endif - -#else /* !CONFIG_SMP (NR_CPUS will be 1) */ static struct x8664_pda *__cpu_pda[NR_CPUS] __read_mostly; #endif ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-04-30 15:02 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-04-28 21:09 [PATCH 0/1] x86: fix remove cpu_pda table patch Mike Travis 2008-04-28 21:09 ` [PATCH 1/1] x86: remove static boot_cpu_pda array v2 Mike Travis 2008-04-28 21:45 ` [PATCH 0/1] x86: fix remove cpu_pda table patch Ingo Molnar 2008-04-29 16:07 ` Mike Travis 2008-04-29 17:38 ` Mike Travis 2008-04-29 18:53 ` Mike Travis 2008-04-29 21:44 ` Ingo Molnar 2008-04-30 6:04 ` Ingo Molnar 2008-04-30 14:15 ` Mike Travis 2008-04-30 15:02 ` [PATCH 1/1] x86: leave initial __cpu_pda array in place until cpus are booted Mike Travis
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.