Skip to contentSkip to conversation

HVM smp guest save/restore support

PATCH Applied Zhai, Edwin 2 participants 6 messages Jan 23, 2007 – Jan 25, 2007

lore
Share & tools
lore
#0 lore raw

Keir,

smp save/restore has been reverted in the changeset 13499:
*****************************************

xen/common/domain.c Fri Jan 19 12:03:51 2007 +0000 renamed from xen/common/domain.c Fri Jan 19 11:58:52 2007 +0000 +0 -8
@@ -506,14 +506,6 @@ int set_info_guest(struct domain *d,
     if ( rc == 0 )
         rc = arch_set_info_guest(v, c);
 
-    /*XXX: hvm smp guest restore support */
-    if ( rc == 0 &&
-            v->vcpu_id != 0 &&
-            is_hvm_vcpu(v) &&
-            test_and_clear_bit(_VCPUF_down, &v->vcpu_flags) ) {
-        vcpu_wake(v);
-    }
-
     domain_unpause(d);
 
     xfree(c.nat);

******************************************

this code wake up all the aps like hvm_bringup_ap, since no IPI for ap when restore.
if it's slightly ugly, how about add a similar hypercall like xc_domain_resume?

thanks,

Signature · 2 lines
best rgds,
edwin
#1 lore raw
Quoted 4 lines · Edwin

this code wake up all the aps like hvm_bringup_ap, since no IPI for ap when restore.
if it's slightly ugly, how about add a similar hypercall like xc_domain_resume?

All hvm vcpu context restore should be done via the new hvm domctl, and the wakeup of APs can be implemented there (rather than in common/ directory).

-- Keir

#2 lore raw
Quoted 2 lines · Keir Fraser

All hvm vcpu context restore should be done via the new hvm domctl, and the wakeup of APs can be implemented there (rather than in common/ directory).

how about this patch?
thanks,

Quoted 3 lines

-- Keir

Signature · 2 lines
best rgds,
edwin
xen/arch/x86/hvm/vmx/vmx.c +6 -0
diff -r bea505a69722 xen/arch/x86/hvm/vmx/vmx.c
@@ -659,6 +659,12 @@ int vmx_load_vmcs_ctxt(hvm_domain_contex
         printk("vmx_vmcs restore failed!\n");
         domain_crash(v->domain);
         return -EINVAL;
+    }
+
+    /* wake up this vcpu for smp support */
+    if ( is_hvm_vcpu(v) &&
+            test_and_clear_bit(_VCPUF_down, &v->vcpu_flags) ) {
+        vcpu_wake(v);
     }
 
     return 0;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
Quoted 5 lines · Edwin
Quoted 2 lines

All hvm vcpu context restore should be done via the new hvm domctl, and the wakeup of APs can be implemented there (rather than in common/ directory).

how about this patch?
thanks,

This new piece of code is not VMX specific. Define an hvm_load_cpu_ctxt() function which executes that new piece of code after calling the VMX/SVM specific hook function. Also you shouldn't need to check if the vcpu is HVM, as otherwise you wouldn't be in this function!

-- Keir

#4 lore raw

thanks for your comments,
update it.

thanks,

Quoted 15 lines · Keir Fraser
Quoted 5 lines · Edwin
Quoted 2 lines

All hvm vcpu context restore should be done via the new hvm domctl, and the wakeup of APs can be implemented there (rather than in common/ directory).

how about this patch?
thanks,

This new piece of code is not VMX specific. Define an hvm_load_cpu_ctxt() function which executes that new piece of code after calling the VMX/SVM specific hook function. Also you shouldn't need to check if the vcpu is HVM, as otherwise you wouldn't be in this function!

-- Keir

Signature · 2 lines
best rgds,
edwin
xen/arch/x86/hvm/hvm.c +16 -1
diff -r bea505a69722 xen/arch/x86/hvm/hvm.c
@@ -170,12 +170,27 @@ void hvm_domain_destroy(struct domain *d
         unmap_domain_page_global((void *)d->arch.hvm_domain.buffered_io_va);
 }
 
+int hvm_load_cpu_ctxt(hvm_domain_context_t *h, void *opaque, int version)
+{
+    struct vcpu *v = opaque;
+
+    if ( hvm_funcs.load_cpu_ctxt(h, opaque, version) < 0 )
+        return -EINVAL;
+
+    /* wake up this vcpu for smp support */
+    if ( test_and_clear_bit(_VCPUF_down, &v->vcpu_flags) ) {
+        vcpu_wake(v);
+    }
+
+    return 0;
+}
+
 int hvm_vcpu_initialise(struct vcpu *v)
 {
     int rc;
 
     hvm_register_savevm(v->domain, "xen_hvm_cpu", v->vcpu_id, 1,
-                        hvm_funcs.save_cpu_ctxt, hvm_funcs.load_cpu_ctxt, 
+                        hvm_funcs.save_cpu_ctxt, hvm_load_cpu_ctxt, 
                         (void *)v);
 
     if ( (rc = vlapic_init(v)) != 0 )

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Applied
#5 lore raw

Applied, thanks.

Quoted 21 lines · Edwin

thanks for your comments,
update it.

thanks,

Quoted 15 lines · Keir Fraser
Quoted 5 lines · Edwin
Quoted 2 lines

All hvm vcpu context restore should be done via the new hvm domctl, and the wakeup of APs can be implemented there (rather than in common/ directory).

how about this patch?
thanks,

This new piece of code is not VMX specific. Define an hvm_load_cpu_ctxt() function which executes that new piece of code after calling the VMX/SVM specific hook function. Also you shouldn't need to check if the vcpu is HVM, as otherwise you wouldn't be in this function!

-- Keir