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

[Xen-devel] [PATCH 6/7]Allocate L3 table for whole direct maping range if memory hotplug is supported



Allocate L3 table for whole direct maping range if memory hotplug is supported

Hot-added memory may need a new L4 entry for 1:1 mapping. This patch setup all 
L4 entry for 1:1 mapping if memory hotadd is needed, so that we don't need sync 
the guest page table in page fault handler.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@xxxxxxxxx>

diff -r a34b0e0c5c94 xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c  Thu Dec 10 03:18:09 2009 +0800
+++ b/xen/arch/x86/x86_64/mm.c  Thu Dec 10 03:26:29 2009 +0800
@@ -746,6 +746,32 @@ void __init paging_init(void)
     l3_pgentry_t *l3_ro_mpt;
     l2_pgentry_t *l2_ro_mpt = NULL;
     struct page_info *l1_pg, *l2_pg, *l3_pg;
+
+    /*
+     * We setup the L3s for 1:1 mapping if host support memory hotplug
+     * to avoid sync the 1:1 mapping on page fault handler
+     */
+    if ( mem_hotplug )
+    {
+        unsigned long va;
+
+        for ( va = DIRECTMAP_VIRT_START;
+              va < DIRECTMAP_VIRT_END;
+              va += (1UL << L4_PAGETABLE_SHIFT) )
+        {
+            if ( !(l4e_get_flags(idle_pg_table[l4_table_offset(va)]) &
+                  _PAGE_PRESENT) )
+            {
+                l3_pg = alloc_domheap_page(NULL, 0);
+                if ( !l3_pg )
+                    goto nomem;
+                l3_ro_mpt = page_to_virt(l3_pg);
+                clear_page(l3_ro_mpt);
+                l4e_write(&idle_pg_table[l4_table_offset(va)],
+                  l4e_from_page(l3_pg, __PAGE_HYPERVISOR));
+            }
+        }
+    }
 
     /* Create user-accessible L2 directory to map the MPT for guests. */
     if ( (l3_pg = alloc_domheap_page(NULL, 0)) == NULL )


Attachment: 06-full_direct_map.patch
Description: 06-full_direct_map.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

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