# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxxx
# Date 1169977569 0
# Node ID 47e26ced172a971f7d347d367e7b29b9741ca9f6
# Parent fd57cef459dc80530bc76a4ffecd2dcd3ac4759a
[HVM] save/restore fix
* 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
Signed-off-by: Zhai Edwin <edwin.zhai@xxxxxxxxx>
---
xen/arch/x86/hvm/hvm.c | 19 ++++++++++++++++++-
xen/include/public/domctl.h | 2 +-
2 files changed, 19 insertions(+), 2 deletions(-)
diff -r fd57cef459dc -r 47e26ced172a xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c Sun Jan 28 09:37:18 2007 +0000
+++ b/xen/arch/x86/hvm/hvm.c Sun Jan 28 09:46:09 2007 +0000
@@ -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 fd57cef459dc -r 47e26ced172a xen/include/public/domctl.h
--- a/xen/include/public/domctl.h Sun Jan 28 09:37:18 2007 +0000
+++ b/xen/include/public/domctl.h Sun Jan 28 09:46:09 2007 +0000
@@ -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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|