direct-io.hg

changeset 13419:025218cdb17d

[HVM] save restore: shadow fix

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

fix 2 shadow issues:
* restored guest's mem type_info are not correct
* remove annoying warnings when restore

enable smp:
turn on the vcpu when set_vcpu_context in restore as cpu hotplug is not feasible for HVM
author Tim Deegan <Tim.Deegan@xensource.com>
date Thu Jan 18 16:48:09 2007 +0000 (2007-01-18)
parents 4138b80a8a23
children 53a1dbb70386
files xen/arch/x86/mm/shadow/common.c xen/arch/x86/mm/shadow/multi.c xen/common/domain.c
line diff
     1.1 --- a/xen/arch/x86/mm/shadow/common.c	Thu Jan 18 16:48:08 2007 +0000
     1.2 +++ b/xen/arch/x86/mm/shadow/common.c	Thu Jan 18 16:48:09 2007 +0000
     1.3 @@ -2187,7 +2187,7 @@ int sh_remove_all_mappings(struct vcpu *
     1.4          /* Don't complain if we're in HVM and there's one extra mapping: 
     1.5           * The qemu helper process has an untyped mapping of this dom's RAM */
     1.6          if ( !(shadow_mode_external(v->domain)
     1.7 -               && (page->count_info & PGC_count_mask) <= 2
     1.8 +               && (page->count_info & PGC_count_mask) <= 3 /* vmx restore add one extra mapping*/
     1.9                 && (page->u.inuse.type_info & PGT_count_mask) == 0) )
    1.10          {
    1.11              SHADOW_ERROR("can't find all mappings of mfn %lx: "
     2.1 --- a/xen/arch/x86/mm/shadow/multi.c	Thu Jan 18 16:48:08 2007 +0000
     2.2 +++ b/xen/arch/x86/mm/shadow/multi.c	Thu Jan 18 16:48:09 2007 +0000
     2.3 @@ -1628,6 +1628,14 @@ sh_make_shadow(struct vcpu *v, mfn_t gmf
     2.4          }
     2.5      }
     2.6      
     2.7 +    {
     2.8 +        struct page_info *page = mfn_to_page(gmfn);
     2.9 +        /* XXX: add it to emulate a touched page */
    2.10 +        if ((page->u.inuse.type_info & PGT_type_mask) == PGT_none){
    2.11 +            page->u.inuse.type_info |= (PGT_writable_page | PGT_validated);
    2.12 +        }
    2.13 +    }
    2.14 +
    2.15      shadow_promote(v, gmfn, shadow_type);
    2.16      set_shadow_status(v, gmfn, shadow_type, smfn);
    2.17  
     3.1 --- a/xen/common/domain.c	Thu Jan 18 16:48:08 2007 +0000
     3.2 +++ b/xen/common/domain.c	Thu Jan 18 16:48:09 2007 +0000
     3.3 @@ -24,6 +24,7 @@
     3.4  #include <xen/percpu.h>
     3.5  #include <xen/multicall.h>
     3.6  #include <asm/debugger.h>
     3.7 +#include <asm/hvm/support.h>
     3.8  #include <public/sched.h>
     3.9  #include <public/vcpu.h>
    3.10  #ifdef CONFIG_COMPAT
    3.11 @@ -505,6 +506,14 @@ int set_info_guest(struct domain *d,
    3.12      if ( rc == 0 )
    3.13          rc = arch_set_info_guest(v, c);
    3.14  
    3.15 +    /*XXX: hvm smp guest restore support */
    3.16 +    if ( rc == 0 &&
    3.17 +            v->vcpu_id != 0 &&
    3.18 +            is_hvm_vcpu(v) &&
    3.19 +            test_and_clear_bit(_VCPUF_down, &v->vcpu_flags) ) {
    3.20 +        vcpu_wake(v);
    3.21 +    }
    3.22 +
    3.23      domain_unpause(d);
    3.24  
    3.25      xfree(c.nat);