direct-io.hg

changeset 4484:3a76f49439ae

bitkeeper revision 1.1274.1.1 (4252c316ZtQV7eOqUOayWDXp7qfbJw)

Clean up shadow code presence in common source files.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Apr 05 16:55:50 2005 +0000 (2005-04-05)
parents 78c506cbdb5f
children 2955b0140fbe 80c93f1d00a8
files .rootkeys xen/common/dom0_ops.c xen/common/dom_mem_ops.c xen/common/domain.c xen/common/grant_table.c xen/common/page_alloc.c xen/include/asm-ia64/shadow.h xen/include/asm-x86/shadow.h xen/include/xen/perfc.h xen/include/xen/shadow.h
line diff
     1.1 --- a/.rootkeys	Tue Apr 05 15:53:37 2005 +0000
     1.2 +++ b/.rootkeys	Tue Apr 05 16:55:50 2005 +0000
     1.3 @@ -1288,7 +1288,6 @@ 421098b72bPUyviWloEAIB85dGCm2Q xen/inclu
     1.4  421098b7Z6OwjZnrTZkh34DoDfcjrA xen/include/asm-ia64/regionreg.h
     1.5  421098b707cY5YluUcWK5Pc-71ETVw xen/include/asm-ia64/regs.h
     1.6  4214e2f3fbO_n9Z1kIcBR83d7W4OJw xen/include/asm-ia64/serial.h
     1.7 -421098b7czhvyPGFa5nskL0N4vNvFw xen/include/asm-ia64/shadow.h
     1.8  421098b7GkWOnlzSmPvNAhByOSZ1Dw xen/include/asm-ia64/time.h
     1.9  421098b7FK3xgShpnH0I0Ou3O4fJ2Q xen/include/asm-ia64/tlb.h
    1.10  421098b78IGdFOGUlPmpS7h_QBmoFg xen/include/asm-ia64/vcpu.h
    1.11 @@ -1416,6 +1415,7 @@ 3e4540ccU1sgCx8seIMGlahmMfv7yQ xen/inclu
    1.12  40589969nPq3DMzv24RDb5LXE9brHw xen/include/xen/sched-if.h
    1.13  3ddb79c0LzqqS0LhAQ50ekgj4oGl7Q xen/include/xen/sched.h
    1.14  403a06a7H0hpHcKpAiDe5BPnaXWTlA xen/include/xen/serial.h
    1.15 +4252c315hw0xXYMKIfFzhomi1M1yNA xen/include/xen/shadow.h
    1.16  3ddb79c14dXIhP7C2ahnoD08K90G_w xen/include/xen/slab.h
    1.17  3ddb79c09xbS-xxfKxuV3JETIhBzmg xen/include/xen/smp.h
    1.18  3ddb79c1Vi5VleJAOKHAlY0G2zAsgw xen/include/xen/softirq.h
     2.1 --- a/xen/common/dom0_ops.c	Tue Apr 05 15:53:37 2005 +0000
     2.2 +++ b/xen/common/dom0_ops.c	Tue Apr 05 16:55:50 2005 +0000
     2.3 @@ -17,7 +17,6 @@
     2.4  #include <xen/trace.h>
     2.5  #include <xen/console.h>
     2.6  #include <xen/physdev.h>
     2.7 -#include <asm/shadow.h>
     2.8  #include <public/sched_ctl.h>
     2.9  
    2.10  #define TRC_DOM0OP_ENTER_BASE  0x00020000
     3.1 --- a/xen/common/dom_mem_ops.c	Tue Apr 05 15:53:37 2005 +0000
     3.2 +++ b/xen/common/dom_mem_ops.c	Tue Apr 05 16:55:50 2005 +0000
     3.3 @@ -13,8 +13,8 @@
     3.4  #include <xen/perfc.h>
     3.5  #include <xen/sched.h>
     3.6  #include <xen/event.h>
     3.7 +#include <xen/shadow.h>
     3.8  #include <asm/domain_page.h>
     3.9 -#include <asm/shadow.h>
    3.10  
    3.11  /*
    3.12   * To allow safe resume of do_dom_mem_op() after preemption, we need to know 
    3.13 @@ -112,26 +112,7 @@ free_dom_mem(struct domain *d,
    3.14              if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
    3.15                  put_page(page);
    3.16  
    3.17 -            if ( unlikely(shadow_mode_enabled(d)) )
    3.18 -            {
    3.19 -                // XXX This needs more thought.  This isn't pretty,
    3.20 -                // and it's not fast.  But it's a place holder.
    3.21 -                //
    3.22 -                shadow_lock(d);
    3.23 -                if ( page_out_of_sync(page) )
    3.24 -                    __shadow_sync_mfn(d, mpfn + j);
    3.25 -                shadow_remove_all_access(d, mpfn + j);
    3.26 -
    3.27 -                if (page->count_info != 1)
    3.28 -                {
    3.29 -                    printk("free_dom_mem in shadow mode didn't release page "
    3.30 -                           "mfn=%p c=%p\n", mpfn+j, page->count_info);
    3.31 -                    shadow_unlock(d);
    3.32 -                    audit_domain(d);
    3.33 -                    BUG();
    3.34 -                }
    3.35 -                shadow_unlock(d);
    3.36 -            }
    3.37 +            shadow_sync_and_drop_references(d, page);
    3.38  
    3.39              put_page(page);
    3.40          }
     4.1 --- a/xen/common/domain.c	Tue Apr 05 15:53:37 2005 +0000
     4.2 +++ b/xen/common/domain.c	Tue Apr 05 16:55:50 2005 +0000
     4.3 @@ -15,7 +15,6 @@
     4.4  #include <xen/time.h>
     4.5  #include <xen/console.h>
     4.6  #include <xen/softirq.h>
     4.7 -#include <asm/shadow.h>
     4.8  #include <public/dom0_ops.h>
     4.9  #include <asm/domain_page.h>
    4.10  #include <asm/debugger.h>
     5.1 --- a/xen/common/grant_table.c	Tue Apr 05 15:53:37 2005 +0000
     5.2 +++ b/xen/common/grant_table.c	Tue Apr 05 16:55:50 2005 +0000
     5.3 @@ -27,8 +27,8 @@
     5.4  
     5.5  #include <xen/config.h>
     5.6  #include <xen/sched.h>
     5.7 -#include <asm/mm.h>
     5.8 -#include <asm/shadow.h>
     5.9 +#include <xen/shadow.h>
    5.10 +#include <xen/mm.h>
    5.11  
    5.12  #define PIN_FAIL(_lbl, _rc, _f, _a...)   \
    5.13      do {                           \
     6.1 --- a/xen/common/page_alloc.c	Tue Apr 05 15:53:37 2005 +0000
     6.2 +++ b/xen/common/page_alloc.c	Tue Apr 05 16:55:50 2005 +0000
     6.3 @@ -30,9 +30,9 @@
     6.4  #include <xen/slab.h>
     6.5  #include <xen/irq.h>
     6.6  #include <xen/softirq.h>
     6.7 +#include <xen/shadow.h>
     6.8  #include <asm/domain_page.h>
     6.9  #include <asm/page.h>
    6.10 -#include <asm/shadow.h>
    6.11  
    6.12  /*
    6.13   * Comma-separated list of hexadecimal page numbers containing bad bytes.
    6.14 @@ -561,22 +561,7 @@ void free_domheap_pages(struct pfn_info 
    6.15  
    6.16          for ( i = 0; i < (1 << order); i++ )
    6.17          {
    6.18 -            if ( ((pg[i].u.inuse.type_info & PGT_count_mask) != 0) &&
    6.19 -                shadow_mode_enabled(d) )
    6.20 -            {
    6.21 -                // XXX This needs more thought...
    6.22 -                //
    6.23 -                printk("%s: needing to call shadow_remove_all_access for mfn=%p\n",
    6.24 -                       __func__, page_to_pfn(&pg[i]));
    6.25 -                printk("Amfn=%p c=%p t=%p\n", page_to_pfn(&pg[i]),
    6.26 -                       pg[i].count_info, pg[i].u.inuse.type_info);
    6.27 -                shadow_lock(d);
    6.28 -                shadow_remove_all_access(d, page_to_pfn(&pg[i]));
    6.29 -                shadow_unlock(d);
    6.30 -                printk("Bmfn=%p c=%p t=%p\n", page_to_pfn(&pg[i]),
    6.31 -                       pg[i].count_info, pg[i].u.inuse.type_info);
    6.32 -            }
    6.33 -
    6.34 +            shadow_drop_references(d, &pg[i]);
    6.35              ASSERT((pg[i].u.inuse.type_info & PGT_count_mask) == 0);
    6.36              pg[i].tlbflush_timestamp  = tlbflush_current_time();
    6.37              pg[i].u.free.cpu_mask     = d->cpuset;
     7.1 --- a/xen/include/asm-ia64/shadow.h	Tue Apr 05 15:53:37 2005 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,3 +0,0 @@
     7.4 -
     7.5 -#define	shadow_lock_init(d)	do {} while(0)
     7.6 -#define	shadow_mode_init(d)	do {} while(0)
     8.1 --- a/xen/include/asm-x86/shadow.h	Tue Apr 05 15:53:37 2005 +0000
     8.2 +++ b/xen/include/asm-x86/shadow.h	Tue Apr 05 16:55:50 2005 +0000
     8.3 @@ -377,6 +377,52 @@ update_hl2e(struct exec_domain *ed, unsi
     8.4      }
     8.5  }
     8.6  
     8.7 +static inline void shadow_drop_references(
     8.8 +    struct domain *d, struct pfn_info *page)
     8.9 +{
    8.10 +    if ( likely(!shadow_mode_enabled(d)) ||
    8.11 +         ((page->u.inuse.type_info & PGT_count_mask) == 0) )
    8.12 +        return;
    8.13 +
    8.14 +    /* XXX This needs more thought... */
    8.15 +    printk("%s: needing to call shadow_remove_all_access for mfn=%p\n",
    8.16 +           __func__, page_to_pfn(page));
    8.17 +    printk("Before: mfn=%p c=%p t=%p\n", page_to_pfn(page),
    8.18 +           page->count_info, page->u.inuse.type_info);
    8.19 +
    8.20 +    shadow_lock(d);
    8.21 +    shadow_remove_all_access(d, page_to_pfn(page));
    8.22 +    shadow_unlock(d);
    8.23 +
    8.24 +    printk("After:  mfn=%p c=%p t=%p\n", page_to_pfn(page),
    8.25 +           page->count_info, page->u.inuse.type_info);
    8.26 +}
    8.27 +
    8.28 +static inline void shadow_sync_and_drop_references(
    8.29 +    struct domain *d, struct pfn_info *page)
    8.30 +{
    8.31 +    if ( likely(!shadow_mode_enabled(d)) )
    8.32 +        return;
    8.33 +
    8.34 +    /* XXX Needs more thought. Neither pretty nor fast: a place holder. */
    8.35 +    shadow_lock(d);
    8.36 +
    8.37 +    if ( page_out_of_sync(page) )
    8.38 +        __shadow_sync_mfn(d, page_to_pfn(page));
    8.39 +
    8.40 +    shadow_remove_all_access(d, page_to_pfn(page));
    8.41 +
    8.42 +    if ( page->count_info != 1 )
    8.43 +    {
    8.44 +        printk("free_dom_mem in shadow mode didn't release page "
    8.45 +               "mfn=%p c=%p\n", page_to_pfn(page), page->count_info);
    8.46 +        shadow_unlock(d);
    8.47 +        audit_domain(d);
    8.48 +        BUG();
    8.49 +    }
    8.50 +
    8.51 +    shadow_unlock(d);
    8.52 +}
    8.53  
    8.54  /************************************************************************/
    8.55  
     9.1 --- a/xen/include/xen/perfc.h	Tue Apr 05 15:53:37 2005 +0000
     9.2 +++ b/xen/include/xen/perfc.h	Tue Apr 05 16:55:50 2005 +0000
     9.3 @@ -111,7 +111,9 @@ extern struct perfcounter perfcounters;
     9.4  #define perfc_incr(x)     ((void)0)
     9.5  #define perfc_decr(x)     ((void)0)
     9.6  #define perfc_incrc(x)    ((void)0)
     9.7 +#define perfc_decrc(x)    ((void)0)
     9.8  #define perfc_incra(x,y)  ((void)0)
     9.9 +#define perfc_decra(x,y)  ((void)0)
    9.10  #define perfc_add(x,y)    ((void)0)
    9.11  #define perfc_addc(x,y)   ((void)0)
    9.12  #define perfc_adda(x,y,z) ((void)0)
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/xen/include/xen/shadow.h	Tue Apr 05 16:55:50 2005 +0000
    10.3 @@ -0,0 +1,18 @@
    10.4 +
    10.5 +#ifndef __XEN_SHADOW_H__
    10.6 +#define __XEN_SHADOW_H__
    10.7 +
    10.8 +#include <xen/config.h>
    10.9 +
   10.10 +#ifdef CONFIG_X86
   10.11 +
   10.12 +#include <asm/shadow.h>
   10.13 +
   10.14 +#else
   10.15 +
   10.16 +#define shadow_drop_references(_d, _p)          ((void)0)
   10.17 +#define shadow_sync_and_drop_references(_d, _p) ((void)0)
   10.18 +
   10.19 +#endif
   10.20 +
   10.21 +#endif /* __XEN_SHADOW_H__ */