]> xenbits.xensource.com Git - people/vhanquez/xen.git/commitdiff
x86: Move get_page/put_page out of header file, and only print on
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 6 Dec 2007 17:29:12 +0000 (17:29 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 6 Dec 2007 17:29:12 +0000 (17:29 +0000)
get_page() failure if the domain is not dying.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen-unstable changeset:   16492:8e3d42fdb8e784b947fbd998d9a6df0ebf771718
xen-unstable date:        Tue Dec 04 09:56:10 2007 +0000

xen/arch/x86/mm.c
xen/include/asm-x86/mm.h

index c09ae31171d6f7849155fcdf2f2d3500c176488c..23d407da49a29f4da27dff5843c039c40925b2af 100644 (file)
@@ -1563,6 +1563,55 @@ static int mod_l4_entry(struct domain *d,
 
 #endif
 
+void put_page(struct page_info *page)
+{
+    u32 nx, x, y = page->count_info;
+
+    do {
+        x  = y;
+        nx = x - 1;
+    }
+    while ( unlikely((y = cmpxchg(&page->count_info, x, nx)) != x) );
+
+    if ( unlikely((nx & PGC_count_mask) == 0) )
+        free_domheap_page(page);
+}
+
+
+int get_page(struct page_info *page, struct domain *domain)
+{
+    u32 x, nx, y = page->count_info;
+    u32 d, nd = page->u.inuse._domain;
+    u32 _domain = pickle_domptr(domain);
+
+    do {
+        x  = y;
+        nx = x + 1;
+        d  = nd;
+        if ( unlikely((x & PGC_count_mask) == 0) ||  /* Not allocated? */
+             unlikely((nx & PGC_count_mask) == 0) || /* Count overflow? */
+             unlikely(d != _domain) )                /* Wrong owner? */
+        {
+            if ( !_shadow_mode_refcounts(domain) && !domain->is_dying )
+                gdprintk(XENLOG_INFO,
+                        "Error pfn %lx: rd=%p, od=%p, caf=%08x, taf=%"
+                        PRtype_info "\n",
+                        page_to_mfn(page), domain, unpickle_domptr(d),
+                        x, page->u.inuse.type_info);
+            return 0;
+        }
+        __asm__ __volatile__(
+            LOCK_PREFIX "cmpxchg8b %3"
+            : "=d" (nd), "=a" (y), "=c" (d),
+              "=m" (*(volatile u64 *)(&page->count_info))
+            : "0" (d), "1" (x), "c" (d), "b" (nx) );
+    }
+    while ( unlikely(nd != d) || unlikely(y != x) );
+
+    return 1;
+}
+
+
 int alloc_page_type(struct page_info *page, unsigned long type)
 {
     struct domain *owner = page_get_owner(page);
index 43d03ec170b81f796e1f2d7fd10924a005e706f0..5918cb4810316b426425f96f845f6ebbff86c539 100644 (file)
@@ -148,55 +148,8 @@ int alloc_page_type(struct page_info *page, unsigned long type);
 void free_page_type(struct page_info *page, unsigned long type);
 int _shadow_mode_refcounts(struct domain *d);
 
-static inline void put_page(struct page_info *page)
-{
-    u32 nx, x, y = page->count_info;
-
-    do {
-        x  = y;
-        nx = x - 1;
-    }
-    while ( unlikely((y = cmpxchg(&page->count_info, x, nx)) != x) );
-
-    if ( unlikely((nx & PGC_count_mask) == 0) )
-        free_domheap_page(page);
-}
-
-
-static inline int get_page(struct page_info *page,
-                           struct domain *domain)
-{
-    u32 x, nx, y = page->count_info;
-    u32 d, nd = page->u.inuse._domain;
-    u32 _domain = pickle_domptr(domain);
-
-    do {
-        x  = y;
-        nx = x + 1;
-        d  = nd;
-        if ( unlikely((x & PGC_count_mask) == 0) ||  /* Not allocated? */
-             unlikely((nx & PGC_count_mask) == 0) || /* Count overflow? */
-             unlikely(d != _domain) )                /* Wrong owner? */
-        {
-            if ( !_shadow_mode_refcounts(domain) )
-                gdprintk(XENLOG_INFO,
-                        "Error pfn %lx: rd=%p, od=%p, caf=%08x, taf=%"
-                        PRtype_info "\n",
-                        page_to_mfn(page), domain, unpickle_domptr(d),
-                        x, page->u.inuse.type_info);
-            return 0;
-        }
-        __asm__ __volatile__(
-            LOCK_PREFIX "cmpxchg8b %3"
-            : "=d" (nd), "=a" (y), "=c" (d),
-              "=m" (*(volatile u64 *)(&page->count_info))
-            : "0" (d), "1" (x), "c" (d), "b" (nx) );
-    }
-    while ( unlikely(nd != d) || unlikely(y != x) );
-
-    return 1;
-}
-
+void put_page(struct page_info *page);
+int get_page(struct page_info *page, struct domain *domain);
 void put_page_type(struct page_info *page);
 int  get_page_type(struct page_info *page, unsigned long type);
 int  get_page_from_l1e(l1_pgentry_t l1e, struct domain *d);