ia64/xen-unstable

changeset 13677:47e26ced172a

[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@intel.com>
author kaf24@localhost.localdomain
date Sun Jan 28 09:46:09 2007 +0000 (2007-01-28)
parents fd57cef459dc
children fbe161b1af16
files xen/arch/x86/hvm/hvm.c xen/include/public/domctl.h
line diff
     1.1 --- a/xen/arch/x86/hvm/hvm.c	Sun Jan 28 09:37:18 2007 +0000
     1.2 +++ b/xen/arch/x86/hvm/hvm.c	Sun Jan 28 09:46:09 2007 +0000
     1.3 @@ -189,10 +189,27 @@ void hvm_domain_destroy(struct domain *d
     1.4          unmap_domain_page_global((void *)d->arch.hvm_domain.buffered_io_va);
     1.5  }
     1.6  
     1.7 +#define HVM_VCPU_CTXT_MAGIC 0x85963130
     1.8 +void hvm_save_cpu_ctxt(hvm_domain_context_t *h, void *opaque)
     1.9 +{
    1.10 +    struct vcpu *v = opaque;
    1.11 +
    1.12 +    if ( test_bit(_VCPUF_down, &v->vcpu_flags) ) {
    1.13 +        hvm_put_32u(h, 0x0);
    1.14 +        return;
    1.15 +    }
    1.16 +
    1.17 +    hvm_put_32u(h, HVM_VCPU_CTXT_MAGIC);
    1.18 +    hvm_funcs.save_cpu_ctxt(h, opaque);
    1.19 +}
    1.20 +
    1.21  int hvm_load_cpu_ctxt(hvm_domain_context_t *h, void *opaque, int version)
    1.22  {
    1.23      struct vcpu *v = opaque;
    1.24  
    1.25 +    if ( hvm_get_32u(h) != HVM_VCPU_CTXT_MAGIC )
    1.26 +        return 0;
    1.27 +
    1.28      if ( hvm_funcs.load_cpu_ctxt(h, opaque, version) < 0 )
    1.29          return -EINVAL;
    1.30  
    1.31 @@ -208,7 +225,7 @@ int hvm_vcpu_initialise(struct vcpu *v)
    1.32      int rc;
    1.33  
    1.34      hvm_register_savevm(v->domain, "xen_hvm_cpu", v->vcpu_id, 1,
    1.35 -                        hvm_funcs.save_cpu_ctxt, hvm_load_cpu_ctxt, 
    1.36 +                        hvm_save_cpu_ctxt, hvm_load_cpu_ctxt, 
    1.37                          (void *)v);
    1.38  
    1.39      if ( (rc = vlapic_init(v)) != 0 )
     2.1 --- a/xen/include/public/domctl.h	Sun Jan 28 09:37:18 2007 +0000
     2.2 +++ b/xen/include/public/domctl.h	Sun Jan 28 09:46:09 2007 +0000
     2.3 @@ -386,7 +386,7 @@ struct xen_domctl_settimeoffset {
     2.4  typedef struct xen_domctl_settimeoffset xen_domctl_settimeoffset_t;
     2.5  DEFINE_XEN_GUEST_HANDLE(xen_domctl_settimeoffset_t);
     2.6   
     2.7 -#define HVM_CTXT_SIZE        6144
     2.8 +#define HVM_CTXT_SIZE        8192
     2.9  typedef struct hvm_domain_context {
    2.10      uint32_t cur;
    2.11      uint32_t size;