direct-io.hg

changeset 14590:c1bfe329f7ff

hvm svm: Bug fix for page allocation when HAP is being used

Initialise count_info of newly allocated hap page with 0, and removes
unnecessary page deallcation when destroying monitor table. Without
this patch, destroying hap domain will fail.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
author kfraser@localhost.localdomain
date Tue Mar 27 17:21:14 2007 +0100 (2007-03-27)
parents d4ddaff75afd
children cb7d02592b96
files xen/arch/x86/mm/hap/hap.c
line diff
     1.1 --- a/xen/arch/x86/mm/hap/hap.c	Tue Mar 27 16:56:20 2007 +0100
     1.2 +++ b/xen/arch/x86/mm/hap/hap.c	Tue Mar 27 17:21:14 2007 +0100
     1.3 @@ -135,6 +135,7 @@ void hap_free_p2m_page(struct domain *d,
     1.4          HAP_ERROR("Odd p2m page count c=%#x t=%"PRtype_info"\n",
     1.5                    pg->count_info, pg->u.inuse.type_info);
     1.6      }
     1.7 +    pg->count_info = 0;
     1.8      /* Free should not decrement domain's total allocation, since 
     1.9       * these pages were allocated without an owner. */
    1.10      page_set_owner(pg, NULL); 
    1.11 @@ -182,6 +183,7 @@ hap_set_allocation(struct domain *d, uns
    1.12              list_del(&sp->list);
    1.13              d->arch.paging.hap.free_pages -= 1;
    1.14              d->arch.paging.hap.total_pages -= 1;
    1.15 +            sp->count_info = 0;
    1.16              free_domheap_pages(sp, 0);
    1.17          }
    1.18          
    1.19 @@ -367,17 +369,7 @@ void hap_destroy_monitor_table(struct vc
    1.20  {
    1.21      struct domain *d = v->domain;
    1.22  
    1.23 -#if CONFIG_PAGING_LEVELS == 4
    1.24 -    /* Need to destroy the l3 monitor page in slot 0 too */
    1.25 -    {
    1.26 -        mfn_t m3mfn;
    1.27 -        l4_pgentry_t *l4e = hap_map_domain_page(mmfn);
    1.28 -        ASSERT(l4e_get_flags(l4e[0]) & _PAGE_PRESENT);
    1.29 -        m3mfn = _mfn(l4e_get_pfn(l4e[0]));
    1.30 -        hap_free(d, m3mfn);
    1.31 -        hap_unmap_domain_page(l4e);
    1.32 -    }
    1.33 -#elif CONFIG_PAGING_LEVELS == 3
    1.34 +#if CONFIG_PAGING_LEVELS == 3
    1.35      /* Need to destroy the l2 monitor page in slot 4 too */
    1.36      {
    1.37          l3_pgentry_t *l3e = hap_map_domain_page(mmfn);
    1.38 @@ -632,10 +624,6 @@ void hap_update_paging_modes(struct vcpu
    1.39  
    1.40      v->arch.paging.translate_enabled = !!hvm_paging_enabled(v);    
    1.41  
    1.42 -    /* use p2m map */
    1.43 -    v->arch.guest_table =
    1.44 -        pagetable_from_pfn(pagetable_get_pfn(d->arch.phys_table));
    1.45 -
    1.46      if ( pagetable_is_null(v->arch.monitor_table) ) {
    1.47          mfn_t mmfn = hap_make_monitor_table(v);
    1.48          v->arch.monitor_table = pagetable_from_mfn(mmfn);