aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu
diff options
context:
space:
mode:
authorBrian Gerst <brgerst@gmail.com>2009-01-26 22:56:48 -0500
committerTejun Heo <tj@kernel.org>2009-01-26 22:56:48 -0500
commit2697fbd5faf19c84c17441b1752bdcbdcfd1248c (patch)
tree70bdf58fba94bf9ff94b2b6372662da89add9723 /arch/x86/kernel/cpu
parent1825b8edc2034c012ae48f797d74efd1bd9d4f72 (diff)
x86: load new GDT after setting up boot cpu per-cpu area
Impact: sync 32 and 64-bit code Merge load_gs_base() into switch_to_new_gdt(). Load the GDT and per-cpu state for the boot cpu when its new area is set up. Signed-off-by: Brian Gerst <brgerst@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch/x86/kernel/cpu')
-rw-r--r--arch/x86/kernel/cpu/common.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 67e30c8a282c..0c766b80d915 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -258,12 +258,17 @@ __u32 cleared_cpu_caps[NCAPINTS] __cpuinitdata;
258void switch_to_new_gdt(void) 258void switch_to_new_gdt(void)
259{ 259{
260 struct desc_ptr gdt_descr; 260 struct desc_ptr gdt_descr;
261 int cpu = smp_processor_id();
261 262
262 gdt_descr.address = (long)get_cpu_gdt_table(smp_processor_id()); 263 gdt_descr.address = (long)get_cpu_gdt_table(cpu);
263 gdt_descr.size = GDT_SIZE - 1; 264 gdt_descr.size = GDT_SIZE - 1;
264 load_gdt(&gdt_descr); 265 load_gdt(&gdt_descr);
266 /* Reload the per-cpu base */
265#ifdef CONFIG_X86_32 267#ifdef CONFIG_X86_32
266 asm("mov %0, %%fs" : : "r" (__KERNEL_PERCPU) : "memory"); 268 loadsegment(fs, __KERNEL_PERCPU);
269#else
270 loadsegment(gs, 0);
271 wrmsrl(MSR_GS_BASE, (unsigned long)per_cpu(irq_stack_union.gs_base, cpu));
267#endif 272#endif
268} 273}
269 274
@@ -968,10 +973,6 @@ void __cpuinit cpu_init(void)
968 struct task_struct *me; 973 struct task_struct *me;
969 int i; 974 int i;
970 975
971 loadsegment(fs, 0);
972 loadsegment(gs, 0);
973 load_gs_base(cpu);
974
975#ifdef CONFIG_NUMA 976#ifdef CONFIG_NUMA
976 if (cpu != 0 && percpu_read(node_number) == 0 && 977 if (cpu != 0 && percpu_read(node_number) == 0 &&
977 cpu_to_node(cpu) != NUMA_NO_NODE) 978 cpu_to_node(cpu) != NUMA_NO_NODE)
@@ -993,6 +994,8 @@ void __cpuinit cpu_init(void)
993 */ 994 */
994 995
995 switch_to_new_gdt(); 996 switch_to_new_gdt();
997 loadsegment(fs, 0);
998
996 load_idt((const struct desc_ptr *)&idt_descr); 999 load_idt((const struct desc_ptr *)&idt_descr);
997 1000
998 memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8); 1001 memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8);