aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-31 08:27:28 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-31 08:27:28 -0500
commit9f84653bbfba4f6c1bc7c0de914319bad55f17a4 (patch)
tree0455f3e221d6128ba1efb68135c3fbe2c2c8b390 /arch/x86/kernel
parent3ac6cffea4aa18007a454a7442da2855882f403d (diff)
parentda2c0b021cde94866f1e492f940aad29e8f61258 (diff)
Merge branch 'tj-percpu' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc into core/percpu
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/cpu/common.c25
-rw-r--r--arch/x86/kernel/setup_percpu.c2
-rw-r--r--arch/x86/kernel/smpboot.c2
-rw-r--r--arch/x86/kernel/tlb_uv.c2
4 files changed, 18 insertions, 13 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 652fdc9a757a..0f73ea423089 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -253,23 +253,28 @@ static char __cpuinit *table_lookup_model(struct cpuinfo_x86 *c)
253 253
254__u32 cleared_cpu_caps[NCAPINTS] __cpuinitdata; 254__u32 cleared_cpu_caps[NCAPINTS] __cpuinitdata;
255 255
256void load_percpu_segment(int cpu)
257{
258#ifdef CONFIG_X86_32
259 loadsegment(fs, __KERNEL_PERCPU);
260#else
261 loadsegment(gs, 0);
262 wrmsrl(MSR_GS_BASE, (unsigned long)per_cpu(irq_stack_union.gs_base, cpu));
263#endif
264}
265
256/* Current gdt points %fs at the "master" per-cpu area: after this, 266/* Current gdt points %fs at the "master" per-cpu area: after this,
257 * it's on the real one. */ 267 * it's on the real one. */
258void switch_to_new_gdt(void) 268void switch_to_new_gdt(int cpu)
259{ 269{
260 struct desc_ptr gdt_descr; 270 struct desc_ptr gdt_descr;
261 int cpu = smp_processor_id();
262 271
263 gdt_descr.address = (long)get_cpu_gdt_table(cpu); 272 gdt_descr.address = (long)get_cpu_gdt_table(cpu);
264 gdt_descr.size = GDT_SIZE - 1; 273 gdt_descr.size = GDT_SIZE - 1;
265 load_gdt(&gdt_descr); 274 load_gdt(&gdt_descr);
266 /* Reload the per-cpu base */ 275 /* Reload the per-cpu base */
267#ifdef CONFIG_X86_32 276
268 loadsegment(fs, __KERNEL_PERCPU); 277 load_percpu_segment(cpu);
269#else
270 loadsegment(gs, 0);
271 wrmsrl(MSR_GS_BASE, (unsigned long)per_cpu(irq_stack_union.gs_base, cpu));
272#endif
273} 278}
274 279
275static struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {}; 280static struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {};
@@ -993,7 +998,7 @@ void __cpuinit cpu_init(void)
993 * and set up the GDT descriptor: 998 * and set up the GDT descriptor:
994 */ 999 */
995 1000
996 switch_to_new_gdt(); 1001 switch_to_new_gdt(cpu);
997 loadsegment(fs, 0); 1002 loadsegment(fs, 0);
998 1003
999 load_idt((const struct desc_ptr *)&idt_descr); 1004 load_idt((const struct desc_ptr *)&idt_descr);
@@ -1098,7 +1103,7 @@ void __cpuinit cpu_init(void)
1098 clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); 1103 clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
1099 1104
1100 load_idt(&idt_descr); 1105 load_idt(&idt_descr);
1101 switch_to_new_gdt(); 1106 switch_to_new_gdt(cpu);
1102 1107
1103 /* 1108 /*
1104 * Set up and load the per-CPU TSS and LDT 1109 * Set up and load the per-CPU TSS and LDT
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 0d1e7ac439f4..ef91747bbed5 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -122,7 +122,7 @@ void __init setup_per_cpu_areas(void)
122 * area. Reload any changed state for the boot CPU. 122 * area. Reload any changed state for the boot CPU.
123 */ 123 */
124 if (cpu == boot_cpu_id) 124 if (cpu == boot_cpu_id)
125 switch_to_new_gdt(); 125 switch_to_new_gdt(cpu);
126 126
127 DBG("PERCPU: cpu %4d %p\n", cpu, ptr); 127 DBG("PERCPU: cpu %4d %p\n", cpu, ptr);
128 } 128 }
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index f9dbcff43546..612d3c74f6a3 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1185,7 +1185,7 @@ out:
1185void __init native_smp_prepare_boot_cpu(void) 1185void __init native_smp_prepare_boot_cpu(void)
1186{ 1186{
1187 int me = smp_processor_id(); 1187 int me = smp_processor_id();
1188 switch_to_new_gdt(); 1188 switch_to_new_gdt(me);
1189 /* already set me in cpu_online_mask in boot_cpu_init() */ 1189 /* already set me in cpu_online_mask in boot_cpu_init() */
1190 cpumask_set_cpu(me, cpu_callout_mask); 1190 cpumask_set_cpu(me, cpu_callout_mask);
1191 per_cpu(cpu_state, me) = CPU_ONLINE; 1191 per_cpu(cpu_state, me) = CPU_ONLINE;
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
index 89fce1b6d01f..f4b2f27d19b9 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/kernel/tlb_uv.c
@@ -259,7 +259,7 @@ const struct cpumask *uv_flush_send_and_wait(int cpu, int this_blade,
259 * the cpu's, all of which are still in the mask. 259 * the cpu's, all of which are still in the mask.
260 */ 260 */
261 __get_cpu_var(ptcstats).ptc_i++; 261 __get_cpu_var(ptcstats).ptc_i++;
262 return 0; 262 return flush_mask;
263 } 263 }
264 264
265 /* 265 /*