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] [xen-3.4-testing] x86: Fix typo in p2m_pod_set_cache_tar

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.4-testing] x86: Fix typo in p2m_pod_set_cache_target
From: "Xen patchbot-3.4-testing" <patchbot-3.4-testing@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 01 Oct 2009 08:25:16 -0700
Delivery-date: Thu, 01 Oct 2009 08:25:44 -0700
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1254409183 -3600
# Node ID cf5fff1b95c3cceece9f58c08a7e50271385c895
# Parent  7eaa798200f679148fbd9d74b3fd958b5f8b7079
x86: Fix typo in p2m_pod_set_cache_target

Fix typo in p2m_pod_set_cache_target by defining (1<<9) as
SUPERPAGE_PAGES

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
xen-unstable changeset:   20184:366ae2894ecd
xen-unstable date:        Tue Sep 08 15:11:52 2009 +0100
---
 xen/arch/x86/mm/p2m.c |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff -r 7eaa798200f6 -r cf5fff1b95c3 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c     Thu Oct 01 15:57:35 2009 +0100
+++ b/xen/arch/x86/mm/p2m.c     Thu Oct 01 15:59:43 2009 +0100
@@ -100,6 +100,9 @@
 #define P2M_BASE_FLAGS \
         (_PAGE_PRESENT | _PAGE_USER | _PAGE_DIRTY | _PAGE_ACCESSED)
 
+#define SUPERPAGE_PAGES (1UL << 9)
+#define superpage_aligned(_x)  (((_x)&(SUPERPAGE_PAGES-1))==0)
+
 static unsigned long p2m_type_to_flags(p2m_type_t t) 
 {
     unsigned long flags = (t & 0x7UL) << 9;
@@ -351,7 +354,7 @@ static struct page_info * p2m_pod_cache_
         p = page_list_remove_head(&p2md->pod.super);
         mfn = mfn_x(page_to_mfn(p));
 
-        for ( i=0; i<(1<<9); i++ )
+        for ( i=0; i<SUPERPAGE_PAGES; i++ )
         {
             q = mfn_to_page(_mfn(mfn+i));
             page_list_add_tail(q, &p2md->pod.single);
@@ -397,7 +400,7 @@ p2m_pod_set_cache_target(struct domain *
         struct page_info * page;
         int order;
 
-        if ( (pod_target - p2md->pod.count) >= (1>>9) )
+        if ( (pod_target - p2md->pod.count) >= SUPERPAGE_PAGES )
             order = 9;
         else
             order = 0;
@@ -421,7 +424,7 @@ p2m_pod_set_cache_target(struct domain *
          * entries may disappear before we grab the lock. */
         spin_lock(&d->page_alloc_lock);
 
-        if ( (p2md->pod.count - pod_target) > (1>>9)
+        if ( (p2md->pod.count - pod_target) > SUPERPAGE_PAGES
              && !page_list_empty(&p2md->pod.super) )
             order = 9;
         else
@@ -540,13 +543,13 @@ p2m_pod_empty_cache(struct domain *d)
     {
         int i;
             
-        for ( i = 0 ; i < (1 << 9) ; i++ )
+        for ( i = 0 ; i < SUPERPAGE_PAGES ; i++ )
         {
             BUG_ON(page_get_owner(page + i) != d);
             page_list_add_tail(page + i, &d->page_list);
         }
 
-        p2md->pod.count -= 1<<9;
+        p2md->pod.count -= SUPERPAGE_PAGES;
     }
 
     while ( (page = page_list_remove_head(&p2md->pod.single)) )
@@ -698,7 +701,6 @@ p2m_pod_dump_data(struct domain *d)
            p2md->pod.entry_count, p2md->pod.count);
 }
 
-#define superpage_aligned(_x)  (((_x)&((1<<9)-1))==0)
 
 /* Search for all-zero superpages to be reclaimed as superpages for the
  * PoD cache. Must be called w/ p2m lock held, page_alloc lock not held. */
@@ -721,7 +723,7 @@ p2m_pod_zero_check_superpage(struct doma
 
     /* Look up the mfns, checking to make sure they're the same mfn
      * and aligned, and mapping them. */
-    for ( i=0; i<(1<<9); i++ )
+    for ( i=0; i<SUPERPAGE_PAGES; i++ )
     {
         
         mfn = gfn_to_mfn_query(d, gfn + i, &type);
@@ -754,7 +756,7 @@ p2m_pod_zero_check_superpage(struct doma
     }
 
     /* Now, do a quick check to see if it may be zero before unmapping. */
-    for ( i=0; i<(1<<9); i++ )
+    for ( i=0; i<SUPERPAGE_PAGES; i++ )
     {
         /* Quick zero-check */
         map = map_domain_page(mfn_x(mfn0) + i);
@@ -778,7 +780,7 @@ p2m_pod_zero_check_superpage(struct doma
     /* Make none of the MFNs are used elsewhere... for example, mapped
      * via the grant table interface, or by qemu.  Allow one refcount for
      * being allocated to the domain. */
-    for ( i=0; i < (1<<9); i++ )
+    for ( i=0; i < SUPERPAGE_PAGES; i++ )
     {
         mfn = _mfn(mfn_x(mfn0) + i);
         if ( (mfn_to_page(mfn)->count_info & PGC_count_mask) > 1 )
@@ -789,7 +791,7 @@ p2m_pod_zero_check_superpage(struct doma
     }
 
     /* Finally, do a full zero-check */
-    for ( i=0; i < (1<<9); i++ )
+    for ( i=0; i < SUPERPAGE_PAGES; i++ )
     {
         map = map_domain_page(mfn_x(mfn0) + i);
 
@@ -809,7 +811,7 @@ p2m_pod_zero_check_superpage(struct doma
     /* Finally!  We've passed all the checks, and can add the mfn superpage
      * back on the PoD cache, and account for the new p2m PoD entries */
     p2m_pod_cache_add(d, mfn_to_page(mfn0), 9);
-    d->arch.p2m->pod.entry_count += (1<<9);
+    d->arch.p2m->pod.entry_count += SUPERPAGE_PAGES;
 
 out_reset:
     if ( reset )
@@ -925,13 +927,13 @@ p2m_pod_emergency_sweep_super(struct dom
     if ( p2md->pod.reclaim_super == 0 )
     {
         p2md->pod.reclaim_super = (p2md->pod.max_guest>>9)<<9;
-        p2md->pod.reclaim_super -= (1<<9);
+        p2md->pod.reclaim_super -= SUPERPAGE_PAGES;
     }
     
     start = p2md->pod.reclaim_super;
     limit = (start > POD_SWEEP_LIMIT) ? (start - POD_SWEEP_LIMIT) : 0;
 
-    for ( i=p2md->pod.reclaim_super ; i > 0 ; i-=(1<<9) )
+    for ( i=p2md->pod.reclaim_super ; i > 0 ; i-=SUPERPAGE_PAGES )
     {
         p2m_pod_zero_check_superpage(d, i);
         /* Stop if we're past our limit and we have found *something*.
@@ -943,7 +945,7 @@ p2m_pod_emergency_sweep_super(struct dom
             break;
     }
 
-    p2md->pod.reclaim_super = i ? i - (1<<9) : 0;
+    p2md->pod.reclaim_super = i ? i - SUPERPAGE_PAGES : 0;
 
 }
 
@@ -1500,7 +1502,7 @@ int set_p2m_entry(struct domain *d, unsi
 
     while ( todo )
     {
-        order = (((gfn | mfn_x(mfn) | todo) & ((1ul << 9) - 1)) == 0) ? 9 : 0;
+        order = (((gfn | mfn_x(mfn) | todo) & (SUPERPAGE_PAGES - 1)) == 0) ? 9 
: 0;
         rc = d->arch.p2m->set_entry(d, gfn, mfn, order, p2mt);
         gfn += 1ul << order;
         if ( mfn_x(mfn) != INVALID_MFN )
@@ -1761,7 +1763,7 @@ static void audit_p2m(struct domain *d)
                         if ( (l2e_get_flags(l2e[i2]) & _PAGE_PSE)
                              && ( p2m_flags_to_type(l2e_get_flags(l2e[i2]))
                                   == p2m_populate_on_demand ) )
-                            entry_count+=(1<<9);
+                            entry_count+=SUPERPAGE_PAGES;
                         gfn += 1 << (L2_PAGETABLE_SHIFT - PAGE_SHIFT);
                         continue;
                     }

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.4-testing] x86: Fix typo in p2m_pod_set_cache_target, Xen patchbot-3.4-testing <=