aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRavikiran G Thirumalai <kiran@scalex86.org>2006-01-11 16:45:39 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-11 22:04:59 -0500
commitdf79efde82952edc653fa6eb1338a82b87aa0585 (patch)
tree67abb221cf834c3a7766c406aae1e55aa31b6bcf
parent05b3cbd8bb98736387df8a2e1efe311b1fb4d2ad (diff)
[PATCH] x86_64: Node local pda take 2 -- cpu_pda preparation
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>
-rw-r--r--arch/x86_64/kernel/irq.c4
-rw-r--r--arch/x86_64/kernel/nmi.c6
-rw-r--r--arch/x86_64/kernel/setup64.c8
-rw-r--r--arch/x86_64/kernel/smpboot.c2
-rw-r--r--arch/x86_64/kernel/traps.c11
-rw-r--r--arch/x86_64/kernel/x8664_ksyms.c2
-rw-r--r--arch/x86_64/mm/numa.c2
-rw-r--r--include/asm-x86_64/pda.h4
-rw-r--r--include/asm-x86_64/percpu.h2
9 files changed, 21 insertions, 20 deletions
diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c
index 8bf57f78d923..30d2a1e545fe 100644
--- a/arch/x86_64/kernel/irq.c
+++ b/arch/x86_64/kernel/irq.c
@@ -70,13 +70,13 @@ skip:
70 seq_printf(p, "NMI: "); 70 seq_printf(p, "NMI: ");
71 for (j = 0; j < NR_CPUS; j++) 71 for (j = 0; j < NR_CPUS; j++)
72 if (cpu_online(j)) 72 if (cpu_online(j))
73 seq_printf(p, "%10u ", cpu_pda[j].__nmi_count); 73 seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count);
74 seq_putc(p, '\n'); 74 seq_putc(p, '\n');
75#ifdef CONFIG_X86_LOCAL_APIC 75#ifdef CONFIG_X86_LOCAL_APIC
76 seq_printf(p, "LOC: "); 76 seq_printf(p, "LOC: ");
77 for (j = 0; j < NR_CPUS; j++) 77 for (j = 0; j < NR_CPUS; j++)
78 if (cpu_online(j)) 78 if (cpu_online(j))
79 seq_printf(p, "%10u ", cpu_pda[j].apic_timer_irqs); 79 seq_printf(p, "%10u ", cpu_pda(j)->apic_timer_irqs);
80 seq_putc(p, '\n'); 80 seq_putc(p, '\n');
81#endif 81#endif
82 seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); 82 seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index 39d445e16f22..40575d83d12f 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -155,19 +155,19 @@ int __init check_nmi_watchdog (void)
155 smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0); 155 smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0);
156 156
157 for (cpu = 0; cpu < NR_CPUS; cpu++) 157 for (cpu = 0; cpu < NR_CPUS; cpu++)
158 counts[cpu] = cpu_pda[cpu].__nmi_count; 158 counts[cpu] = cpu_pda(cpu)->__nmi_count;
159 local_irq_enable(); 159 local_irq_enable();
160 mdelay((10*1000)/nmi_hz); // wait 10 ticks 160 mdelay((10*1000)/nmi_hz); // wait 10 ticks
161 161
162 for (cpu = 0; cpu < NR_CPUS; cpu++) { 162 for (cpu = 0; cpu < NR_CPUS; cpu++) {
163 if (!cpu_online(cpu)) 163 if (!cpu_online(cpu))
164 continue; 164 continue;
165 if (cpu_pda[cpu].__nmi_count - counts[cpu] <= 5) { 165 if (cpu_pda(cpu)->__nmi_count - counts[cpu] <= 5) {
166 endflag = 1; 166 endflag = 1;
167 printk("CPU#%d: NMI appears to be stuck (%d->%d)!\n", 167 printk("CPU#%d: NMI appears to be stuck (%d->%d)!\n",
168 cpu, 168 cpu,
169 counts[cpu], 169 counts[cpu],
170 cpu_pda[cpu].__nmi_count); 170 cpu_pda(cpu)->__nmi_count);
171 nmi_active = 0; 171 nmi_active = 0;
172 lapic_nmi_owner &= ~LAPIC_NMI_WATCHDOG; 172 lapic_nmi_owner &= ~LAPIC_NMI_WATCHDOG;
173 nmi_perfctr_msr = 0; 173 nmi_perfctr_msr = 0;
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
index 972f5d4ce823..66325a79ed53 100644
--- a/arch/x86_64/kernel/setup64.c
+++ b/arch/x86_64/kernel/setup64.c
@@ -30,7 +30,7 @@ char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
30 30
31cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; 31cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
32 32
33struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned; 33struct x8664_pda _cpu_pda[NR_CPUS] __cacheline_aligned;
34 34
35struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; 35struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table };
36 36
@@ -110,18 +110,18 @@ void __init setup_per_cpu_areas(void)
110 } 110 }
111 if (!ptr) 111 if (!ptr)
112 panic("Cannot allocate cpu data for CPU %d\n", i); 112 panic("Cannot allocate cpu data for CPU %d\n", i);
113 cpu_pda[i].data_offset = ptr - __per_cpu_start; 113 cpu_pda(i)->data_offset = ptr - __per_cpu_start;
114 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); 114 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
115 } 115 }
116} 116}
117 117
118void pda_init(int cpu) 118void pda_init(int cpu)
119{ 119{
120 struct x8664_pda *pda = &cpu_pda[cpu]; 120 struct x8664_pda *pda = cpu_pda(cpu);
121 121
122 /* Setup up data that may be needed in __get_free_pages early */ 122 /* Setup up data that may be needed in __get_free_pages early */
123 asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0)); 123 asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0));
124 wrmsrl(MSR_GS_BASE, cpu_pda + cpu); 124 wrmsrl(MSR_GS_BASE, pda);
125 125
126 pda->cpunumber = cpu; 126 pda->cpunumber = cpu;
127 pda->irqcount = -1; 127 pda->irqcount = -1;
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index 994728564d6b..4884ca12444a 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -792,7 +792,7 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid)
792 792
793do_rest: 793do_rest:
794 794
795 cpu_pda[cpu].pcurrent = c_idle.idle; 795 cpu_pda(cpu)->pcurrent = c_idle.idle;
796 796
797 start_rip = setup_trampoline(); 797 start_rip = setup_trampoline();
798 798
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index 8d21d87b0d77..0827b141c05e 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -70,7 +70,6 @@ asmlinkage void reserved(void);
70asmlinkage void alignment_check(void); 70asmlinkage void alignment_check(void);
71asmlinkage void machine_check(void); 71asmlinkage void machine_check(void);
72asmlinkage void spurious_interrupt_bug(void); 72asmlinkage void spurious_interrupt_bug(void);
73asmlinkage void call_debug(void);
74 73
75struct notifier_block *die_chain; 74struct notifier_block *die_chain;
76static DEFINE_SPINLOCK(die_notifier_lock); 75static DEFINE_SPINLOCK(die_notifier_lock);
@@ -139,7 +138,7 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
139 switch (k + 1) { 138 switch (k + 1) {
140#if DEBUG_STKSZ > EXCEPTION_STKSZ 139#if DEBUG_STKSZ > EXCEPTION_STKSZ
141 case DEBUG_STACK: 140 case DEBUG_STACK:
142 end = cpu_pda[cpu].debugstack + DEBUG_STKSZ; 141 end = cpu_pda(cpu)->debugstack + DEBUG_STKSZ;
143 break; 142 break;
144#endif 143#endif
145 default: 144 default:
@@ -186,7 +185,7 @@ void show_trace(unsigned long *stack)
186{ 185{
187 unsigned long addr; 186 unsigned long addr;
188 const unsigned cpu = safe_smp_processor_id(); 187 const unsigned cpu = safe_smp_processor_id();
189 unsigned long *irqstack_end = (unsigned long *)cpu_pda[cpu].irqstackptr; 188 unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr;
190 int i; 189 int i;
191 unsigned used = 0; 190 unsigned used = 0;
192 191
@@ -254,8 +253,8 @@ void show_stack(struct task_struct *tsk, unsigned long * rsp)
254 unsigned long *stack; 253 unsigned long *stack;
255 int i; 254 int i;
256 const int cpu = safe_smp_processor_id(); 255 const int cpu = safe_smp_processor_id();
257 unsigned long *irqstack_end = (unsigned long *) (cpu_pda[cpu].irqstackptr); 256 unsigned long *irqstack_end = (unsigned long *) (cpu_pda(cpu)->irqstackptr);
258 unsigned long *irqstack = (unsigned long *) (cpu_pda[cpu].irqstackptr - IRQSTACKSIZE); 257 unsigned long *irqstack = (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE);
259 258
260 // debugging aid: "show_stack(NULL, NULL);" prints the 259 // debugging aid: "show_stack(NULL, NULL);" prints the
261 // back trace for this cpu. 260 // back trace for this cpu.
@@ -303,7 +302,7 @@ void show_registers(struct pt_regs *regs)
303 int in_kernel = !user_mode(regs); 302 int in_kernel = !user_mode(regs);
304 unsigned long rsp; 303 unsigned long rsp;
305 const int cpu = safe_smp_processor_id(); 304 const int cpu = safe_smp_processor_id();
306 struct task_struct *cur = cpu_pda[cpu].pcurrent; 305 struct task_struct *cur = cpu_pda(cpu)->pcurrent;
307 306
308 rsp = regs->rsp; 307 rsp = regs->rsp;
309 308
diff --git a/arch/x86_64/kernel/x8664_ksyms.c b/arch/x86_64/kernel/x8664_ksyms.c
index 3008b8339290..901f8b038dc7 100644
--- a/arch/x86_64/kernel/x8664_ksyms.c
+++ b/arch/x86_64/kernel/x8664_ksyms.c
@@ -96,7 +96,7 @@ EXPORT_SYMBOL(pci_mem_start);
96EXPORT_SYMBOL(copy_page); 96EXPORT_SYMBOL(copy_page);
97EXPORT_SYMBOL(clear_page); 97EXPORT_SYMBOL(clear_page);
98 98
99EXPORT_SYMBOL(cpu_pda); 99EXPORT_SYMBOL(_cpu_pda);
100#ifdef CONFIG_SMP 100#ifdef CONFIG_SMP
101EXPORT_SYMBOL(cpu_data); 101EXPORT_SYMBOL(cpu_data);
102EXPORT_SYMBOL(__write_lock_failed); 102EXPORT_SYMBOL(__write_lock_failed);
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index 876e34374412..994dbaeb33f0 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -272,7 +272,7 @@ __cpuinit void numa_add_cpu(int cpu)
272 272
273void __cpuinit numa_set_node(int cpu, int node) 273void __cpuinit numa_set_node(int cpu, int node)
274{ 274{
275 cpu_pda[cpu].nodenumber = node; 275 cpu_pda(cpu)->nodenumber = node;
276 cpu_to_node[cpu] = node; 276 cpu_to_node[cpu] = node;
277} 277}
278 278
diff --git a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h
index 431a909fbec9..dc33d28a72dd 100644
--- a/include/asm-x86_64/pda.h
+++ b/include/asm-x86_64/pda.h
@@ -27,7 +27,9 @@ struct x8664_pda {
27 unsigned apic_timer_irqs; 27 unsigned apic_timer_irqs;
28} ____cacheline_aligned_in_smp; 28} ____cacheline_aligned_in_smp;
29 29
30extern struct x8664_pda cpu_pda[]; 30extern struct x8664_pda _cpu_pda[];
31
32#define cpu_pda(i) (&_cpu_pda[i])
31 33
32/* 34/*
33 * There is no fast way to get the base address of the PDA, all the accesses 35 * There is no fast way to get the base address of the PDA, all the accesses
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h
index 9c71855736fb..29a6b0408f75 100644
--- a/include/asm-x86_64/percpu.h
+++ b/include/asm-x86_64/percpu.h
@@ -11,7 +11,7 @@
11 11
12#include <asm/pda.h> 12#include <asm/pda.h>
13 13
14#define __per_cpu_offset(cpu) (cpu_pda[cpu].data_offset) 14#define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset)
15#define __my_cpu_offset() read_pda(data_offset) 15#define __my_cpu_offset() read_pda(data_offset)
16 16
17/* Separate out the type, so (int[3], foo) works. */ 17/* Separate out the type, so (int[3], foo) works. */