save/restore fix
PATCH 1/1 save/restore fix
[PATCH][HVM] save/restore fix
Signed-off-by Zhai Edwin <[email protected]>
* 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
xen/arch/x86/hvm/hvm.c +18 -1
@@ -189,9 +189,26 @@ void hvm_domain_destroy(struct domain *dunmap_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 )
xen/include/public/domctl.h +1 -1
@@ -386,7 +386,7 @@ typedef struct xen_domctl_settimeoffsettypedef 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;