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

[Xen-devel] [RFC PATCH 82/84] x86: deduplicate code a bit and fix an unmapping bug.



From: Hongyan Xia <hongyax@xxxxxxxxxx>

Signed-off-by: Hongyan Xia <hongyax@xxxxxxxxxx>
---
 xen/arch/x86/domain_page.c   | 28 +++++++++++-----------------
 xen/arch/x86/pv/dom0_build.c |  2 +-
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/domain_page.c b/xen/arch/x86/domain_page.c
index f606677ae6..782dd0650c 100644
--- a/xen/arch/x86/domain_page.c
+++ b/xen/arch/x86/domain_page.c
@@ -77,29 +77,16 @@ void *map_domain_page(mfn_t mfn)
     struct mapcache_domain *dcache;
     struct mapcache_vcpu *vcache;
     struct vcpu_maphash_entry *hashent;
+    void *ret;
 
     v = mapcache_current_vcpu();
     if ( !v )
-    {
-        void *ret;
-        pmap_lock();
-        ret = pmap_map(mfn);
-        pmap_unlock();
-        flush_tlb_one_local(ret);
-        return ret;
-    }
+        goto pmap;
 
     dcache = &v->domain->arch.mapcache;
     vcache = &v->arch.mapcache;
     if ( !dcache->inuse )
-    {
-        void *ret;
-        pmap_lock();
-        ret = pmap_map(mfn);
-        pmap_unlock();
-        flush_tlb_one_local(ret);
-        return ret;
-    }
+        goto pmap;
 
     perfc_incr(map_domain_page_count);
 
@@ -179,9 +166,16 @@ void *map_domain_page(mfn_t mfn)
 
     l1e_write(&MAPCACHE_L1ENT(idx), l1e_from_mfn(mfn, __PAGE_HYPERVISOR_RW));
 
- out:
+out:
     local_irq_restore(flags);
     return (void *)MAPCACHE_VIRT_START + pfn_to_paddr(idx);
+
+pmap:
+    pmap_lock();
+    ret = pmap_map(mfn);
+    pmap_unlock();
+    flush_tlb_one_local(ret);
+    return ret;
 }
 
 void unmap_domain_page(const void *ptr)
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 1555a61b84..202edcaa17 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -236,7 +236,7 @@ static __init void setup_pv_physmap(struct domain *d, 
unsigned long pgtbl_pfn,
     if ( pl3e )
         unmap_domain_page(pl3e);
 
-    //unmap_domain_page(l4start);
+    unmap_domain_page(l4start);
 }
 
 static struct page_info * __init alloc_chunk(struct domain *d,
-- 
2.17.1


_______________________________________________
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®.