[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Fix CPU-migration of VMX domains.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 26befe042dd54cf7539a5c82449fe57938ce1fd8
# Parent  01fa38f7920701c1529d0db72cf2fac478e5e92a
Fix CPU-migration of VMX domains.

Signed-off-by: Yunhong Jiang <yunhong.jiang@xxxxxxxxx>

diff -r 01fa38f79207 -r 26befe042dd5 xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c       Thu Feb  9 10:32:17 2006
+++ b/xen/arch/x86/hvm/vmx/vmcs.c       Thu Feb  9 11:10:28 2006
@@ -73,6 +73,26 @@
     }
     set_bit(ARCH_VMX_VMCS_LOADED, &arch_vmx->flags);
     return 0;
+}
+
+static void vmx_smp_clear_vmcs(void *info)
+{
+    struct vcpu *v = (struct vcpu *)info;
+
+    ASSERT(HVM_DOMAIN(v));
+
+    if (v->arch.hvm_vmx.launch_cpu == smp_processor_id())
+        __vmpclear(virt_to_maddr(v->arch.hvm_vmx.vmcs));
+}
+
+void vmx_request_clear_vmcs(struct vcpu *v)
+{
+    ASSERT(HVM_DOMAIN(v));
+
+    if (v->arch.hvm_vmx.launch_cpu == smp_processor_id())
+        __vmpclear(virt_to_maddr(v->arch.hvm_vmx.vmcs));
+    else
+        smp_call_function(vmx_smp_clear_vmcs, v, 1, 1);
 }
 
 #if 0
@@ -167,6 +187,7 @@
     host_env.tr_base = (unsigned long) &init_tss[cpu];
     error |= __vmwrite(HOST_TR_SELECTOR, host_env.tr_selector);
     error |= __vmwrite(HOST_TR_BASE, host_env.tr_base);
+    error |= __vmwrite(HOST_RSP, (unsigned long)get_stack_bottom());
 }
 
 static void vmx_do_launch(struct vcpu *v)
@@ -212,7 +233,6 @@
     shadow_direct_map_init(v);
     __vmwrite(GUEST_CR3, pagetable_get_paddr(v->domain->arch.phys_table));
     __vmwrite(HOST_CR3, pagetable_get_paddr(v->arch.monitor_table));
-    __vmwrite(HOST_RSP, (unsigned long)get_stack_bottom());
 
     v->arch.schedule_tail = arch_vmx_do_resume;
     v->arch.hvm_vmx.launch_cpu = smp_processor_id();
@@ -510,10 +530,11 @@
     }
     else
     {
-        __vmpclear(virt_to_maddr(v->arch.hvm_vmx.vmcs));
+        vmx_request_clear_vmcs(v);
         load_vmcs(&v->arch.hvm_vmx, virt_to_maddr(v->arch.hvm_vmx.vmcs));
+        vmx_migrate_timers(v);
+        vmx_set_host_env(v);
         vmx_do_resume(v);
-        vmx_set_host_env(v);
         v->arch.hvm_vmx.launch_cpu = smp_processor_id();
         reset_stack_and_jump(vmx_asm_do_relaunch);
     }
diff -r 01fa38f79207 -r 26befe042dd5 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Thu Feb  9 10:32:17 2006
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Thu Feb  9 11:10:28 2006
@@ -91,6 +91,7 @@
                (void *)d->arch.hvm_domain.shared_page_va);
     }
 
+    vmx_request_clear_vmcs(v);
     destroy_vmcs(&v->arch.hvm_vmx);
     free_monitor_pagetable(v);
     vpit = &v->domain->arch.hvm_domain.vpit;
@@ -336,6 +337,16 @@
 {
     vmx_relinquish_resources(v);
     return 1;
+}
+
+void vmx_migrate_timers(struct vcpu *v)
+{
+    struct hvm_virpit *vpit = &(v->domain->arch.hvm_domain.vpit);
+
+    migrate_timer(&vpit->pit_timer, v->processor);
+    migrate_timer(&v->arch.hvm_vmx.hlt_timer, v->processor);
+    if ( hvm_apic_support(v->domain) && VLAPIC(v))
+        migrate_timer(&(VLAPIC(v)->vlapic_timer), v->processor);
 }
 
 void vmx_store_cpu_guest_regs(struct vcpu *v, struct cpu_user_regs *regs)
diff -r 01fa38f79207 -r 26befe042dd5 xen/include/asm-x86/hvm/vmx/vmcs.h
--- a/xen/include/asm-x86/hvm/vmx/vmcs.h        Thu Feb  9 10:32:17 2006
+++ b/xen/include/asm-x86/hvm/vmx/vmcs.h        Thu Feb  9 11:10:28 2006
@@ -94,6 +94,8 @@
 int modify_vmcs(struct arch_vmx_struct *arch_vmx,
                 struct cpu_user_regs *regs);
 void destroy_vmcs(struct arch_vmx_struct *arch_vmx);
+
+extern void vmx_request_clear_vmcs(struct vcpu *v);
 
 #define VMCS_USE_HOST_ENV       1
 #define VMCS_USE_SEPARATE_ENV   0
diff -r 01fa38f79207 -r 26befe042dd5 xen/include/asm-x86/hvm/vmx/vmx.h
--- a/xen/include/asm-x86/hvm/vmx/vmx.h Thu Feb  9 10:32:17 2006
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h Thu Feb  9 11:10:28 2006
@@ -31,7 +31,7 @@
 extern void vmx_asm_do_launch(void);
 extern void vmx_intr_assist(void);
 extern void vmx_set_tsc_shift(struct vcpu *, struct hvm_virpit *);
-
+extern void vmx_migrate_timers(struct vcpu *v);
 extern void arch_vmx_do_launch(struct vcpu *);
 extern void arch_vmx_do_resume(struct vcpu *);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.