diff options
author | Zachary Amsden <zach@vmware.com> | 2006-01-06 03:11:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:33:33 -0500 |
commit | 7c4cb60e5b97677424e95baee9c29df54b26e6ba (patch) | |
tree | a2ad6e6104e153d15bc4bfbb67f74b0e05fea03c /arch | |
parent | 599a6e8ca4ff7f453f847217ecc2718d68e3b0f6 (diff) |
[PATCH] x86: GDT alignment fix
Make GDT page aligned and page padded to support running inside of a
hypervisor. This prevents false sharing of the GDT page with other hot
data, which is not allowed in Xen, and causes performance problems in
VMware.
Rather than go back to the old method of statically allocating the GDT
(which wastes unneded space for non-present CPUs), the GDT for APs is
allocated dynamically.
Signed-off-by: Zachary Amsden <zach@vmware.com>
Cc: "Seth, Rohit" <rohit.seth@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/apm.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/common.c | 3 | ||||
-rw-r--r-- | arch/i386/kernel/head.S | 2 | ||||
-rw-r--r-- | arch/i386/kernel/i386_ksyms.c | 3 | ||||
-rw-r--r-- | arch/i386/kernel/smpboot.c | 6 |
5 files changed, 11 insertions, 5 deletions
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c index 1e60acbed3c1..6c8e483ce9e4 100644 --- a/arch/i386/kernel/apm.c +++ b/arch/i386/kernel/apm.c | |||
@@ -2317,6 +2317,8 @@ static int __init apm_init(void) | |||
2317 | 2317 | ||
2318 | for (i = 0; i < NR_CPUS; i++) { | 2318 | for (i = 0; i < NR_CPUS; i++) { |
2319 | struct desc_struct *gdt = get_cpu_gdt_table(i); | 2319 | struct desc_struct *gdt = get_cpu_gdt_table(i); |
2320 | if (!gdt) | ||
2321 | continue; | ||
2320 | set_base(gdt[APM_CS >> 3], | 2322 | set_base(gdt[APM_CS >> 3], |
2321 | __va((unsigned long)apm_info.bios.cseg << 4)); | 2323 | __va((unsigned long)apm_info.bios.cseg << 4)); |
2322 | set_base(gdt[APM_CS_16 >> 3], | 2324 | set_base(gdt[APM_CS_16 >> 3], |
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index 31e344b26bae..cbc32069683f 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -18,9 +18,6 @@ | |||
18 | 18 | ||
19 | #include "cpu.h" | 19 | #include "cpu.h" |
20 | 20 | ||
21 | DEFINE_PER_CPU(struct desc_struct, cpu_gdt_table[GDT_ENTRIES]); | ||
22 | EXPORT_PER_CPU_SYMBOL(cpu_gdt_table); | ||
23 | |||
24 | DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]); | 21 | DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]); |
25 | EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack); | 22 | EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack); |
26 | 23 | ||
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S index e437fb367498..870f20bf33c8 100644 --- a/arch/i386/kernel/head.S +++ b/arch/i386/kernel/head.S | |||
@@ -525,3 +525,5 @@ ENTRY(cpu_gdt_table) | |||
525 | .quad 0x0000000000000000 /* 0xf0 - unused */ | 525 | .quad 0x0000000000000000 /* 0xf0 - unused */ |
526 | .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */ | 526 | .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */ |
527 | 527 | ||
528 | /* Be sure this is zeroed to avoid false validations in Xen */ | ||
529 | .fill PAGE_SIZE_asm / 8 - GDT_ENTRIES,8,0 | ||
diff --git a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c index 180f070d03cb..3999bec50c33 100644 --- a/arch/i386/kernel/i386_ksyms.c +++ b/arch/i386/kernel/i386_ksyms.c | |||
@@ -3,8 +3,7 @@ | |||
3 | #include <asm/checksum.h> | 3 | #include <asm/checksum.h> |
4 | #include <asm/desc.h> | 4 | #include <asm/desc.h> |
5 | 5 | ||
6 | /* This is definitely a GPL-only symbol */ | 6 | EXPORT_SYMBOL_GPL(cpu_gdt_descr); |
7 | EXPORT_SYMBOL_GPL(cpu_gdt_table); | ||
8 | 7 | ||
9 | EXPORT_SYMBOL(__down_failed); | 8 | EXPORT_SYMBOL(__down_failed); |
10 | EXPORT_SYMBOL(__down_failed_interruptible); | 9 | EXPORT_SYMBOL(__down_failed_interruptible); |
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 9ed449af8e9f..b3c2e2c26743 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -903,6 +903,12 @@ static int __devinit do_boot_cpu(int apicid, int cpu) | |||
903 | unsigned long start_eip; | 903 | unsigned long start_eip; |
904 | unsigned short nmi_high = 0, nmi_low = 0; | 904 | unsigned short nmi_high = 0, nmi_low = 0; |
905 | 905 | ||
906 | if (!cpu_gdt_descr[cpu].address && | ||
907 | !(cpu_gdt_descr[cpu].address = get_zeroed_page(GFP_KERNEL))) { | ||
908 | printk("Failed to allocate GDT for CPU %d\n", cpu); | ||
909 | return 1; | ||
910 | } | ||
911 | |||
906 | ++cpucount; | 912 | ++cpucount; |
907 | 913 | ||
908 | /* | 914 | /* |