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

[Xen-devel] [PATCH v6 4/9] x86/mm: add pv prefix to _put_final_page_type



... so that it is clear it is PV only and can be moved later.

No functional change intended.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/arch/x86/mm.c           | 14 ++++++++++----
 xen/include/asm-x86/pv/mm.h |  7 +++++++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 53212bcce3..64950354f4 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -2414,8 +2414,8 @@ int pv_free_page_type(struct page_info *page, unsigned 
long type,
 }
 
 
-static int _put_final_page_type(struct page_info *page, unsigned long type,
-                                bool preemptible, struct page_info *ptpg)
+int pv_put_final_page_type(struct page_info *page, unsigned long type,
+                           bool preemptible, struct page_info *ptpg)
 {
     int rc = pv_free_page_type(page, type, preemptible);
 
@@ -2473,6 +2473,12 @@ static int _put_page_type(struct page_info *page, bool 
preemptible,
             {
                 int rc;
 
+                /*
+                 * Only PV guests can enter this branch. HAP guests
+                 * can't use those page types.
+                 */
+                ASSERT(is_pv_domain(page_get_owner(page)));
+
                 /*
                  * Page-table pages must be unvalidated when count is zero. The
                  * 'free' is safe because the refcnt is non-zero and validated
@@ -2483,7 +2489,7 @@ static int _put_page_type(struct page_info *page, bool 
preemptible,
                                            x, nx)) != x) )
                     continue;
                 /* We cleared the 'valid bit' so we do the clean up. */
-                rc = _put_final_page_type(page, x, preemptible, ptpg);
+                rc = pv_put_final_page_type(page, x, preemptible, ptpg);
                 if ( x & PGT_partial )
                     put_page(page);
 
@@ -2497,7 +2503,7 @@ static int _put_page_type(struct page_info *page, bool 
preemptible,
                  * linear_pt_count lives in. Pages (including page table ones),
                  * however, don't need their flush time stamp set except when
                  * the last reference is being dropped. For page table pages
-                 * this happens in _put_final_page_type().
+                 * this happens in pv_put_final_page_type().
                  */
                 set_tlbflush_timestamp(page);
             }
diff --git a/xen/include/asm-x86/pv/mm.h b/xen/include/asm-x86/pv/mm.h
index abf798b541..ff9089ec19 100644
--- a/xen/include/asm-x86/pv/mm.h
+++ b/xen/include/asm-x86/pv/mm.h
@@ -35,6 +35,8 @@ int pv_alloc_page_type(struct page_info *page, unsigned long 
type,
                        bool preemptible);
 int pv_free_page_type(struct page_info *page, unsigned long type,
                       bool preemptible);
+int pv_put_final_page_type(struct page_info *page, unsigned long type,
+                           bool preemptible, struct page_info *ptpg);
 #else
 
 #include <xen/errno.h>
@@ -62,6 +64,11 @@ static inline int pv_alloc_page_type(struct page_info *page, 
unsigned long type,
 static inline int pv_free_page_type(struct page_info *page, unsigned long type,
                                     bool preemptible)
 { ASSERT_UNREACHABLE(); return -EINVAL; }
+static inline int pv_put_final_page_type(struct page_info *page,
+                                         unsigned long type,
+                                         bool preemptible,
+                                         struct page_info *ptpg)
+{ ASSERT_UNREACHABLE(); return -EINVAL; }
 
 #endif
 
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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