All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhai, Edwin" <edwin.zhai@intel.com>
To: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>,
	Keir Fraser <Keir.Fraser@cl.cam.ac.uk>,
	Tim Deegan <Tim.Deegan@xensource.com>
Cc: xen-devel@lists.xensource.com, edwin.zhai@intel.com
Subject: [PATCH][HVM] save/restore fix
Date: Sat, 27 Jan 2007 21:46:44 +0800	[thread overview]
Message-ID: <20070127134644.GA4954@edwin-gen.sh.intel.com> (raw)

[PATCH][HVM] save/restore fix

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

* 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;

                 reply	other threads:[~2007-01-27 13:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070127134644.GA4954@edwin-gen.sh.intel.com \
    --to=edwin.zhai@intel.com \
    --cc=Ian.Pratt@cl.cam.ac.uk \
    --cc=Keir.Fraser@cl.cam.ac.uk \
    --cc=Tim.Deegan@xensource.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.