WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH][HVM] save/restore fix

To: Ian Pratt <Ian.Pratt@xxxxxxxxxxxx>, Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>, Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH][HVM] save/restore fix
From: "Zhai, Edwin" <edwin.zhai@xxxxxxxxx>
Date: Sat, 27 Jan 2007 21:46:44 +0800
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, edwin.zhai@xxxxxxxxx
Delivery-date: Sat, 27 Jan 2007 05:47:02 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.11
[PATCH][HVM] save/restore fix

Signed-off-by: Zhai Edwin <edwin.zhai@xxxxxxxxx>

* do not save "down" vcpu's vmcs to avoid system crash
* make hvm_ctxt buffer bigger as all vmcs sit here, otherwise >=4 vcpus cause 
overflow


diff -r e43ef79379e1 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Fri Jan 26 16:47:47 2007 +0800
+++ b/xen/arch/x86/hvm/hvm.c    Sat Jan 27 20:37:58 2007 +0800
@@ -189,9 +189,26 @@ void hvm_domain_destroy(struct domain *d
         unmap_domain_page_global((void *)d->arch.hvm_domain.buffered_io_va);
 }
 
+#define HVM_VCPU_CTXT_MAGIC 0x85963130
+void hvm_save_cpu_ctxt(hvm_domain_context_t *h, void *opaque)
+{
+    struct vcpu *v = opaque;
+
+    if ( test_bit(_VCPUF_down, &v->vcpu_flags) ) {
+        hvm_put_32u(h, 0x0);
+        return;
+    }
+
+    hvm_put_32u(h, HVM_VCPU_CTXT_MAGIC);
+    hvm_funcs.save_cpu_ctxt(h, opaque);
+}
+
 int hvm_load_cpu_ctxt(hvm_domain_context_t *h, void *opaque, int version)
 {
     struct vcpu *v = opaque;
+
+    if ( hvm_get_32u(h) != HVM_VCPU_CTXT_MAGIC )
+        return 0;
 
     if ( hvm_funcs.load_cpu_ctxt(h, opaque, version) < 0 )
         return -EINVAL;
@@ -208,7 +225,7 @@ 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_load_cpu_ctxt, 
+                        hvm_save_cpu_ctxt, hvm_load_cpu_ctxt, 
                         (void *)v);
 
     if ( (rc = vlapic_init(v)) != 0 )
diff -r e43ef79379e1 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h       Fri Jan 26 16:47:47 2007 +0800
+++ b/xen/include/public/domctl.h       Sat Jan 27 20:29:14 2007 +0800
@@ -386,7 +386,7 @@ typedef struct xen_domctl_settimeoffset 
 typedef struct xen_domctl_settimeoffset xen_domctl_settimeoffset_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_settimeoffset_t);
  
-#define HVM_CTXT_SIZE        6144
+#define HVM_CTXT_SIZE        8192
 typedef struct hvm_domain_context {
     uint32_t cur;
     uint32_t size;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH][HVM] save/restore fix, Zhai, Edwin <=