ia64/xen-unstable

changeset 17841:5e98eb873e13

x86: simplify domain memory cleanup

Page table pages cannot come from the Xen heap, so there's no need to
special-case these during cleanup.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 12 15:47:45 2008 +0100 (2008-06-12)
parents 4ebd8f377426
children 52c0117dd374
files xen/arch/x86/domain.c xen/arch/x86/mm.c xen/include/asm-x86/domain.h
line diff
     1.1 --- a/xen/arch/x86/domain.c	Thu Jun 12 15:44:21 2008 +0100
     1.2 +++ b/xen/arch/x86/domain.c	Thu Jun 12 15:47:45 2008 +0100
     1.3 @@ -1776,47 +1776,36 @@ int domain_relinquish_resources(struct d
     1.4              unmap_vcpu_info(v);
     1.5          }
     1.6  
     1.7 -        d->arch.relmem = RELMEM_xen_l4;
     1.8 +        d->arch.relmem = RELMEM_xen;
     1.9          /* fallthrough */
    1.10  
    1.11          /* Relinquish every page of memory. */
    1.12 -    case RELMEM_xen_l4:
    1.13 -#if CONFIG_PAGING_LEVELS >= 4
    1.14 -        ret = relinquish_memory(d, &d->xenpage_list, PGT_l4_page_table);
    1.15 +    case RELMEM_xen:
    1.16 +        ret = relinquish_memory(d, &d->xenpage_list, ~0UL);
    1.17          if ( ret )
    1.18              return ret;
    1.19 -        d->arch.relmem = RELMEM_dom_l4;
    1.20 +#if CONFIG_PAGING_LEVELS >= 4
    1.21 +        d->arch.relmem = RELMEM_l4;
    1.22          /* fallthrough */
    1.23 -    case RELMEM_dom_l4:
    1.24 +
    1.25 +    case RELMEM_l4:
    1.26          ret = relinquish_memory(d, &d->page_list, PGT_l4_page_table);
    1.27          if ( ret )
    1.28              return ret;
    1.29 -        d->arch.relmem = RELMEM_xen_l3;
    1.30 -        /* fallthrough */
    1.31  #endif
    1.32 -
    1.33 -    case RELMEM_xen_l3:
    1.34  #if CONFIG_PAGING_LEVELS >= 3
    1.35 -        ret = relinquish_memory(d, &d->xenpage_list, PGT_l3_page_table);
    1.36 -        if ( ret )
    1.37 -            return ret;
    1.38 -        d->arch.relmem = RELMEM_dom_l3;
    1.39 +        d->arch.relmem = RELMEM_l3;
    1.40          /* fallthrough */
    1.41 -    case RELMEM_dom_l3:
    1.42 +
    1.43 +    case RELMEM_l3:
    1.44          ret = relinquish_memory(d, &d->page_list, PGT_l3_page_table);
    1.45          if ( ret )
    1.46              return ret;
    1.47 -        d->arch.relmem = RELMEM_xen_l2;
    1.48 +#endif
    1.49 +        d->arch.relmem = RELMEM_l2;
    1.50          /* fallthrough */
    1.51 -#endif
    1.52  
    1.53 -    case RELMEM_xen_l2:
    1.54 -        ret = relinquish_memory(d, &d->xenpage_list, PGT_l2_page_table);
    1.55 -        if ( ret )
    1.56 -            return ret;
    1.57 -        d->arch.relmem = RELMEM_dom_l2;
    1.58 -        /* fallthrough */
    1.59 -    case RELMEM_dom_l2:
    1.60 +    case RELMEM_l2:
    1.61          ret = relinquish_memory(d, &d->page_list, PGT_l2_page_table);
    1.62          if ( ret )
    1.63              return ret;
    1.64 @@ -1829,6 +1818,7 @@ int domain_relinquish_resources(struct d
    1.65          if ( ret )
    1.66              return ret;
    1.67  #endif
    1.68 +        WARN_ON(d->xenheap_pages);
    1.69          break;
    1.70  
    1.71      default:
     2.1 --- a/xen/arch/x86/mm.c	Thu Jun 12 15:44:21 2008 +0100
     2.2 +++ b/xen/arch/x86/mm.c	Thu Jun 12 15:47:45 2008 +0100
     2.3 @@ -1317,7 +1317,7 @@ static void free_l3_table(struct page_in
     2.4      int           i;
     2.5  
     2.6  #ifdef DOMAIN_DESTRUCT_AVOID_RECURSION
     2.7 -    if ( d->arch.relmem == RELMEM_dom_l3 )
     2.8 +    if ( d->arch.relmem == RELMEM_l3 )
     2.9          return;
    2.10  #endif
    2.11  
    2.12 @@ -1345,7 +1345,7 @@ static void free_l4_table(struct page_in
    2.13      int           i;
    2.14  
    2.15  #ifdef DOMAIN_DESTRUCT_AVOID_RECURSION
    2.16 -    if ( d->arch.relmem == RELMEM_dom_l4 )
    2.17 +    if ( d->arch.relmem == RELMEM_l4 )
    2.18          return;
    2.19  #endif
    2.20  
     3.1 --- a/xen/include/asm-x86/domain.h	Thu Jun 12 15:44:21 2008 +0100
     3.2 +++ b/xen/include/asm-x86/domain.h	Thu Jun 12 15:47:45 2008 +0100
     3.3 @@ -241,12 +241,10 @@ struct arch_domain
     3.4      /* Continuable domain_relinquish_resources(). */
     3.5      enum {
     3.6          RELMEM_not_started,
     3.7 -        RELMEM_xen_l4,
     3.8 -        RELMEM_dom_l4,
     3.9 -        RELMEM_xen_l3,
    3.10 -        RELMEM_dom_l3,
    3.11 -        RELMEM_xen_l2,
    3.12 -        RELMEM_dom_l2,
    3.13 +        RELMEM_xen,
    3.14 +        RELMEM_l4,
    3.15 +        RELMEM_l3,
    3.16 +        RELMEM_l2,
    3.17          RELMEM_done,
    3.18      } relmem;
    3.19      struct list_head relmem_list;