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

[Xen-devel] [PATCH v5 16/23] x86/mm: add pv prefix to {alloc, free}_page_type



And move the declarations to pv/mm.h. The code will be moved later.

The stubs contain BUG() because they aren't supposed to be called when
PV is disabled.

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

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index e9367bd8aa..3abd37e4dc 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1812,7 +1812,7 @@ static int relinquish_memory(
             if ( likely(y == x) )
             {
                 /* No need for atomic update of type_info here: noone else 
updates it. */
-                switch ( ret = free_page_type(page, x, 1) )
+                switch ( ret = pv_free_page_type(page, x, 1) )
                 {
                 case 0:
                     break;
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 3a919c19b8..86c7466fa0 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -1987,8 +1987,8 @@ static void get_page_light(struct page_info *page)
     while ( unlikely(y != x) );
 }
 
-static int alloc_page_type(struct page_info *page, unsigned long type,
-                           int preemptible)
+int pv_alloc_page_type(struct page_info *page, unsigned long type,
+                       int preemptible)
 {
     struct domain *owner = page_get_owner(page);
     int rc;
@@ -2017,7 +2017,7 @@ static int alloc_page_type(struct page_info *page, 
unsigned long type,
         rc = alloc_segdesc_page(page);
         break;
     default:
-        printk("Bad type in alloc_page_type %lx t=%" PRtype_info " c=%lx\n",
+        printk("Bad type in %s %lx t=%" PRtype_info " c=%lx\n", __func__,
                type, page->u.inuse.type_info,
                page->count_info);
         rc = -EINVAL;
@@ -2061,8 +2061,8 @@ static int alloc_page_type(struct page_info *page, 
unsigned long type,
 }
 
 
-int free_page_type(struct page_info *page, unsigned long type,
-                   int preemptible)
+int pv_free_page_type(struct page_info *page, unsigned long type,
+                      int preemptible)
 {
     struct domain *owner = page_get_owner(page);
     unsigned long gmfn;
@@ -2119,7 +2119,7 @@ int free_page_type(struct page_info *page, unsigned long 
type,
 static int __put_final_page_type(
     struct page_info *page, unsigned long type, int preemptible)
 {
-    int rc = free_page_type(page, type, preemptible);
+    int rc = pv_free_page_type(page, type, preemptible);
 
     /* No need for atomic update of type_info here: noone else updates it. */
     if ( rc == 0 )
@@ -2337,7 +2337,7 @@ static int __get_page_type(struct page_info *page, 
unsigned long type,
             page->nr_validated_ptes = 0;
             page->partial_pte = 0;
         }
-        rc = alloc_page_type(page, type, preemptible);
+        rc = pv_alloc_page_type(page, type, preemptible);
     }
 
     if ( (x & PGT_partial) && !(nx & PGT_partial) )
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index f2e0f498c4..56b2b94195 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -326,9 +326,6 @@ static inline void *__page_to_virt(const struct page_info 
*pg)
                     (PAGE_SIZE / (sizeof(*pg) & -sizeof(*pg))));
 }
 
-int free_page_type(struct page_info *page, unsigned long type,
-                   int preemptible);
-
 bool fill_ro_mpt(mfn_t mfn);
 void zap_ro_mpt(mfn_t mfn);
 
diff --git a/xen/include/asm-x86/pv/mm.h b/xen/include/asm-x86/pv/mm.h
index 4944a70c7a..0cd8beec39 100644
--- a/xen/include/asm-x86/pv/mm.h
+++ b/xen/include/asm-x86/pv/mm.h
@@ -32,6 +32,11 @@ bool pv_map_ldt_shadow_page(unsigned int off);
 
 void pv_arch_init_memory(void);
 
+int pv_alloc_page_type(struct page_info *page, unsigned long type,
+                       int preemptible);
+int pv_free_page_type(struct page_info *page, unsigned long type,
+                      int preemptible);
+
 #else
 
 #include <xen/errno.h>
@@ -51,6 +56,13 @@ static inline bool pv_map_ldt_shadow_page(unsigned int off) 
{ return false; }
 
 static inline void pv_arch_init_memory(void) {}
 
+static inline int pv_alloc_page_type(struct page_info *page, unsigned long 
type,
+                                     int preemptible)
+{ BUG(); return -EINVAL; }
+static inline int pv_free_page_type(struct page_info *page, unsigned long type,
+                                    int preemptible)
+{ BUG(); return -EINVAL; }
+
 #endif
 
 #endif /* __X86_PV_MM_H__ */
-- 
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®.