ia64/xen-unstable

changeset 13332:6d6a4d5801bd

[HVM] Fix shadow memory tracking
Fixes a missing free from cset 13275, and a missing prealloc.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Tue Jan 09 10:50:46 2007 +0000 (2007-01-09)
parents 8a99ebc5f5a4
children 717f64715f32 4fad820a2233
files xen/arch/x86/mm/shadow/multi.c
line diff
     1.1 --- a/xen/arch/x86/mm/shadow/multi.c	Mon Jan 08 18:39:29 2007 +0000
     1.2 +++ b/xen/arch/x86/mm/shadow/multi.c	Tue Jan 09 10:50:46 2007 +0000
     1.3 @@ -1655,12 +1655,15 @@ make_fl1_shadow(struct vcpu *v, gfn_t gf
     1.4  mfn_t
     1.5  sh_make_monitor_table(struct vcpu *v)
     1.6  {
     1.7 +    struct domain *d = v->domain;
     1.8  
     1.9      ASSERT(pagetable_get_pfn(v->arch.monitor_table) == 0);
    1.10      
    1.11 +    /* Guarantee we can get the memory we need */
    1.12 +    shadow_prealloc(d, SHADOW_MAX_ORDER);
    1.13 +
    1.14  #if CONFIG_PAGING_LEVELS == 4    
    1.15      {
    1.16 -        struct domain *d = v->domain;
    1.17          mfn_t m4mfn;
    1.18          m4mfn = shadow_alloc(d, SH_type_monitor_table, 0);
    1.19          sh_install_xen_entries_in_l4(v, m4mfn, m4mfn);
    1.20 @@ -1698,7 +1701,6 @@ sh_make_monitor_table(struct vcpu *v)
    1.21  #elif CONFIG_PAGING_LEVELS == 3
    1.22  
    1.23      {
    1.24 -        struct domain *d = v->domain;
    1.25          mfn_t m3mfn, m2mfn; 
    1.26          l3_pgentry_t *l3e;
    1.27          l2_pgentry_t *l2e;
    1.28 @@ -1732,7 +1734,6 @@ sh_make_monitor_table(struct vcpu *v)
    1.29  #elif CONFIG_PAGING_LEVELS == 2
    1.30  
    1.31      {
    1.32 -        struct domain *d = v->domain;
    1.33          mfn_t m2mfn;
    1.34          m2mfn = shadow_alloc(d, SH_type_monitor_table, 0);
    1.35          sh_install_xen_entries_in_l2(v, m2mfn, m2mfn);
    1.36 @@ -2095,17 +2096,19 @@ void sh_destroy_monitor_table(struct vcp
    1.37  #if (CONFIG_PAGING_LEVELS == 4) && (SHADOW_PAGING_LEVELS != 4)
    1.38      /* Need to destroy the l3 monitor page in slot 0 too */
    1.39      {
    1.40 +        mfn_t m3mfn;
    1.41          l4_pgentry_t *l4e = sh_map_domain_page(mmfn);
    1.42          ASSERT(l4e_get_flags(l4e[0]) & _PAGE_PRESENT);
    1.43 -        mmfn = _mfn(l4e_get_pfn(l4e[0]));
    1.44 +        m3mfn = _mfn(l4e_get_pfn(l4e[0]));
    1.45          if ( pv_32bit_guest(v) )
    1.46          {
    1.47              /* Need to destroy the l2 monitor page in slot 3 too */
    1.48 -            l3_pgentry_t *l3e = sh_map_domain_page(mmfn);
    1.49 +            l3_pgentry_t *l3e = sh_map_domain_page(m3mfn);
    1.50              ASSERT(l3e_get_flags(l3e[3]) & _PAGE_PRESENT);
    1.51              shadow_free(d, _mfn(l3e_get_pfn(l3e[3])));
    1.52              sh_unmap_domain_page(l3e);
    1.53          }
    1.54 +        shadow_free(d, m3mfn);
    1.55          sh_unmap_domain_page(l4e);
    1.56      }
    1.57  #elif CONFIG_PAGING_LEVELS == 3