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

[Xen-devel] [PATCH v2 13/16] xen/x86: p2m-pod: Use typesafe gfn in p2m_pod_demand_populate



Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

---

Cc: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

    Changes in v2:
        - Add Andrew's acked-by
        - Variable gfn_t was renamed to gfn_ in a previous patch. So use
        the new name
---
 xen/arch/x86/mm/p2m-ept.c |  5 ++---
 xen/arch/x86/mm/p2m-pod.c | 12 ++++++------
 xen/arch/x86/mm/p2m-pt.c  |  6 +++---
 xen/include/asm-x86/p2m.h |  2 +-
 4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index f14d1686b7..bc25582c5a 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -965,7 +965,7 @@ static mfn_t ept_get_entry(struct p2m_domain *p2m,
             index = gfn_remainder >> ( i * EPT_TABLE_ORDER);
             ept_entry = table + index;
 
-            if ( !p2m_pod_demand_populate(p2m, gfn, i * EPT_TABLE_ORDER, q) )
+            if ( !p2m_pod_demand_populate(p2m, gfn_, i * EPT_TABLE_ORDER, q) )
                 goto retry;
             else
                 goto out;
@@ -987,8 +987,7 @@ static mfn_t ept_get_entry(struct p2m_domain *p2m,
 
         ASSERT(i == 0);
         
-        if ( p2m_pod_demand_populate(p2m, gfn, 
-                                        PAGE_ORDER_4K, q) )
+        if ( p2m_pod_demand_populate(p2m, gfn_, PAGE_ORDER_4K, q) )
             goto out;
     }
 
diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 0dd0f0a083..5c79444d7b 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -1076,13 +1076,13 @@ static void pod_eager_record(struct p2m_domain *p2m, 
gfn_t gfn,
 }
 
 int
-p2m_pod_demand_populate(struct p2m_domain *p2m, unsigned long gfn,
+p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn,
                         unsigned int order,
                         p2m_query_t q)
 {
     struct domain *d = p2m->domain;
     struct page_info *p = NULL; /* Compiler warnings */
-    gfn_t gfn_aligned = _gfn((gfn >> order) << order);
+    gfn_t gfn_aligned = _gfn((gfn_x(gfn) >> order) << order);
     mfn_t mfn;
     unsigned long i;
 
@@ -1135,8 +1135,8 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, unsigned 
long gfn,
         goto out_of_memory;
 
     /* Keep track of the highest gfn demand-populated by a guest fault */
-    if ( gfn > p2m->pod.max_guest )
-        p2m->pod.max_guest = gfn;
+    if ( gfn_x(gfn) > p2m->pod.max_guest )
+        p2m->pod.max_guest = gfn_x(gfn);
 
     /*
      * Get a page f/ the cache.  A NULL return value indicates that the
@@ -1170,7 +1170,7 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, unsigned 
long gfn,
             int d:16,order:16;
         } t;
 
-        t.gfn = gfn;
+        t.gfn = gfn_x(gfn);
         t.mfn = mfn_x(mfn);
         t.d = d->domain_id;
         t.order = order;
@@ -1210,7 +1210,7 @@ remap_and_retry:
             int d:16;
         } t;
 
-        t.gfn = gfn;
+        t.gfn = gfn_x(gfn);
         t.d = d->domain_id;
 
         __trace_var(TRC_MEM_POD_SUPERPAGE_SPLINTER, 0, sizeof(t), &t);
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index 4bfec4f5f0..a639a00e9c 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -802,7 +802,7 @@ pod_retry_l3:
             {
                 if ( q & P2M_ALLOC )
                 {
-                    if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_1G, q) )
+                    if ( !p2m_pod_demand_populate(p2m, gfn_, PAGE_ORDER_1G, q) 
)
                         goto pod_retry_l3;
                     gdprintk(XENLOG_ERR, "%s: Allocate 1GB failed!\n", 
__func__);
                 }
@@ -844,7 +844,7 @@ pod_retry_l2:
         if ( p2m_flags_to_type(flags) == p2m_populate_on_demand )
         {
             if ( q & P2M_ALLOC ) {
-                if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_2M, q) )
+                if ( !p2m_pod_demand_populate(p2m, gfn_, PAGE_ORDER_2M, q) )
                     goto pod_retry_l2;
             } else
                 *t = p2m_populate_on_demand;
@@ -883,7 +883,7 @@ pod_retry_l1:
         if ( l1t == p2m_populate_on_demand )
         {
             if ( q & P2M_ALLOC ) {
-                if ( !p2m_pod_demand_populate(p2m, gfn, PAGE_ORDER_4K, q) )
+                if ( !p2m_pod_demand_populate(p2m, gfn_, PAGE_ORDER_4K, q) )
                     goto pod_retry_l1;
             } else
                 *t = p2m_populate_on_demand;
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 07ca02a173..1ae9216404 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -720,7 +720,7 @@ extern void audit_p2m(struct domain *d,
 
 /* Called by p2m code when demand-populating a PoD page */
 int
-p2m_pod_demand_populate(struct p2m_domain *p2m, unsigned long gfn,
+p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn,
                         unsigned int order,
                         p2m_query_t q);
 
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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