ia64/xen-unstable

changeset 7419:cd2a4d6da0a1

In the shadow mode, thanks to recent patches, the shadow
reference counts (both general counts and type counts)
are now correct in all of my testing so far. As a result,
we should remove the shadow_tainted_refcnt flag from
the domain structure. Leaving this flag in place would
create confusion for programmers and would also prevent
future debugging of problems in handling general and type
reference counts in the shadow mode. In addition, the
patch also (1) drops the requirement that shadow_mode_disable()
should only be called in the domain destruction sequence
(even though it is only used that way so far), and
(2) strictly assert that the type reference count must
be 0 when we free a page from the dom heap.

Signed-off-by: Khoa Huynh <khoa@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Oct 18 10:45:29 2005 +0100 (2005-10-18)
parents 2b95dde72853
children 76a413a8eef0
files xen/arch/x86/shadow32.c xen/arch/x86/shadow_public.c xen/common/page_alloc.c xen/include/asm-x86/domain.h xen/include/asm-x86/shadow.h xen/include/xen/shadow.h
line diff
     1.1 --- a/xen/arch/x86/shadow32.c	Tue Oct 18 02:08:26 2005 +0100
     1.2 +++ b/xen/arch/x86/shadow32.c	Tue Oct 18 10:45:29 2005 +0100
     1.3 @@ -1187,14 +1187,6 @@ void __shadow_mode_disable(struct domain
     1.4      if ( unlikely(!shadow_mode_enabled(d)) )
     1.5          return;
     1.6  
     1.7 -    /*
     1.8 -     * Currently this does not fix up page ref counts, so it is valid to call
     1.9 -     * only when a domain is being destroyed.
    1.10 -     */
    1.11 -    BUG_ON(!test_bit(_DOMF_dying, &d->domain_flags) &&
    1.12 -           shadow_mode_refcounts(d));
    1.13 -    d->arch.shadow_tainted_refcnts = shadow_mode_refcounts(d);
    1.14 -
    1.15      free_shadow_pages(d);
    1.16      free_writable_pte_predictions(d);
    1.17  
     2.1 --- a/xen/arch/x86/shadow_public.c	Tue Oct 18 02:08:26 2005 +0100
     2.2 +++ b/xen/arch/x86/shadow_public.c	Tue Oct 18 10:45:29 2005 +0100
     2.3 @@ -879,14 +879,6 @@ void __shadow_mode_disable(struct domain
     2.4      if ( unlikely(!shadow_mode_enabled(d)) )
     2.5          return;
     2.6  
     2.7 -    /*
     2.8 -     * Currently this does not fix up page ref counts, so it is valid to call
     2.9 -     * only when a domain is being destroyed.
    2.10 -     */
    2.11 -    BUG_ON(!test_bit(_DOMF_dying, &d->domain_flags) &&
    2.12 -           shadow_mode_refcounts(d));
    2.13 -    d->arch.shadow_tainted_refcnts = shadow_mode_refcounts(d);
    2.14 -
    2.15      free_shadow_pages(d);
    2.16      free_writable_pte_predictions(d);
    2.17  
     3.1 --- a/xen/common/page_alloc.c	Tue Oct 18 02:08:26 2005 +0100
     3.2 +++ b/xen/common/page_alloc.c	Tue Oct 18 10:45:29 2005 +0100
     3.3 @@ -610,8 +610,7 @@ void free_domheap_pages(struct pfn_info 
     3.4          for ( i = 0; i < (1 << order); i++ )
     3.5          {
     3.6              shadow_drop_references(d, &pg[i]);
     3.7 -            ASSERT(((pg[i].u.inuse.type_info & PGT_count_mask) == 0) ||
     3.8 -                   shadow_tainted_refcnts(d));
     3.9 +            ASSERT((pg[i].u.inuse.type_info & PGT_count_mask) == 0);
    3.10              pg[i].tlbflush_timestamp  = tlbflush_current_time();
    3.11              pg[i].u.free.cpumask      = d->cpumask;
    3.12              list_del(&pg[i].list);
     4.1 --- a/xen/include/asm-x86/domain.h	Tue Oct 18 02:08:26 2005 +0100
     4.2 +++ b/xen/include/asm-x86/domain.h	Tue Oct 18 10:45:29 2005 +0100
     4.3 @@ -32,8 +32,6 @@ struct arch_domain
     4.4      struct shadow_ops *ops;
     4.5      unsigned int shadow_mode;  /* flags to control shadow table operation */
     4.6      unsigned int shadow_nest;  /* Recursive depth of shadow_lock() nesting */
     4.7 -    /* Shadow mode has tainted page reference counts? */
     4.8 -    unsigned int shadow_tainted_refcnts;
     4.9  
    4.10      /* shadow hashtable */
    4.11      struct shadow_status *shadow_ht;
     5.1 --- a/xen/include/asm-x86/shadow.h	Tue Oct 18 02:08:26 2005 +0100
     5.2 +++ b/xen/include/asm-x86/shadow.h	Tue Oct 18 10:45:29 2005 +0100
     5.3 @@ -55,8 +55,6 @@
     5.4  #define shadow_mode_translate(_d) ((_d)->arch.shadow_mode & SHM_translate)
     5.5  #define shadow_mode_external(_d)  ((_d)->arch.shadow_mode & SHM_external)
     5.6  
     5.7 -#define shadow_tainted_refcnts(_d) ((_d)->arch.shadow_tainted_refcnts)
     5.8 -
     5.9  #define shadow_linear_pg_table ((l1_pgentry_t *)SH_LINEAR_PT_VIRT_START)
    5.10  #define __shadow_linear_l2_table ((l2_pgentry_t *)(SH_LINEAR_PT_VIRT_START + \
    5.11       (SH_LINEAR_PT_VIRT_START >> (L2_PAGETABLE_SHIFT - L1_PAGETABLE_SHIFT))))
     6.1 --- a/xen/include/xen/shadow.h	Tue Oct 18 02:08:26 2005 +0100
     6.2 +++ b/xen/include/xen/shadow.h	Tue Oct 18 10:45:29 2005 +0100
     6.3 @@ -12,7 +12,6 @@
     6.4  
     6.5  #define shadow_drop_references(_d, _p)          ((void)0)
     6.6  #define shadow_sync_and_drop_references(_d, _p) ((void)0)
     6.7 -#define shadow_tainted_refcnts(_d)              (0)
     6.8  
     6.9  #endif
    6.10