ia64/xen-unstable

changeset 8119:92469b92f768

Avoid audit code during live migrate on 32bit since it's not required.

Signed-off-by: Steven Hand <steven@xensource.com>
author smh22@firebug.cl.cam.ac.uk
date Tue Nov 29 15:57:42 2005 +0100 (2005-11-29)
parents 689315a7ff80
children 74fa88cf3dc7
files xen/arch/x86/shadow32.c
line diff
     1.1 --- a/xen/arch/x86/shadow32.c	Tue Nov 29 15:54:44 2005 +0100
     1.2 +++ b/xen/arch/x86/shadow32.c	Tue Nov 29 15:57:42 2005 +0100
     1.3 @@ -1027,36 +1027,40 @@ int __shadow_mode_enable(struct domain *
     1.4      //
     1.5      free_shadow_pages(d);
     1.6  
     1.7 -    /*
     1.8 -     * Tear down its counts by disassembling its page-table-based ref counts.
     1.9 -     * Also remove CR3's gcount/tcount.
    1.10 -     * That leaves things like GDTs and LDTs and external refs in tact.
    1.11 -     *
    1.12 -     * Most pages will be writable tcount=0.
    1.13 -     * Some will still be L1 tcount=0 or L2 tcount=0.
    1.14 -     * Maybe some pages will be type none tcount=0.
    1.15 -     * Pages granted external writable refs (via grant tables?) will
    1.16 -     * still have a non-zero tcount.  That's OK.
    1.17 -     *
    1.18 -     * gcounts will generally be 1 for PGC_allocated.
    1.19 -     * GDTs and LDTs will have additional gcounts.
    1.20 -     * Any grant-table based refs will still be in the gcount.
    1.21 -     *
    1.22 -     * We attempt to grab writable refs to each page (thus setting its type).
    1.23 -     * Immediately put back those type refs.
    1.24 -     *
    1.25 -     * Assert that no pages are left with L1/L2/L3/L4 type.
    1.26 -     */
    1.27 -    audit_adjust_pgtables(d, -1, 1);
    1.28 -
    1.29      d->arch.shadow_mode = mode;
    1.30  
    1.31      if ( shadow_mode_refcounts(d) )
    1.32      {
    1.33 -        struct list_head *list_ent = d->page_list.next;
    1.34 -        while ( list_ent != &d->page_list )
    1.35 -        {
    1.36 -            struct pfn_info *page = list_entry(list_ent, struct pfn_info, list);
    1.37 +        struct list_head *list_ent; 
    1.38 +
    1.39 +        /*
    1.40 +         * Tear down its counts by disassembling its page-table-based refcounts
    1.41 +         * Also remove CR3's gcount/tcount.
    1.42 +         * That leaves things like GDTs and LDTs and external refs in tact.
    1.43 +         *
    1.44 +         * Most pages will be writable tcount=0.
    1.45 +         * Some will still be L1 tcount=0 or L2 tcount=0.
    1.46 +         * Maybe some pages will be type none tcount=0.
    1.47 +         * Pages granted external writable refs (via grant tables?) will
    1.48 +         * still have a non-zero tcount.  That's OK.
    1.49 +         *
    1.50 +         * gcounts will generally be 1 for PGC_allocated.
    1.51 +         * GDTs and LDTs will have additional gcounts.
    1.52 +         * Any grant-table based refs will still be in the gcount.
    1.53 +         *
    1.54 +         * We attempt to grab writable refs to each page thus setting its type
    1.55 +         * Immediately put back those type refs.
    1.56 +         *
    1.57 +         * Assert that no pages are left with L1/L2/L3/L4 type.
    1.58 +         */
    1.59 +        audit_adjust_pgtables(d, -1, 1);
    1.60 +
    1.61 +
    1.62 +        for (list_ent = d->page_list.next; list_ent != &d->page_list; 
    1.63 +             list_ent = page->list.next) {
    1.64 +            
    1.65 +            struct pfn_info *page = list_entry(list_ent, 
    1.66 +                                               struct pfn_info, list);
    1.67              if ( !get_page_type(page, PGT_writable_page) )
    1.68                  BUG();
    1.69              put_page_type(page);
    1.70 @@ -1064,14 +1068,14 @@ int __shadow_mode_enable(struct domain *
    1.71               * We use tlbflush_timestamp as back pointer to smfn, and need to
    1.72               * clean up it.
    1.73               */
    1.74 -            if ( shadow_mode_external(d) )
    1.75 +            if (shadow_mode_external(d))
    1.76                  page->tlbflush_timestamp = 0;
    1.77 -            list_ent = page->list.next;
    1.78          }
    1.79 +        
    1.80 +        audit_adjust_pgtables(d, 1, 1);
    1.81 +  
    1.82      }
    1.83  
    1.84 -    audit_adjust_pgtables(d, 1, 1);
    1.85 -
    1.86      return 0;
    1.87  
    1.88   nomem: