[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: Pickle domain in page_info into 32 bits.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1233164401 0
# Node ID 0858f961c77a4ef463d061a9f06e4f83ee95399f
# Parent  839bece33989c3cf2caf010b440c6aa26377aa1f
x86: Pickle domain in page_info into 32 bits.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/ia64/xen/domain.c |   10 ++++++++++
 xen/arch/x86/domain.c      |   19 +++++++++++++++++++
 xen/common/domain.c        |   10 ----------
 xen/include/asm-x86/mm.h   |    9 ++++++---
 xen/include/xen/domain.h   |    4 ++++
 5 files changed, 39 insertions(+), 13 deletions(-)

diff -r 839bece33989 -r 0858f961c77a xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Wed Jan 28 17:05:18 2009 +0000
+++ b/xen/arch/ia64/xen/domain.c        Wed Jan 28 17:40:01 2009 +0000
@@ -405,6 +405,16 @@ void relinquish_vcpu_resources(struct vc
        kill_timer(&v->arch.hlt_timer);
 }
 
+struct domain *alloc_domain_struct(void)
+{
+    return xmalloc(struct domain);
+}
+
+void free_domain_struct(struct domain *d)
+{
+    xfree(d);
+}
+
 struct vcpu *alloc_vcpu_struct(void)
 {
        struct page_info *page;
diff -r 839bece33989 -r 0858f961c77a xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Wed Jan 28 17:05:18 2009 +0000
+++ b/xen/arch/x86/domain.c     Wed Jan 28 17:40:01 2009 +0000
@@ -162,6 +162,25 @@ void dump_pageframe_info(struct domain *
     }
 }
 
+struct domain *alloc_domain_struct(void)
+{
+    struct domain *d;
+    /*
+     * We pack the MFN of the domain structure into a 32-bit field within
+     * the page_info structure. Hence the MEMF_bits() restriction.
+     */
+    d = alloc_xenheap_pages(
+        get_order_from_bytes(sizeof(*d)), MEMF_bits(32 + PAGE_SHIFT));
+    if ( d != NULL )
+        memset(d, 0, sizeof(*d));
+    return d;
+}
+
+void free_domain_struct(struct domain *d)
+{
+    free_xenheap_pages(d, get_order_from_bytes(sizeof(*d)));
+}
+
 struct vcpu *alloc_vcpu_struct(void)
 {
     struct vcpu *v;
diff -r 839bece33989 -r 0858f961c77a xen/common/domain.c
--- a/xen/common/domain.c       Wed Jan 28 17:05:18 2009 +0000
+++ b/xen/common/domain.c       Wed Jan 28 17:40:01 2009 +0000
@@ -102,16 +102,6 @@ int current_domain_id(void)
     return current->domain->domain_id;
 }
 
-static struct domain *alloc_domain_struct(void)
-{
-    return xmalloc(struct domain);
-}
-
-static void free_domain_struct(struct domain *d)
-{
-    xfree(d);
-}
-
 static void __domain_finalise_shutdown(struct domain *d)
 {
     struct vcpu *v;
diff -r 839bece33989 -r 0858f961c77a xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h  Wed Jan 28 17:05:18 2009 +0000
+++ b/xen/include/asm-x86/mm.h  Wed Jan 28 17:40:01 2009 +0000
@@ -31,7 +31,7 @@ struct page_info
         /* Page is in use: ((count_info & PGC_count_mask) != 0). */
         struct {
             /* Owner of this page (NULL if page is anonymous). */
-            unsigned long _domain; /* pickled format */
+            u32 _domain; /* pickled format */
             /* Type reference count and various PGT_xxx flags and fields. */
             unsigned long type_info;
         } inuse;
@@ -173,8 +173,11 @@ struct page_info
 /* OOS fixup entries */
 #define SHADOW_OOS_FIXUPS 2
 
-#define page_get_owner(_p)    ((struct domain *)(_p)->u.inuse._domain)
-#define page_set_owner(_p,_d) ((_p)->u.inuse._domain = (unsigned long)(_d))
+#define page_get_owner(_p)                                              \
+    ((struct domain *)((_p)->u.inuse._domain ?                          \
+                       mfn_to_virt((_p)->u.inuse._domain) : NULL))
+#define page_set_owner(_p,_d)                                           \
+    ((_p)->u.inuse._domain = (_d) ? virt_to_mfn(_d) : 0)
 
 #define maddr_get_owner(ma)   (page_get_owner(maddr_to_page((ma))))
 #define vaddr_get_owner(va)   (page_get_owner(virt_to_page((va))))
diff -r 839bece33989 -r 0858f961c77a xen/include/xen/domain.h
--- a/xen/include/xen/domain.h  Wed Jan 28 17:05:18 2009 +0000
+++ b/xen/include/xen/domain.h  Wed Jan 28 17:40:01 2009 +0000
@@ -22,6 +22,10 @@ void getdomaininfo(struct domain *d, str
 /*
  * Arch-specifics.
  */
+
+/* Allocate/free a domain structure. */
+struct domain *alloc_domain_struct(void);
+void free_domain_struct(struct domain *d);
 
 /* Allocate/free a VCPU structure. */
 struct vcpu *alloc_vcpu_struct(void);

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.