diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2007-05-02 13:27:10 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2007-05-02 13:27:10 -0400 |
commit | ae1ee11be77f51cedb6c569887dddc70c163ab6d (patch) | |
tree | e579a6a6d10c6835cab9af47a2795bf40f669da6 /arch/i386/kernel/smpboot.c | |
parent | 8f9aeca7a081d81c4c9862be1e04f15b5ab5461f (diff) |
[PATCH] i386: Use per-cpu variables for GDT, PDA
Allocating PDA and GDT at boot is a pain. Using simple per-cpu variables adds
happiness (although we need the GDT page-aligned for Xen, which we do in a
followup patch).
[akpm@linux-foundation.org: build fix]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'arch/i386/kernel/smpboot.c')
-rw-r--r-- | arch/i386/kernel/smpboot.c | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 7b14e88b555f..b36a5f174cc9 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -808,13 +808,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu) | |||
808 | if (IS_ERR(idle)) | 808 | if (IS_ERR(idle)) |
809 | panic("failed fork for CPU %d", cpu); | 809 | panic("failed fork for CPU %d", cpu); |
810 | 810 | ||
811 | /* Pre-allocate and initialize the CPU's GDT and PDA so it | 811 | init_gdt(cpu, idle); |
812 | doesn't have to do any memory allocation during the | ||
813 | delicate CPU-bringup phase. */ | ||
814 | if (!init_gdt(cpu, idle)) { | ||
815 | printk(KERN_INFO "Couldn't allocate GDT/PDA for CPU %d\n", cpu); | ||
816 | return -1; /* ? */ | ||
817 | } | ||
818 | 812 | ||
819 | idle->thread.eip = (unsigned long) start_secondary; | 813 | idle->thread.eip = (unsigned long) start_secondary; |
820 | /* start_eip had better be page-aligned! */ | 814 | /* start_eip had better be page-aligned! */ |
@@ -940,7 +934,6 @@ static int __cpuinit __smp_prepare_cpu(int cpu) | |||
940 | DECLARE_COMPLETION_ONSTACK(done); | 934 | DECLARE_COMPLETION_ONSTACK(done); |
941 | struct warm_boot_cpu_info info; | 935 | struct warm_boot_cpu_info info; |
942 | int apicid, ret; | 936 | int apicid, ret; |
943 | struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu); | ||
944 | 937 | ||
945 | apicid = x86_cpu_to_apicid[cpu]; | 938 | apicid = x86_cpu_to_apicid[cpu]; |
946 | if (apicid == BAD_APICID) { | 939 | if (apicid == BAD_APICID) { |
@@ -948,18 +941,6 @@ static int __cpuinit __smp_prepare_cpu(int cpu) | |||
948 | goto exit; | 941 | goto exit; |
949 | } | 942 | } |
950 | 943 | ||
951 | /* | ||
952 | * the CPU isn't initialized at boot time, allocate gdt table here. | ||
953 | * cpu_init will initialize it | ||
954 | */ | ||
955 | if (!cpu_gdt_descr->address) { | ||
956 | cpu_gdt_descr->address = get_zeroed_page(GFP_KERNEL); | ||
957 | if (!cpu_gdt_descr->address) | ||
958 | printk(KERN_CRIT "CPU%d failed to allocate GDT\n", cpu); | ||
959 | ret = -ENOMEM; | ||
960 | goto exit; | ||
961 | } | ||
962 | |||
963 | info.complete = &done; | 944 | info.complete = &done; |
964 | info.apicid = apicid; | 945 | info.apicid = apicid; |
965 | info.cpu = cpu; | 946 | info.cpu = cpu; |