diff options
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/kernel/cpu/common.c | 8 | ||||
-rw-r--r-- | arch/i386/kernel/smpboot.c | 13 |
2 files changed, 20 insertions, 1 deletions
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index 44f2c5f2dda..640364d9b66 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -613,6 +613,12 @@ void __cpuinit cpu_init(void) | |||
613 | set_in_cr4(X86_CR4_TSD); | 613 | set_in_cr4(X86_CR4_TSD); |
614 | } | 614 | } |
615 | 615 | ||
616 | /* The CPU hotplug case */ | ||
617 | if (cpu_gdt_descr->address) { | ||
618 | gdt = (struct desc_struct *)cpu_gdt_descr->address; | ||
619 | memset(gdt, 0, PAGE_SIZE); | ||
620 | goto old_gdt; | ||
621 | } | ||
616 | /* | 622 | /* |
617 | * This is a horrible hack to allocate the GDT. The problem | 623 | * This is a horrible hack to allocate the GDT. The problem |
618 | * is that cpu_init() is called really early for the boot CPU | 624 | * is that cpu_init() is called really early for the boot CPU |
@@ -631,7 +637,7 @@ void __cpuinit cpu_init(void) | |||
631 | local_irq_enable(); | 637 | local_irq_enable(); |
632 | } | 638 | } |
633 | } | 639 | } |
634 | 640 | old_gdt: | |
635 | /* | 641 | /* |
636 | * Initialize the per-CPU GDT with the boot GDT, | 642 | * Initialize the per-CPU GDT with the boot GDT, |
637 | * and set up the GDT descriptor: | 643 | * and set up the GDT descriptor: |
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index bce5470ecb4..9466a3c9ff0 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -1056,6 +1056,7 @@ static int __cpuinit __smp_prepare_cpu(int cpu) | |||
1056 | struct warm_boot_cpu_info info; | 1056 | struct warm_boot_cpu_info info; |
1057 | struct work_struct task; | 1057 | struct work_struct task; |
1058 | int apicid, ret; | 1058 | int apicid, ret; |
1059 | struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu); | ||
1059 | 1060 | ||
1060 | apicid = x86_cpu_to_apicid[cpu]; | 1061 | apicid = x86_cpu_to_apicid[cpu]; |
1061 | if (apicid == BAD_APICID) { | 1062 | if (apicid == BAD_APICID) { |
@@ -1063,6 +1064,18 @@ static int __cpuinit __smp_prepare_cpu(int cpu) | |||
1063 | goto exit; | 1064 | goto exit; |
1064 | } | 1065 | } |
1065 | 1066 | ||
1067 | /* | ||
1068 | * the CPU isn't initialized at boot time, allocate gdt table here. | ||
1069 | * cpu_init will initialize it | ||
1070 | */ | ||
1071 | if (!cpu_gdt_descr->address) { | ||
1072 | cpu_gdt_descr->address = get_zeroed_page(GFP_KERNEL); | ||
1073 | if (!cpu_gdt_descr->address) | ||
1074 | printk(KERN_CRIT "CPU%d failed to allocate GDT\n", cpu); | ||
1075 | ret = -ENOMEM; | ||
1076 | goto exit; | ||
1077 | } | ||
1078 | |||
1066 | info.complete = &done; | 1079 | info.complete = &done; |
1067 | info.apicid = apicid; | 1080 | info.apicid = apicid; |
1068 | info.cpu = cpu; | 1081 | info.cpu = cpu; |