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

[Xen-changelog] [xen stable-4.8] x86/mm: Use flags for _put_page_type rather than a boolean



commit 10105fa9ad2f74e07d53b9686c28036489f96de5
Author:     George Dunlap <george.dunlap@xxxxxxxxxx>
AuthorDate: Mon Nov 4 15:24:58 2019 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Nov 4 15:24:58 2019 +0100

    x86/mm: Use flags for _put_page_type rather than a boolean
    
    This is in mainly in preparation for _put_page_type taking the
    partial_flags value in the future.  It also makes it easier to read in
    the caller (since you see a flag name rather than `true` or `false`).
    
    No functional change intended.
    
    This is part of XSA-299.
    
    Reported-by: George Dunlap <george.dunlap@xxxxxxxxxx>
    Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: 0121588ec0f6950ed65d906d860df49be2c8e655
    master date: 2019-10-31 16:12:53 +0100
---
 xen/arch/x86/mm.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 680b5b3de7..1576a083df 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -1392,7 +1392,7 @@ get_page_from_l4e(
             l3e_remove_flags((pl3e), _PAGE_USER|_PAGE_RW|_PAGE_ACCESSED);   \
     } while ( 0 )
 
-static int _put_page_type(struct page_info *page, bool preemptible,
+static int _put_page_type(struct page_info *page, unsigned int flags,
                           struct page_info *ptpg);
 
 void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner)
@@ -1475,7 +1475,7 @@ static int put_page_from_l2e(l2_pgentry_t l2e, unsigned 
long pfn,
               PTF_partial_set )
         {
             ASSERT(!(flags & PTF_defer));
-            rc = _put_page_type(pg, true, ptpg);
+            rc = _put_page_type(pg, PTF_preemptible, ptpg);
         }
         else if ( flags & PTF_defer )
         {
@@ -1484,7 +1484,7 @@ static int put_page_from_l2e(l2_pgentry_t l2e, unsigned 
long pfn,
         }
         else
         {
-            rc = _put_page_type(pg, true, ptpg);
+            rc = _put_page_type(pg, PTF_preemptible, ptpg);
             if ( likely(!rc) )
                 put_page(pg);
         }
@@ -1521,7 +1521,7 @@ static int put_page_from_l3e(l3_pgentry_t l3e, unsigned 
long pfn,
          PTF_partial_set )
     {
         ASSERT(!(flags & PTF_defer));
-        return _put_page_type(pg, true, mfn_to_page(pfn));
+        return _put_page_type(pg, PTF_preemptible, mfn_to_page(pfn));
     }
 
     if ( flags & PTF_defer )
@@ -1531,7 +1531,7 @@ static int put_page_from_l3e(l3_pgentry_t l3e, unsigned 
long pfn,
         return 0;
     }
 
-    rc = _put_page_type(pg, true, mfn_to_page(pfn));
+    rc = _put_page_type(pg, PTF_preemptible, mfn_to_page(pfn));
     if ( likely(!rc) )
         put_page(pg);
 
@@ -1552,7 +1552,7 @@ static int put_page_from_l4e(l4_pgentry_t l4e, unsigned 
long pfn,
               PTF_partial_set )
         {
             ASSERT(!(flags & PTF_defer));
-            return _put_page_type(pg, true, mfn_to_page(pfn));
+            return _put_page_type(pg, PTF_preemptible, mfn_to_page(pfn));
         }
 
         if ( flags & PTF_defer )
@@ -1562,7 +1562,7 @@ static int put_page_from_l4e(l4_pgentry_t l4e, unsigned 
long pfn,
             return 0;
         }
 
-        rc = _put_page_type(pg, true, mfn_to_page(pfn));
+        rc = _put_page_type(pg, PTF_preemptible, mfn_to_page(pfn));
         if ( likely(!rc) )
             put_page(pg);
     }
@@ -2825,11 +2825,12 @@ static int _put_final_page_type(struct page_info *page, 
unsigned long type,
 }
 
 
-static int _put_page_type(struct page_info *page, bool preemptible,
+static int _put_page_type(struct page_info *page, unsigned int flags,
                           struct page_info *ptpg)
 {
     unsigned long nx, x, y = page->u.inuse.type_info;
     int rc = 0;
+    bool preemptible = flags & PTF_preemptible;
 
     for ( ; ; )
     {
@@ -3024,7 +3025,7 @@ static int __get_page_type(struct page_info *page, 
unsigned long type,
 
             if ( unlikely(iommu_ret) )
             {
-                _put_page_type(page, false, NULL);
+                _put_page_type(page, 0, NULL);
                 rc = iommu_ret;
                 goto out;
             }
@@ -3051,7 +3052,7 @@ static int __get_page_type(struct page_info *page, 
unsigned long type,
 
 void put_page_type(struct page_info *page)
 {
-    int rc = _put_page_type(page, false, NULL);
+    int rc = _put_page_type(page, 0, NULL);
     ASSERT(rc == 0);
     (void)rc;
 }
@@ -3067,7 +3068,7 @@ int get_page_type(struct page_info *page, unsigned long 
type)
 
 int put_page_type_preemptible(struct page_info *page)
 {
-    return _put_page_type(page, true, NULL);
+    return _put_page_type(page, PTF_preemptible, NULL);
 }
 
 int get_page_type_preemptible(struct page_info *page, unsigned long type)
@@ -3273,7 +3274,7 @@ int put_old_guest_table(struct vcpu *v)
     if ( !v->arch.old_guest_table )
         return 0;
 
-    switch ( rc = _put_page_type(v->arch.old_guest_table, true,
+    switch ( rc = _put_page_type(v->arch.old_guest_table, PTF_preemptible,
                                  v->arch.old_guest_ptpg) )
     {
     case -EINTR:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.8

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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