WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 6/7]Allocate L3 table for whole direct maping range i

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 6/7]Allocate L3 table for whole direct maping range if memory hotplug is supported
From: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>
Date: Thu, 10 Dec 2009 21:29:58 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc:
Delivery-date: Thu, 10 Dec 2009 05:34:45 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acp5nN57zmA7p3/XSpqP3MG6MsxRIw==
Thread-topic: [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
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 6/7]Allocate L3 table for whole direct maping range if memory hotplug is supported, Jiang, Yunhong <=