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

[Xen-devel] [RFC PATCH 38/84] x86/smpboot: switch pl1e to use new APIs in clone_mapping



From: Wei Liu <wei.liu2@xxxxxxxxxx>

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/arch/x86/smpboot.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index d3651fb99a..daf734d095 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -668,7 +668,7 @@ static int clone_mapping(const void *ptr, root_pgentry_t 
*rpt)
     unsigned int flags;
     l3_pgentry_t *pl3e = NULL;
     l2_pgentry_t *pl2e = NULL;
-    l1_pgentry_t *pl1e;
+    l1_pgentry_t *pl1e = NULL;
     int rc;
 
     /*
@@ -715,7 +715,8 @@ static int clone_mapping(const void *ptr, root_pgentry_t 
*rpt)
         }
         else
         {
-            pl1e = l2e_to_l1e(*pl2e) + l1_table_offset(linear);
+            pl1e = map_xen_pagetable_new(l2e_get_mfn(*pl2e));
+            pl1e += l1_table_offset(linear);
             flags = l1e_get_flags(*pl1e);
             if ( !(flags & _PAGE_PRESENT) )
             {
@@ -726,6 +727,7 @@ static int clone_mapping(const void *ptr, root_pgentry_t 
*rpt)
         }
     }
 
+    UNMAP_XEN_PAGETABLE_NEW(pl1e);
     UNMAP_XEN_PAGETABLE_NEW(pl2e);
     UNMAP_XEN_PAGETABLE_NEW(pl3e);
 
@@ -774,19 +776,22 @@ static int clone_mapping(const void *ptr, root_pgentry_t 
*rpt)
 
     if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
     {
-        pl1e = alloc_xen_pagetable();
-        if ( !pl1e )
+        mfn_t l1t_mfn = alloc_xen_pagetable_new();
+
+        if ( mfn_eq(l1t_mfn, INVALID_MFN) )
         {
             rc = -ENOMEM;
             goto out;
         }
+
+        pl1e = map_xen_pagetable_new(l1t_mfn);
         clear_page(pl1e);
-        l2e_write(pl2e, l2e_from_paddr(__pa(pl1e), __PAGE_HYPERVISOR));
+        l2e_write(pl2e, l2e_from_mfn(l1t_mfn, __PAGE_HYPERVISOR));
     }
     else
     {
         ASSERT(!(l2e_get_flags(*pl2e) & _PAGE_PSE));
-        pl1e = l2e_to_l1e(*pl2e);
+        pl1e = map_xen_pagetable_new(l2e_get_mfn(*pl2e));
     }
 
     pl1e += l1_table_offset(linear);
@@ -802,6 +807,7 @@ static int clone_mapping(const void *ptr, root_pgentry_t 
*rpt)
 
     rc = 0;
  out:
+    UNMAP_XEN_PAGETABLE_NEW(pl1e);
     UNMAP_XEN_PAGETABLE_NEW(pl2e);
     UNMAP_XEN_PAGETABLE_NEW(pl3e);
     return rc;
-- 
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®.