[PATCH] x86_64: Node local pda take 2 -- cpu_pda preparation
authorRavikiran G Thirumalai <kiran@scalex86.org>
Wed, 11 Jan 2006 21:45:39 +0000 (22:45 +0100)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 12 Jan 2006 03:04:59 +0000 (19:04 -0800)
Helper patch to change cpu_pda users to use macros to access cpu_pda
instead of the cpu_pda[] array.

Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>
Signed-off-by: Shai Fultheim <shai@scalex86.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/x86_64/kernel/irq.c
arch/x86_64/kernel/nmi.c
arch/x86_64/kernel/setup64.c
arch/x86_64/kernel/smpboot.c
arch/x86_64/kernel/traps.c
arch/x86_64/kernel/x8664_ksyms.c
arch/x86_64/mm/numa.c
include/asm-x86_64/pda.h
include/asm-x86_64/percpu.h

index 8bf57f78d92317b47b63c5925541866891118d91..30d2a1e545fea1fda11f9010ffd25d67854e8baa 100644 (file)
@@ -70,13 +70,13 @@ skip:
                seq_printf(p, "NMI: ");
                for (j = 0; j < NR_CPUS; j++)
                        if (cpu_online(j))
-                               seq_printf(p, "%10u ", cpu_pda[j].__nmi_count);
+                               seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count);
                seq_putc(p, '\n');
 #ifdef CONFIG_X86_LOCAL_APIC
                seq_printf(p, "LOC: ");
                for (j = 0; j < NR_CPUS; j++)
                        if (cpu_online(j))
-                               seq_printf(p, "%10u ", cpu_pda[j].apic_timer_irqs);
+                               seq_printf(p, "%10u ", cpu_pda(j)->apic_timer_irqs);
                seq_putc(p, '\n');
 #endif
                seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
index 39d445e16f2254441b29dcfb6a5a37de5439ca8a..40575d83d12fe01ea69f215be9aad62a87b10b9b 100644 (file)
@@ -155,19 +155,19 @@ int __init check_nmi_watchdog (void)
                smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0);
 
        for (cpu = 0; cpu < NR_CPUS; cpu++)
-               counts[cpu] = cpu_pda[cpu].__nmi_count; 
+               counts[cpu] = cpu_pda(cpu)->__nmi_count;
        local_irq_enable();
        mdelay((10*1000)/nmi_hz); // wait 10 ticks
 
        for (cpu = 0; cpu < NR_CPUS; cpu++) {
                if (!cpu_online(cpu))
                        continue;
-               if (cpu_pda[cpu].__nmi_count - counts[cpu] <= 5) {
+               if (cpu_pda(cpu)->__nmi_count - counts[cpu] <= 5) {
                        endflag = 1;
                        printk("CPU#%d: NMI appears to be stuck (%d->%d)!\n",
                               cpu,
                               counts[cpu],
-                              cpu_pda[cpu].__nmi_count);
+                              cpu_pda(cpu)->__nmi_count);
                        nmi_active = 0;
                        lapic_nmi_owner &= ~LAPIC_NMI_WATCHDOG;
                        nmi_perfctr_msr = 0;
index 972f5d4ce823fd413742891c137d0ab25d042c21..66325a79ed531181713184d9441df8e47fb82b0b 100644 (file)
@@ -30,7 +30,7 @@ char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
 
 cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
 
-struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned; 
+struct x8664_pda _cpu_pda[NR_CPUS] __cacheline_aligned;
 
 struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; 
 
@@ -110,18 +110,18 @@ void __init setup_per_cpu_areas(void)
                }
                if (!ptr)
                        panic("Cannot allocate cpu data for CPU %d\n", i);
-               cpu_pda[i].data_offset = ptr - __per_cpu_start;
+               cpu_pda(i)->data_offset = ptr - __per_cpu_start;
                memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
        }
 } 
 
 void pda_init(int cpu)
 { 
-       struct x8664_pda *pda = &cpu_pda[cpu];
+       struct x8664_pda *pda = cpu_pda(cpu);
 
        /* Setup up data that may be needed in __get_free_pages early */
        asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0)); 
-       wrmsrl(MSR_GS_BASE, cpu_pda + cpu);
+       wrmsrl(MSR_GS_BASE, pda);
 
        pda->cpunumber = cpu; 
        pda->irqcount = -1;
index 994728564d6b7d168e06f8b2cb126fb85be7d565..4884ca12444af68aac77aa5ac46f7239cc77a6f5 100644 (file)
@@ -792,7 +792,7 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid)
 
 do_rest:
 
-       cpu_pda[cpu].pcurrent = c_idle.idle;
+       cpu_pda(cpu)->pcurrent = c_idle.idle;
 
        start_rip = setup_trampoline();
 
index 8d21d87b0d77ecb98e1dca83d286c2b99b76a936..0827b141c05ea5747aa95c4613441ed190ffecf4 100644 (file)
@@ -70,7 +70,6 @@ asmlinkage void reserved(void);
 asmlinkage void alignment_check(void);
 asmlinkage void machine_check(void);
 asmlinkage void spurious_interrupt_bug(void);
-asmlinkage void call_debug(void);
 
 struct notifier_block *die_chain;
 static DEFINE_SPINLOCK(die_notifier_lock);
@@ -139,7 +138,7 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
                switch (k + 1) {
 #if DEBUG_STKSZ > EXCEPTION_STKSZ
                case DEBUG_STACK:
-                       end = cpu_pda[cpu].debugstack + DEBUG_STKSZ;
+                       end = cpu_pda(cpu)->debugstack + DEBUG_STKSZ;
                        break;
 #endif
                default:
@@ -186,7 +185,7 @@ void show_trace(unsigned long *stack)
 {
        unsigned long addr;
        const unsigned cpu = safe_smp_processor_id();
-       unsigned long *irqstack_end = (unsigned long *)cpu_pda[cpu].irqstackptr;
+       unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr;
        int i;
        unsigned used = 0;
 
@@ -254,8 +253,8 @@ void show_stack(struct task_struct *tsk, unsigned long * rsp)
        unsigned long *stack;
        int i;
        const int cpu = safe_smp_processor_id();
-       unsigned long *irqstack_end = (unsigned long *) (cpu_pda[cpu].irqstackptr);
-       unsigned long *irqstack = (unsigned long *) (cpu_pda[cpu].irqstackptr - IRQSTACKSIZE);    
+       unsigned long *irqstack_end = (unsigned long *) (cpu_pda(cpu)->irqstackptr);
+       unsigned long *irqstack = (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE);
 
        // debugging aid: "show_stack(NULL, NULL);" prints the
        // back trace for this cpu.
@@ -303,7 +302,7 @@ void show_registers(struct pt_regs *regs)
        int in_kernel = !user_mode(regs);
        unsigned long rsp;
        const int cpu = safe_smp_processor_id(); 
-       struct task_struct *cur = cpu_pda[cpu].pcurrent; 
+       struct task_struct *cur = cpu_pda(cpu)->pcurrent;
 
                rsp = regs->rsp;
 
index 3008b8339290b79ad9d4e6dfd3753d26d950421a..901f8b038dc7765330e40bd8174b09c5c7dc55e1 100644 (file)
@@ -96,7 +96,7 @@ EXPORT_SYMBOL(pci_mem_start);
 EXPORT_SYMBOL(copy_page);
 EXPORT_SYMBOL(clear_page);
 
-EXPORT_SYMBOL(cpu_pda);
+EXPORT_SYMBOL(_cpu_pda);
 #ifdef CONFIG_SMP
 EXPORT_SYMBOL(cpu_data);
 EXPORT_SYMBOL(__write_lock_failed);
index 876e343744128f57d10b6ea2c70165da3cf62e64..994dbaeb33f0f7b5ab4b5ef572fe0efaceb06dec 100644 (file)
@@ -272,7 +272,7 @@ __cpuinit void numa_add_cpu(int cpu)
 
 void __cpuinit numa_set_node(int cpu, int node)
 {
-       cpu_pda[cpu].nodenumber = node;
+       cpu_pda(cpu)->nodenumber = node;
        cpu_to_node[cpu] = node;
 }
 
index 431a909fbec99de8eeb9ce9bdd58503e930c676f..dc33d28a72dd334444a70cc2275f0da641f8de51 100644 (file)
@@ -27,7 +27,9 @@ struct x8664_pda {
        unsigned apic_timer_irqs;
 } ____cacheline_aligned_in_smp;
 
-extern struct x8664_pda cpu_pda[];
+extern struct x8664_pda _cpu_pda[];
+
+#define cpu_pda(i) (&_cpu_pda[i])
 
 /* 
  * There is no fast way to get the base address of the PDA, all the accesses
index 9c71855736fb90d98fc2ddb5a20793f4ce41b593..29a6b0408f755c1f1a8f6fd4c4016845df6b52d7 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <asm/pda.h>
 
-#define __per_cpu_offset(cpu) (cpu_pda[cpu].data_offset)
+#define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset)
 #define __my_cpu_offset() read_pda(data_offset)
 
 /* Separate out the type, so (int[3], foo) works. */