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

[Xen-devel] [RFC PATCH 79/84] Don't assume bootmem_region_list is mapped. Also fix a double unmap bug.



From: Hongyan Xia <hongyax@xxxxxxxxxx>

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

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 202edcaa17..1555a61b84 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,
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index deeeac065c..6acc1c78a4 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -247,6 +247,7 @@ mfn_t first_valid_mfn = INVALID_MFN_INITIALIZER;
 static struct bootmem_region {
     unsigned long s, e; /* MFNs @s through @e-1 inclusive are free */
 } *__initdata bootmem_region_list;
+struct page_info *bootmem_region_list_pg;
 static unsigned int __initdata nr_bootmem_regions;
 
 struct scrub_region {
@@ -264,7 +265,11 @@ static void __init bootmem_region_add(unsigned long s, 
unsigned long e)
     unsigned int i;
 
     if ( (bootmem_region_list == NULL) && (s < e) )
-        bootmem_region_list = mfn_to_virt(s++);
+    {
+        bootmem_region_list_pg = mfn_to_page(_mfn(s));
+        bootmem_region_list = map_domain_page(_mfn(s));
+        s++;
+    }
 
     if ( s >= e )
         return;
@@ -1869,7 +1874,10 @@ void __init end_boot_allocator(void)
             init_heap_pages(mfn_to_page(_mfn(r->s)), r->e - r->s);
     }
     nr_bootmem_regions = 0;
-    init_heap_pages(virt_to_page(bootmem_region_list), 1);
+    init_heap_pages(bootmem_region_list_pg, 1);
+    /* Remember to discard the mapping for bootmem_region_list. */
+    unmap_domain_page(bootmem_region_list);
+    flush_tlb_one_local(bootmem_region_list);
 
     if ( !dma_bitsize && (num_online_nodes() > 1) )
         dma_bitsize = arch_get_dma_bitsize();
-- 
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®.