# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1247481068 -3600
# Node ID 7406764457a029848573923e590fb210738ca6a8
# Parent 895695d91ec110469aa66322ea4633fa95a3d152
x86: move init_tss into per-CPU space
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
xen/arch/x86/acpi/suspend.c | 2 +-
xen/arch/x86/cpu/common.c | 2 +-
xen/arch/x86/domain.c | 2 +-
xen/arch/x86/hvm/vmx/vmcs.c | 2 +-
xen/arch/x86/setup.c | 2 +-
xen/arch/x86/traps.c | 4 ++--
xen/arch/x86/x86_32/mm.c | 3 +--
xen/arch/x86/x86_32/supervisor_mode_kernel.S | 4 ++--
xen/arch/x86/x86_32/traps.c | 2 +-
xen/arch/x86/x86_64/traps.c | 6 +++---
xen/include/asm-x86/processor.h | 2 +-
11 files changed, 15 insertions(+), 16 deletions(-)
diff -r 895695d91ec1 -r 7406764457a0 xen/arch/x86/acpi/suspend.c
--- a/xen/arch/x86/acpi/suspend.c Mon Jul 13 11:19:31 2009 +0100
+++ b/xen/arch/x86/acpi/suspend.c Mon Jul 13 11:31:08 2009 +0100
@@ -57,7 +57,7 @@ void restore_rest_processor_state(void)
}
#else /* !defined(CONFIG_X86_64) */
if ( supervisor_mode_kernel && cpu_has_sep )
- wrmsr(MSR_IA32_SYSENTER_ESP, &init_tss[smp_processor_id()].esp1, 0);
+ wrmsr(MSR_IA32_SYSENTER_ESP, &this_cpu(init_tss).esp1, 0);
#endif
/* Maybe load the debug registers. */
diff -r 895695d91ec1 -r 7406764457a0 xen/arch/x86/cpu/common.c
--- a/xen/arch/x86/cpu/common.c Mon Jul 13 11:19:31 2009 +0100
+++ b/xen/arch/x86/cpu/common.c Mon Jul 13 11:31:08 2009 +0100
@@ -576,7 +576,7 @@ void __cpuinit cpu_init(void)
void __cpuinit cpu_init(void)
{
int cpu = smp_processor_id();
- struct tss_struct *t = &init_tss[cpu];
+ struct tss_struct *t = &this_cpu(init_tss);
struct desc_ptr gdt_desc = {
.base = (unsigned long)(this_cpu(gdt_table) -
FIRST_RESERVED_GDT_ENTRY),
.limit = LAST_RESERVED_GDT_BYTE
diff -r 895695d91ec1 -r 7406764457a0 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c Mon Jul 13 11:19:31 2009 +0100
+++ b/xen/arch/x86/domain.c Mon Jul 13 11:31:08 2009 +0100
@@ -1223,7 +1223,7 @@ static void save_segments(struct vcpu *v
static inline void switch_kernel_stack(struct vcpu *v)
{
- struct tss_struct *tss = &init_tss[smp_processor_id()];
+ struct tss_struct *tss = &this_cpu(init_tss);
tss->esp1 = v->arch.guest_context.kernel_sp;
tss->ss1 = v->arch.guest_context.kernel_ss;
}
diff -r 895695d91ec1 -r 7406764457a0 xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c Mon Jul 13 11:19:31 2009 +0100
+++ b/xen/arch/x86/hvm/vmx/vmcs.c Mon Jul 13 11:31:08 2009 +0100
@@ -502,7 +502,7 @@ static void vmx_set_host_env(struct vcpu
__vmwrite(HOST_IDTR_BASE, (unsigned long)idt_tables[cpu]);
__vmwrite(HOST_TR_SELECTOR, TSS_ENTRY << 3);
- __vmwrite(HOST_TR_BASE, (unsigned long)&init_tss[cpu]);
+ __vmwrite(HOST_TR_BASE, (unsigned long)&per_cpu(init_tss, cpu));
__vmwrite(HOST_SYSENTER_ESP, get_stack_bottom());
diff -r 895695d91ec1 -r 7406764457a0 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c Mon Jul 13 11:19:31 2009 +0100
+++ b/xen/arch/x86/setup.c Mon Jul 13 11:31:08 2009 +0100
@@ -117,7 +117,7 @@ DEFINE_PER_CPU(struct desc_struct *, com
= boot_cpu_compat_gdt_table;
#endif
-struct tss_struct init_tss[NR_CPUS];
+DEFINE_PER_CPU(struct tss_struct, init_tss);
char __attribute__ ((__section__(".bss.stack_aligned")))
cpu0_stack[STACK_SIZE];
diff -r 895695d91ec1 -r 7406764457a0 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c Mon Jul 13 11:19:31 2009 +0100
+++ b/xen/arch/x86/traps.c Mon Jul 13 11:31:08 2009 +0100
@@ -326,7 +326,7 @@ void show_stack_overflow(unsigned int cp
printk("Valid stack range: %p-%p, sp=%p, tss.esp0=%p\n",
(void *)esp_top, (void *)esp_bottom, (void *)esp,
- (void *)init_tss[cpu].esp0);
+ (void *)per_cpu(init_tss, cpu).esp0);
/* Trigger overflow trace if %esp is within 512 bytes of the guard page. */
if ( ((unsigned long)(esp - esp_top) > 512) &&
@@ -3066,7 +3066,7 @@ void set_intr_gate(unsigned int n, void
void load_TR(void)
{
- struct tss_struct *tss = &init_tss[smp_processor_id()];
+ struct tss_struct *tss = &this_cpu(init_tss);
struct desc_ptr old_gdt, tss_gdt = {
.base = (long)(this_cpu(gdt_table) - FIRST_RESERVED_GDT_ENTRY),
.limit = LAST_RESERVED_GDT_BYTE
diff -r 895695d91ec1 -r 7406764457a0 xen/arch/x86/x86_32/mm.c
--- a/xen/arch/x86/x86_32/mm.c Mon Jul 13 11:19:31 2009 +0100
+++ b/xen/arch/x86/x86_32/mm.c Mon Jul 13 11:31:08 2009 +0100
@@ -227,8 +227,7 @@ long subarch_memory_op(int op, XEN_GUEST
long do_stack_switch(unsigned long ss, unsigned long esp)
{
- int nr = smp_processor_id();
- struct tss_struct *t = &init_tss[nr];
+ struct tss_struct *t = &this_cpu(init_tss);
fixup_guest_stack_selector(current->domain, ss);
diff -r 895695d91ec1 -r 7406764457a0
xen/arch/x86/x86_32/supervisor_mode_kernel.S
--- a/xen/arch/x86/x86_32/supervisor_mode_kernel.S Mon Jul 13 11:19:31
2009 +0100
+++ b/xen/arch/x86/x86_32/supervisor_mode_kernel.S Mon Jul 13 11:31:08
2009 +0100
@@ -102,8 +102,8 @@ ENTRY(fixup_ring0_guest_stack)
movl $PER_CPU_GDT_ENTRY*8,%ecx
lsll %ecx,%ecx
- shll $7,%ecx # Each TSS entry is
0x80 bytes
- addl $init_tss,%ecx
+ shll $PERCPU_SHIFT,%ecx
+ addl $per_cpu__init_tss,%ecx
# Load Xen stack from TSS.
movw TSS_ss0(%ecx),%ax
diff -r 895695d91ec1 -r 7406764457a0 xen/arch/x86/x86_32/traps.c
--- a/xen/arch/x86/x86_32/traps.c Mon Jul 13 11:19:31 2009 +0100
+++ b/xen/arch/x86/x86_32/traps.c Mon Jul 13 11:31:08 2009 +0100
@@ -204,7 +204,7 @@ asmlinkage void do_double_fault(void)
asm ( "lsll %1, %0" : "=r" (cpu) : "rm" (PER_CPU_GDT_ENTRY << 3) );
/* Find information saved during fault and dump it to the console. */
- tss = &init_tss[cpu];
+ tss = &per_cpu(init_tss, cpu);
printk("*** DOUBLE FAULT ***\n");
print_xen_info();
printk("CPU: %d\nEIP: %04x:[<%08x>]",
diff -r 895695d91ec1 -r 7406764457a0 xen/arch/x86/x86_64/traps.c
--- a/xen/arch/x86/x86_64/traps.c Mon Jul 13 11:19:31 2009 +0100
+++ b/xen/arch/x86/x86_64/traps.c Mon Jul 13 11:31:08 2009 +0100
@@ -433,13 +433,13 @@ void __devinit subarch_percpu_traps_init
BUILD_BUG_ON((IST_MAX + 2) * PAGE_SIZE + PRIMARY_STACK_SIZE > STACK_SIZE);
/* Machine Check handler has its own per-CPU 4kB stack. */
- init_tss[cpu].ist[IST_MCE] = (unsigned long)&stack[IST_MCE * PAGE_SIZE];
+ this_cpu(init_tss).ist[IST_MCE] = (unsigned long)&stack[IST_MCE *
PAGE_SIZE];
/* Double-fault handler has its own per-CPU 4kB stack. */
- init_tss[cpu].ist[IST_DF] = (unsigned long)&stack[IST_DF * PAGE_SIZE];
+ this_cpu(init_tss).ist[IST_DF] = (unsigned long)&stack[IST_DF * PAGE_SIZE];
/* NMI handler has its own per-CPU 4kB stack. */
- init_tss[cpu].ist[IST_NMI] = (unsigned long)&stack[IST_NMI * PAGE_SIZE];
+ this_cpu(init_tss).ist[IST_NMI] = (unsigned long)&stack[IST_NMI *
PAGE_SIZE];
/* Trampoline for SYSCALL entry from long mode. */
stack = &stack[IST_MAX * PAGE_SIZE]; /* Skip the IST stacks. */
diff -r 895695d91ec1 -r 7406764457a0 xen/include/asm-x86/processor.h
--- a/xen/include/asm-x86/processor.h Mon Jul 13 11:19:31 2009 +0100
+++ b/xen/include/asm-x86/processor.h Mon Jul 13 11:31:08 2009 +0100
@@ -456,7 +456,7 @@ extern idt_entry_t idt_table[];
extern idt_entry_t idt_table[];
extern idt_entry_t *idt_tables[];
-extern struct tss_struct init_tss[NR_CPUS];
+DECLARE_PER_CPU(struct tss_struct, init_tss);
extern void init_int80_direct_trap(struct vcpu *v);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|