WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Clean up shadow code presence in common source files.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Clean up shadow code presence in common source files.
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Tue, 05 Apr 2005 16:55:50 +0000
Delivery-date: Tue, 05 Apr 2005 17:03:13 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1275, 2005/04/05 17:55:50+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Clean up shadow code presence in common source files.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 b/xen/common/dom0_ops.c        |    1 
 b/xen/common/dom_mem_ops.c     |   23 +-------------------
 b/xen/common/domain.c          |    1 
 b/xen/common/grant_table.c     |    4 +--
 b/xen/common/page_alloc.c      |   19 +---------------
 b/xen/include/asm-x86/shadow.h |   46 +++++++++++++++++++++++++++++++++++++++++
 b/xen/include/xen/perfc.h      |    2 +
 b/xen/include/xen/shadow.h     |   18 ++++++++++++++++
 xen/include/asm-ia64/shadow.h  |    3 --
 9 files changed, 72 insertions(+), 45 deletions(-)


diff -Nru a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c
--- a/xen/common/dom0_ops.c     2005-04-05 13:03:12 -04:00
+++ b/xen/common/dom0_ops.c     2005-04-05 13:03:12 -04:00
@@ -17,7 +17,6 @@
 #include <xen/trace.h>
 #include <xen/console.h>
 #include <xen/physdev.h>
-#include <asm/shadow.h>
 #include <public/sched_ctl.h>
 
 #define TRC_DOM0OP_ENTER_BASE  0x00020000
diff -Nru a/xen/common/dom_mem_ops.c b/xen/common/dom_mem_ops.c
--- a/xen/common/dom_mem_ops.c  2005-04-05 13:03:13 -04:00
+++ b/xen/common/dom_mem_ops.c  2005-04-05 13:03:13 -04:00
@@ -13,8 +13,8 @@
 #include <xen/perfc.h>
 #include <xen/sched.h>
 #include <xen/event.h>
+#include <xen/shadow.h>
 #include <asm/domain_page.h>
-#include <asm/shadow.h>
 
 /*
  * To allow safe resume of do_dom_mem_op() after preemption, we need to know 
@@ -112,26 +112,7 @@
             if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
                 put_page(page);
 
-            if ( unlikely(shadow_mode_enabled(d)) )
-            {
-                // XXX This needs more thought.  This isn't pretty,
-                // and it's not fast.  But it's a place holder.
-                //
-                shadow_lock(d);
-                if ( page_out_of_sync(page) )
-                    __shadow_sync_mfn(d, mpfn + j);
-                shadow_remove_all_access(d, mpfn + j);
-
-                if (page->count_info != 1)
-                {
-                    printk("free_dom_mem in shadow mode didn't release page "
-                           "mfn=%p c=%p\n", mpfn+j, page->count_info);
-                    shadow_unlock(d);
-                    audit_domain(d);
-                    BUG();
-                }
-                shadow_unlock(d);
-            }
+            shadow_sync_and_drop_references(d, page);
 
             put_page(page);
         }
diff -Nru a/xen/common/domain.c b/xen/common/domain.c
--- a/xen/common/domain.c       2005-04-05 13:03:12 -04:00
+++ b/xen/common/domain.c       2005-04-05 13:03:13 -04:00
@@ -15,7 +15,6 @@
 #include <xen/time.h>
 #include <xen/console.h>
 #include <xen/softirq.h>
-#include <asm/shadow.h>
 #include <public/dom0_ops.h>
 #include <asm/domain_page.h>
 #include <asm/debugger.h>
diff -Nru a/xen/common/grant_table.c b/xen/common/grant_table.c
--- a/xen/common/grant_table.c  2005-04-05 13:03:13 -04:00
+++ b/xen/common/grant_table.c  2005-04-05 13:03:13 -04:00
@@ -27,8 +27,8 @@
 
 #include <xen/config.h>
 #include <xen/sched.h>
-#include <asm/mm.h>
-#include <asm/shadow.h>
+#include <xen/shadow.h>
+#include <xen/mm.h>
 
 #define PIN_FAIL(_lbl, _rc, _f, _a...)   \
     do {                           \
diff -Nru a/xen/common/page_alloc.c b/xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   2005-04-05 13:03:12 -04:00
+++ b/xen/common/page_alloc.c   2005-04-05 13:03:12 -04:00
@@ -30,9 +30,9 @@
 #include <xen/slab.h>
 #include <xen/irq.h>
 #include <xen/softirq.h>
+#include <xen/shadow.h>
 #include <asm/domain_page.h>
 #include <asm/page.h>
-#include <asm/shadow.h>
 
 /*
  * Comma-separated list of hexadecimal page numbers containing bad bytes.
@@ -561,22 +561,7 @@
 
         for ( i = 0; i < (1 << order); i++ )
         {
-            if ( ((pg[i].u.inuse.type_info & PGT_count_mask) != 0) &&
-                shadow_mode_enabled(d) )
-            {
-                // XXX This needs more thought...
-                //
-                printk("%s: needing to call shadow_remove_all_access for 
mfn=%p\n",
-                       __func__, page_to_pfn(&pg[i]));
-                printk("Amfn=%p c=%p t=%p\n", page_to_pfn(&pg[i]),
-                       pg[i].count_info, pg[i].u.inuse.type_info);
-                shadow_lock(d);
-                shadow_remove_all_access(d, page_to_pfn(&pg[i]));
-                shadow_unlock(d);
-                printk("Bmfn=%p c=%p t=%p\n", page_to_pfn(&pg[i]),
-                       pg[i].count_info, pg[i].u.inuse.type_info);
-            }
-
+            shadow_drop_references(d, &pg[i]);
             ASSERT((pg[i].u.inuse.type_info & PGT_count_mask) == 0);
             pg[i].tlbflush_timestamp  = tlbflush_current_time();
             pg[i].u.free.cpu_mask     = d->cpuset;
diff -Nru a/xen/include/asm-ia64/shadow.h b/xen/include/asm-ia64/shadow.h
--- a/xen/include/asm-ia64/shadow.h     2005-04-05 13:03:12 -04:00
+++ /dev/null   Wed Dec 31 16:00:00 196900
@@ -1,3 +0,0 @@
-
-#define        shadow_lock_init(d)     do {} while(0)
-#define        shadow_mode_init(d)     do {} while(0)
diff -Nru a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h
--- a/xen/include/asm-x86/shadow.h      2005-04-05 13:03:12 -04:00
+++ b/xen/include/asm-x86/shadow.h      2005-04-05 13:03:12 -04:00
@@ -377,6 +377,52 @@
     }
 }
 
+static inline void shadow_drop_references(
+    struct domain *d, struct pfn_info *page)
+{
+    if ( likely(!shadow_mode_enabled(d)) ||
+         ((page->u.inuse.type_info & PGT_count_mask) == 0) )
+        return;
+
+    /* XXX This needs more thought... */
+    printk("%s: needing to call shadow_remove_all_access for mfn=%p\n",
+           __func__, page_to_pfn(page));
+    printk("Before: mfn=%p c=%p t=%p\n", page_to_pfn(page),
+           page->count_info, page->u.inuse.type_info);
+
+    shadow_lock(d);
+    shadow_remove_all_access(d, page_to_pfn(page));
+    shadow_unlock(d);
+
+    printk("After:  mfn=%p c=%p t=%p\n", page_to_pfn(page),
+           page->count_info, page->u.inuse.type_info);
+}
+
+static inline void shadow_sync_and_drop_references(
+    struct domain *d, struct pfn_info *page)
+{
+    if ( likely(!shadow_mode_enabled(d)) )
+        return;
+
+    /* XXX Needs more thought. Neither pretty nor fast: a place holder. */
+    shadow_lock(d);
+
+    if ( page_out_of_sync(page) )
+        __shadow_sync_mfn(d, page_to_pfn(page));
+
+    shadow_remove_all_access(d, page_to_pfn(page));
+
+    if ( page->count_info != 1 )
+    {
+        printk("free_dom_mem in shadow mode didn't release page "
+               "mfn=%p c=%p\n", page_to_pfn(page), page->count_info);
+        shadow_unlock(d);
+        audit_domain(d);
+        BUG();
+    }
+
+    shadow_unlock(d);
+}
 
 /************************************************************************/
 
diff -Nru a/xen/include/xen/perfc.h b/xen/include/xen/perfc.h
--- a/xen/include/xen/perfc.h   2005-04-05 13:03:13 -04:00
+++ b/xen/include/xen/perfc.h   2005-04-05 13:03:13 -04:00
@@ -111,7 +111,9 @@
 #define perfc_incr(x)     ((void)0)
 #define perfc_decr(x)     ((void)0)
 #define perfc_incrc(x)    ((void)0)
+#define perfc_decrc(x)    ((void)0)
 #define perfc_incra(x,y)  ((void)0)
+#define perfc_decra(x,y)  ((void)0)
 #define perfc_add(x,y)    ((void)0)
 #define perfc_addc(x,y)   ((void)0)
 #define perfc_adda(x,y,z) ((void)0)
diff -Nru a/xen/include/xen/shadow.h b/xen/include/xen/shadow.h
--- /dev/null   Wed Dec 31 16:00:00 196900
+++ b/xen/include/xen/shadow.h  2005-04-05 13:03:13 -04:00
@@ -0,0 +1,18 @@
+
+#ifndef __XEN_SHADOW_H__
+#define __XEN_SHADOW_H__
+
+#include <xen/config.h>
+
+#ifdef CONFIG_X86
+
+#include <asm/shadow.h>
+
+#else
+
+#define shadow_drop_references(_d, _p)          ((void)0)
+#define shadow_sync_and_drop_references(_d, _p) ((void)0)
+
+#endif
+
+#endif /* __XEN_SHADOW_H__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Clean up shadow code presence in common source files., BitKeeper Bot <=