diff mbox series

[RFC,78/84] Revert "x86/smpboot: use xenheap pages for rpts in smpboot."

Message ID efa85559fd4972ae664b36683cd9ece6950f2aa1.1569489002.git.hongyax@amazon.com (mailing list archive)
State New, archived
Headers show
Series Remove direct map from Xen | expand

Commit Message

Xia, Hongyan Sept. 26, 2019, 9:46 a.m. UTC
From: Hongyan Xia <hongyax@amazon.com>

We have properly handled (un)mapping of pages in restore_all_guests.
This hack is no longer required.

Signed-off-by: Hongyan Xia <hongyax@amazon.com>
---
 xen/arch/x86/smpboot.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

Comments

Wei Liu Sept. 26, 2019, 2:54 p.m. UTC | #1
On Thu, Sep 26, 2019 at 10:46:41AM +0100, hongyax@amazon.com wrote:
> From: Hongyan Xia <hongyax@amazon.com>
> 
> We have properly handled (un)mapping of pages in restore_all_guests.
> This hack is no longer required.
> 
> Signed-off-by: Hongyan Xia <hongyax@amazon.com>

If you rearrange this series  a bit you don't need this and the patch it
reverts in the first place, I think.

Wei.
diff mbox series

Patch

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 7034c699d6..53f9173f37 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -832,20 +832,14 @@  static int setup_cpu_root_pgt(unsigned int cpu)
         goto out;
     }
 
-    /*
-     * Unfortunately, some code (especially in assembly) assumes the rpt is in
-     * the DIRECTMAP region and is always mapped. Making all of them adapt to
-     * the new page table APIs is non-trivial. For now, make it always mapped
-     * on the xenheap.
-     */
-    rpt = alloc_xenheap_page();
-    if ( !rpt )
+    rpt_mfn = alloc_xen_pagetable();
+    if ( mfn_eq(rpt_mfn, INVALID_MFN) )
     {
         rc = -ENOMEM;
         goto out;
     }
 
-    rpt_mfn = _mfn(virt_to_mfn(rpt));
+    rpt = map_xen_pagetable(rpt_mfn);
     clear_page(rpt);
     per_cpu(root_pgt_mfn, cpu) = rpt_mfn;
 
@@ -890,6 +884,7 @@  static int setup_cpu_root_pgt(unsigned int cpu)
         rc = clone_mapping((void *)per_cpu(stubs.addr, cpu), rpt);
 
  out:
+    UNMAP_XEN_PAGETABLE(rpt);
     return rc;
 }
 
@@ -905,7 +900,7 @@  static void cleanup_cpu_root_pgt(unsigned int cpu)
 
     per_cpu(root_pgt_mfn, cpu) = INVALID_MFN;
 
-    rpt = mfn_to_virt(mfn_x(rpt_mfn));
+    rpt = map_xen_pagetable(rpt_mfn);
 
     for ( r = root_table_offset(DIRECTMAP_VIRT_START);
           r < root_table_offset(HYPERVISOR_VIRT_END); ++r )
@@ -950,8 +945,8 @@  static void cleanup_cpu_root_pgt(unsigned int cpu)
         free_xen_pagetable(l3t_mfn);
     }
 
-    /* Unlike other levels, the root level is a xenheap page. */
-    free_xenheap_page(rpt);
+    UNMAP_XEN_PAGETABLE(rpt);
+    free_xen_pagetable(rpt_mfn);
 
     /* Also zap the stub mapping for this CPU. */
     if ( stub_linear )