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

[Xen-changelog] [xen-unstable] Replace is_xen_heap_frame() with is_xen_heap_{page, mfn}(). Callers are



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1194517158 0
# Node ID 5b8730c78454f4400377b5b138767bbf5ffc778e
# Parent  d4c5a1cdcf2e6e9c98c99d218f8b80f8baca10cd
Replace is_xen_heap_frame() with is_xen_heap_{page,mfn}(). Callers are
changed to use whichever is more convenient.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/ia64/xen/mm.c       |    2 +-
 xen/arch/x86/mm.c            |    8 ++++----
 xen/common/grant_table.c     |    2 +-
 xen/common/page_alloc.c      |   11 +++++------
 xen/include/asm-ia64/mm.h    |    5 +++--
 xen/include/asm-powerpc/mm.h |    3 ++-
 xen/include/asm-x86/mm.h     |    8 +++++---
 7 files changed, 21 insertions(+), 18 deletions(-)

diff -r d4c5a1cdcf2e -r 5b8730c78454 xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Wed Nov 07 16:55:13 2007 +0000
+++ b/xen/arch/ia64/xen/mm.c    Thu Nov 08 10:19:18 2007 +0000
@@ -2832,7 +2832,7 @@ arch_memory_op(int op, XEN_GUEST_HANDLE(
 
         /* Remove previously mapped page if it was present. */
         if (prev_mfn && mfn_valid(prev_mfn)) {
-            if (is_xen_heap_frame(mfn_to_page(prev_mfn)))
+            if (is_xen_heap_mfn(prev_mfn))
                 /* Xen heap frames are simply unhooked from this phys slot. */
                 guest_physmap_remove_page(d, xatp.gpfn, prev_mfn);
             else
diff -r d4c5a1cdcf2e -r 5b8730c78454 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Wed Nov 07 16:55:13 2007 +0000
+++ b/xen/arch/x86/mm.c Thu Nov 08 10:19:18 2007 +0000
@@ -674,7 +674,7 @@ get_page_from_l1e(
         uint32_t x, nx, y = page->count_info;
         uint32_t cacheattr = pte_flags_to_cacheattr(l1f);
 
-        if ( is_xen_heap_frame(page) )
+        if ( is_xen_heap_page(page) )
         {
             if ( (l1f & _PAGE_RW) &&
                  !(unlikely(paging_mode_external(d) &&
@@ -1866,7 +1866,7 @@ void cleanup_page_cacheattr(struct page_
 
     page->count_info &= ~PGC_cacheattr_mask;
 
-    BUG_ON(is_xen_heap_frame(page));
+    BUG_ON(is_xen_heap_page(page));
 
 #ifdef __x86_64__
     map_pages_to_xen((unsigned long)page_to_virt(page), page_to_mfn(page),
@@ -3200,7 +3200,7 @@ long arch_memory_op(int op, XEN_GUEST_HA
         prev_mfn = gmfn_to_mfn(d, xatp.gpfn);
         if ( mfn_valid(prev_mfn) )
         {
-            if ( is_xen_heap_frame(mfn_to_page(prev_mfn)) )
+            if ( is_xen_heap_mfn(prev_mfn) )
                 /* Xen heap frames are simply unhooked from this phys slot. */
                 guest_physmap_remove_page(d, xatp.gpfn, prev_mfn);
             else
@@ -3583,7 +3583,7 @@ void free_xen_pagetable(void *v)
 
     BUG_ON(early_boot);
     
-    if ( is_xen_heap_frame(virt_to_page(v)) )
+    if ( is_xen_heap_page(virt_to_page(v)) )
         free_xenheap_page(v);
     else
         free_domheap_page(virt_to_page(v));
diff -r d4c5a1cdcf2e -r 5b8730c78454 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Wed Nov 07 16:55:13 2007 +0000
+++ b/xen/common/grant_table.c  Thu Nov 08 10:19:18 2007 +0000
@@ -1057,7 +1057,7 @@ gnttab_transfer(
         }
 
         page = mfn_to_page(mfn);
-        if ( unlikely(is_xen_heap_frame(page)) )
+        if ( unlikely(is_xen_heap_page(page)) )
         { 
             gdprintk(XENLOG_INFO, "gnttab_transfer: xen frame %lx\n",
                     (unsigned long)gop.mfn);
diff -r d4c5a1cdcf2e -r 5b8730c78454 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Wed Nov 07 16:55:13 2007 +0000
+++ b/xen/common/page_alloc.c   Thu Nov 08 10:19:18 2007 +0000
@@ -559,8 +559,7 @@ static unsigned long avail_heap_pages(
     return free_pages;
 }
 
-#define avail_for_domheap(mfn) \
-    (!allocated_in_map(mfn) && !is_xen_heap_frame(mfn_to_page(mfn)))
+#define avail_for_domheap(mfn) !(allocated_in_map(mfn) || is_xen_heap_mfn(mfn))
 void __init end_boot_allocator(void)
 {
     unsigned long i;
@@ -615,7 +614,7 @@ void __init scrub_heap_pages(void)
         /* Re-check page status with lock held. */
         if ( !allocated_in_map(mfn) )
         {
-            if ( is_xen_heap_frame(mfn_to_page(mfn)) )
+            if ( is_xen_heap_mfn(mfn) )
             {
                 p = page_to_virt(mfn_to_page(mfn));
                 memguard_unguard_range(p, PAGE_SIZE);
@@ -655,9 +654,9 @@ void init_xenheap_pages(paddr_t ps, padd
      * Yuk! Ensure there is a one-page buffer between Xen and Dom zones, to
      * prevent merging of power-of-two blocks across the zone boundary.
      */
-    if ( ps && !is_xen_heap_frame(maddr_to_page(ps)-1) )
+    if ( ps && !is_xen_heap_mfn(paddr_to_pfn(ps)-1) )
         ps += PAGE_SIZE;
-    if ( !is_xen_heap_frame(maddr_to_page(pe)) )
+    if ( !is_xen_heap_mfn(paddr_to_pfn(pe)) )
         pe -= PAGE_SIZE;
 
     init_heap_pages(MEMZONE_XEN, maddr_to_page(ps), (pe - ps) >> PAGE_SHIFT);
@@ -838,7 +837,7 @@ void free_domheap_pages(struct page_info
 
     ASSERT(!in_irq());
 
-    if ( unlikely(is_xen_heap_frame(pg)) )
+    if ( unlikely(is_xen_heap_page(pg)) )
     {
         /* NB. May recursively lock from relinquish_memory(). */
         spin_lock_recursive(&d->page_alloc_lock);
diff -r d4c5a1cdcf2e -r 5b8730c78454 xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h Wed Nov 07 16:55:13 2007 +0000
+++ b/xen/include/asm-ia64/mm.h Thu Nov 08 10:19:18 2007 +0000
@@ -115,8 +115,9 @@ struct page_info
  /* 29-bit count of references to this frame. */
 #define PGC_count_mask      ((1UL<<29)-1)
 
-#define is_xen_heap_frame(pfn) ((page_to_maddr(pfn) < xenheap_phys_end) \
-                                && (page_to_maddr(pfn) >= xen_pstart))
+#define is_xen_heap_mfn(mfn)   (((mfn) < paddr_to_pfn(xenheap_phys_end)) \
+                                && ((mfn) >= paddr_to_pfn(xen_pstart)))
+#define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page))
 
 extern void* xen_pickle_offset;
 #define __pickle(a)    ((unsigned long)a - (unsigned long)xen_pickle_offset)
diff -r d4c5a1cdcf2e -r 5b8730c78454 xen/include/asm-powerpc/mm.h
--- a/xen/include/asm-powerpc/mm.h      Wed Nov 07 16:55:13 2007 +0000
+++ b/xen/include/asm-powerpc/mm.h      Thu Nov 08 10:19:18 2007 +0000
@@ -111,7 +111,8 @@ struct page_info
  /* 29-bit count of references to this frame. */
 #define PGC_count_mask      ((1UL<<28)-1)
 
-#define is_xen_heap_frame(pfn) (page_to_maddr(pfn) < xenheap_phys_end)
+#define is_xen_heap_mfn(mfn)   ((mfn) < paddr_to_pfn(xenheap_phys_end))
+#define is_xen_heap_page(page) (page_to_maddr(page) < xenheap_phys_end)
 
 static inline struct domain *unpickle_domptr(u32 _domain)
 { return ((_domain == 0) || (_domain & 1)) ? NULL : __va(_domain); }
diff -r d4c5a1cdcf2e -r 5b8730c78454 xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h  Wed Nov 07 16:55:13 2007 +0000
+++ b/xen/include/asm-x86/mm.h  Thu Nov 08 10:19:18 2007 +0000
@@ -102,9 +102,11 @@ struct page_info
  /* 26-bit count of references to this frame. */
 #define PGC_count_mask      ((1U<<26)-1)
 
-#define is_xen_heap_frame(pfn) ({                                       \
-    paddr_t maddr = page_to_maddr(pfn);                                 \
-    ((maddr >= xenheap_phys_start) && (maddr < xenheap_phys_end));      \
+#define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page))
+#define is_xen_heap_mfn(mfn) ({                         \
+    unsigned long _mfn = (mfn);                         \
+    ((_mfn >= paddr_to_pfn(xenheap_phys_start)) &&      \
+     (_mfn < paddr_to_pfn(xenheap_phys_end)));          \
 })
 
 #if defined(__i386__)

_______________________________________________
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®.