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

[Xen-changelog] [xen-unstable] memory hotadd 6/7: Allocate L3 table for whole direct maping range if



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1260521850 0
# Node ID 7d7e221370ead26aaed59075e6033fcfb121d033
# Parent  611f49efe955fc5222942e51e474f1d6028d6d1e
memory hotadd 6/7: 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>
---
 xen/arch/x86/x86_64/mm.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+)

diff -r 611f49efe955 -r 7d7e221370ea xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c  Fri Dec 11 08:56:50 2009 +0000
+++ b/xen/arch/x86/x86_64/mm.c  Fri Dec 11 08:57:30 2009 +0000
@@ -595,6 +595,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 )

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


 


Rackspace

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