xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: xen-devel@lists.xen.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: [PATCH 15/15] xen/x86: p2m-pod: Rework prototype of p2m_pod_demand_populate
Date: Wed, 13 Sep 2017 18:59:53 +0100	[thread overview]
Message-ID: <20170913175953.16942-16-julien.grall@arm.com> (raw)
In-Reply-To: <20170913175953.16942-1-julien.grall@arm.com>

    - Switch the return type to bool
    - Remove the parameter p2m_query_t q as it is not used

Signed-off-by: Julien Grall <julien.grall@arm.com>

---

Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/p2m-ept.c |  5 ++---
 xen/arch/x86/mm/p2m-pod.c | 15 +++++++--------
 xen/arch/x86/mm/p2m-pt.c  |  6 +++---
 xen/include/asm-x86/p2m.h |  6 ++----
 4 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 36627f1ce0..641b90ec07 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_t, i * EPT_TABLE_ORDER, q) )
+            if ( p2m_pod_demand_populate(p2m, gfn_t, i * EPT_TABLE_ORDER) )
                 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_t,
-                                        PAGE_ORDER_4K, q) )
+        if ( !p2m_pod_demand_populate(p2m, gfn_t, PAGE_ORDER_4K) )
             goto out;
     }
 
diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 311762b1ce..89b7dc949d 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -1075,10 +1075,9 @@ static void pod_eager_record(struct p2m_domain *p2m, gfn_t gfn,
     mrp->idx %= ARRAY_SIZE(mrp->list);
 }
 
-int
+bool
 p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn,
-                        unsigned int order,
-                        p2m_query_t q)
+                        unsigned int order)
 {
     struct domain *d = p2m->domain;
     struct page_info *p = NULL; /* Compiler warnings */
@@ -1116,7 +1115,7 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn,
          */
         p2m_set_entry(p2m, gfn_aligned, INVALID_MFN, PAGE_ORDER_2M,
                       p2m_populate_on_demand, p2m->default_access);
-        return 0;
+        return true;
     }
 
     /* Only reclaim if we're in actual need of more cache. */
@@ -1178,7 +1177,7 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn,
     }
 
     pod_unlock(p2m);
-    return 0;
+    return true;
 out_of_memory:
     pod_unlock(p2m);
 
@@ -1186,10 +1185,10 @@ out_of_memory:
            __func__, d->domain_id, d->tot_pages, p2m->pod.entry_count,
            current->domain->domain_id);
     domain_crash(d);
-    return -1;
+    return false;
 out_fail:
     pod_unlock(p2m);
-    return -1;
+    return false;
 remap_and_retry:
     BUG_ON(order != PAGE_ORDER_2M);
     pod_unlock(p2m);
@@ -1215,7 +1214,7 @@ remap_and_retry:
         __trace_var(TRC_MEM_POD_SUPERPAGE_SPLINTER, 0, sizeof(t), &t);
     }
 
-    return 0;
+    return true;
 }
 
 
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index 3dd4bef66e..86946a09db 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_t, PAGE_ORDER_1G, q) )
+                    if ( p2m_pod_demand_populate(p2m, gfn_t, PAGE_ORDER_1G) )
                         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_t, PAGE_ORDER_2M, q) )
+                if ( p2m_pod_demand_populate(p2m, gfn_t, PAGE_ORDER_2M) )
                     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_t, PAGE_ORDER_4K, q) )
+                if ( p2m_pod_demand_populate(p2m, gfn_t, PAGE_ORDER_4K) )
                     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 e8a9dca480..70f00c332f 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -719,10 +719,8 @@ extern void audit_p2m(struct domain *d,
 #endif
 
 /* Called by p2m code when demand-populating a PoD page */
-int
-p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn,
-                        unsigned int order,
-                        p2m_query_t q);
+bool
+p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn, unsigned int order);
 
 /*
  * Functions specific to the p2m-pt implementation
-- 
2.11.0


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

  parent reply	other threads:[~2017-09-13 17:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-13 17:59 [PATCH 00/15] xen/x86: Clean-up the PoD code Julien Grall
2017-09-13 17:59 ` [PATCH 01/15] xen/x86: p2m-pod: Clean-up includes Julien Grall
2017-09-13 17:59 ` [PATCH 02/15] xen/x86: p2m-pod: Remove trailing whitespaces Julien Grall
2017-09-13 17:59 ` [PATCH 03/15] xen/x86: p2m-pod: Fix coding style for comments Julien Grall
2017-09-13 17:59 ` [PATCH 04/15] xen/x86: p2m-pod: Fix coding style Julien Grall
2017-09-13 17:59 ` [PATCH 05/15] xen/x86: p2m-pod: Avoid redundant assignments in p2m_pod_demand_populate Julien Grall
2017-09-13 17:59 ` [PATCH 06/15] xen/x86: p2m-pod: Clean-up use of typesafe MFN Julien Grall
2017-09-13 17:59 ` [PATCH 07/15] xen/x86: p2m-pod: Use typesafe gfn in p2m_pod_decrease_reservation Julien Grall
2017-09-13 17:59 ` [PATCH 08/15] xen/x86: p2m: Use typesafe gfn for the P2M callbacks get_entry and set_entry Julien Grall
2017-09-13 18:22   ` Andrew Cooper
2017-09-13 18:27     ` Julien Grall
2017-09-13 19:10       ` Razvan Cojocaru
2017-09-13 19:08   ` Razvan Cojocaru
2017-09-13 19:32     ` Julien Grall
2017-09-20  6:57   ` Tian, Kevin
2017-09-13 17:59 ` [PATCH 09/15] xen/x86: p2m: Use typesafe GFN in p2m_set_entry Julien Grall
2017-09-13 20:16   ` Tamas K Lengyel
2017-09-13 17:59 ` [PATCH 10/15] xen/x86: p2m-pod: Use typesafe GFN in pod_eager_record Julien Grall
2017-09-13 17:59 ` [PATCH 11/15] xen/x86: p2m-pod: Clean-up p2m_pod_zero_check Julien Grall
2017-09-13 17:59 ` [PATCH 12/15] xen/x86: p2m-pod: Use typesafe gfn in p2m_pod_zero_check Julien Grall
2017-09-13 17:59 ` [PATCH 13/15] xen/x86: p2m-pod: Use typesafe gfn in p2m_pod_demand_populate Julien Grall
2017-09-13 17:59 ` [PATCH 14/15] xen/x86: p2m-pod: Use typesafe gfn for the fields reclaim_single and max_guest Julien Grall
2017-09-13 17:59 ` Julien Grall [this message]
2017-09-13 18:30 ` [PATCH 00/15] xen/x86: Clean-up the PoD code Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170913175953.16942-16-julien.grall@arm.com \
    --to=julien.grall@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).