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

[Xen-changelog] [xen master] x86/mm: PV GDT handling cleanup



commit cb1daee1b505aafe9f6fd79a5e5b789be4674c1d
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu May 21 08:56:24 2015 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu May 21 08:56:24 2015 +0200

    x86/mm: PV GDT handling cleanup
    
    These are a few bits of cleanup noticed when double checking the PV GDT
    handling for migration v2.
    
     * Drop write-only 'mfn' variable in set_gdt()
     * Hoist page_get_owner() call in alloc_segdesc_page() and unify exit paths
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/mm.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 5fe08df..74e146d 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -545,21 +545,17 @@ static void invalidate_shadow_ldt(struct vcpu *v, int 
flush)
 
 static int alloc_segdesc_page(struct page_info *page)
 {
-    struct desc_struct *descs;
-    int i;
-
-    descs = __map_domain_page(page);
+    const struct domain *owner = page_get_owner(page);
+    struct desc_struct *descs = __map_domain_page(page);
+    unsigned i;
 
     for ( i = 0; i < 512; i++ )
-        if ( unlikely(!check_descriptor(page_get_owner(page), &descs[i])) )
-            goto fail;
+        if ( unlikely(!check_descriptor(owner, &descs[i])) )
+            break;
 
     unmap_domain_page(descs);
-    return 0;
 
- fail:
-    unmap_domain_page(descs);
-    return -EINVAL;
+    return i == 512 ? 0 : -EINVAL;
 }
 
 
@@ -4382,7 +4378,7 @@ long set_gdt(struct vcpu *v,
     l1_pgentry_t *pl1e;
     /* NB. There are 512 8-byte entries per GDT page. */
     int i, nr_pages = (entries + 511) / 512;
-    unsigned long mfn, *pfns;
+    unsigned long *pfns;
 
     if ( entries > FIRST_RESERVED_GDT_ENTRY )
         return -EINVAL;
@@ -4404,7 +4400,7 @@ long set_gdt(struct vcpu *v,
             put_page(page);
             goto fail;
         }
-        mfn = frames[i] = page_to_mfn(page);
+        frames[i] = page_to_mfn(page);
     }
 
     /* Tear down the old GDT. */
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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