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-changelog

[Xen-changelog] The perdomain mapping area in Xen space requires more th

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] The perdomain mapping area in Xen space requires more than
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 17 Nov 2005 16:02:11 +0000
Delivery-date: Thu, 17 Nov 2005 16:02:51 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID c640c0c7f821a202fecda775811184d1cf851cbe
# Parent  9da47130ff421727defa26bd91c22bec1125a87f
The perdomain mapping area in Xen space requires more than
one level-1 pagetable page on PAE and x86/64. Generalise
the existing code to allocate and map an appropriate number
of level-1 pagetable pages.

Signed-off-by: Jun Nakajima <jun.nakajima@xxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 9da47130ff42 -r c640c0c7f821 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Thu Nov 17 11:12:57 2005
+++ b/xen/arch/x86/domain.c     Thu Nov 17 11:52:42 2005
@@ -240,7 +240,10 @@
 
 void free_perdomain_pt(struct domain *d)
 {
-    free_xenheap_page(d->arch.mm_perdomain_pt);
+    free_xenheap_pages(
+        d->arch.mm_perdomain_pt,
+        get_order_from_bytes(PDPT_L1_ENTRIES * sizeof(l1_pgentry_t)));
+
 #ifdef __x86_64__
     free_xenheap_page(d->arch.mm_perdomain_l2);
     free_xenheap_page(d->arch.mm_perdomain_l3);
@@ -251,7 +254,7 @@
 {
     struct domain *d = v->domain;
     l1_pgentry_t gdt_l1e;
-    int vcpuid;
+    int vcpuid, pdpt_order;
 
     if ( is_idle_task(d) )
         return;
@@ -263,13 +266,10 @@
     v->vcpu_info = &d->shared_info->vcpu_data[v->vcpu_id];
     v->cpumap = CPUMAP_RUNANYWHERE;
     SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d);
-    set_pfn_from_mfn(virt_to_phys(d->shared_info) >> PAGE_SHIFT,
-            INVALID_M2P_ENTRY);
-
-    d->arch.mm_perdomain_pt = alloc_xenheap_page();
-    memset(d->arch.mm_perdomain_pt, 0, PAGE_SIZE);
-    set_pfn_from_mfn(virt_to_phys(d->arch.mm_perdomain_pt) >> PAGE_SHIFT,
-            INVALID_M2P_ENTRY);
+
+    pdpt_order = get_order_from_bytes(PDPT_L1_ENTRIES * sizeof(l1_pgentry_t));
+    d->arch.mm_perdomain_pt = alloc_xenheap_pages(pdpt_order);
+    memset(d->arch.mm_perdomain_pt, 0, PAGE_SIZE << pdpt_order);
     v->arch.perdomain_ptes = d->arch.mm_perdomain_pt;
 
     /*
@@ -293,9 +293,11 @@
 
     d->arch.mm_perdomain_l2 = alloc_xenheap_page();
     memset(d->arch.mm_perdomain_l2, 0, PAGE_SIZE);
-    d->arch.mm_perdomain_l2[l2_table_offset(PERDOMAIN_VIRT_START)] =
-        l2e_from_page(virt_to_page(d->arch.mm_perdomain_pt),
-                        __PAGE_HYPERVISOR);
+    for ( i = 0; i < (1 << pdpt_order); i++ )
+        d->arch.mm_perdomain_l2[l2_table_offset(PERDOMAIN_VIRT_START)+i] =
+            l2e_from_page(virt_to_page(d->arch.mm_perdomain_pt)+i,
+                          __PAGE_HYPERVISOR);
+
     d->arch.mm_perdomain_l3 = alloc_xenheap_page();
     memset(d->arch.mm_perdomain_l3, 0, PAGE_SIZE);
     d->arch.mm_perdomain_l3[l3_table_offset(PERDOMAIN_VIRT_START)] =
diff -r 9da47130ff42 -r c640c0c7f821 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Thu Nov 17 11:12:57 2005
+++ b/xen/arch/x86/mm.c Thu Nov 17 11:52:42 2005
@@ -738,7 +738,7 @@
     memcpy(&pl2e[L2_PAGETABLE_FIRST_XEN_SLOT & (L2_PAGETABLE_ENTRIES-1)],
            &idle_pg_table_l2[L2_PAGETABLE_FIRST_XEN_SLOT],
            L2_PAGETABLE_XEN_SLOTS * sizeof(l2_pgentry_t));
-    for ( i = 0; i < (PERDOMAIN_MBYTES >> (L2_PAGETABLE_SHIFT - 20)); i++ )
+    for ( i = 0; i < PDPT_L2_ENTRIES; i++ )
         pl2e[l2_table_offset(PERDOMAIN_VIRT_START) + i] =
             l2e_from_page(
                 virt_to_page(page_get_owner(page)->arch.mm_perdomain_pt) + i,
diff -r 9da47130ff42 -r c640c0c7f821 xen/arch/x86/shadow.c
--- a/xen/arch/x86/shadow.c     Thu Nov 17 11:12:57 2005
+++ b/xen/arch/x86/shadow.c     Thu Nov 17 11:52:42 2005
@@ -2710,7 +2710,7 @@
            &idle_pg_table_l2[L2_PAGETABLE_FIRST_XEN_SLOT],
            L2_PAGETABLE_XEN_SLOTS * sizeof(l2_pgentry_t));       
 
-        for ( i = 0; i < (PERDOMAIN_MBYTES >> (L2_PAGETABLE_SHIFT - 20)); i++ )
+        for ( i = 0; i < PDPT_L2_ENTRIES; i++ )
             spl2e[l2_table_offset(PERDOMAIN_VIRT_START) + i] =
                 l2e_from_page(
                     
virt_to_page(page_get_owner(&frame_table[gmfn])->arch.mm_perdomain_pt) + i, 
diff -r 9da47130ff42 -r c640c0c7f821 xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h      Thu Nov 17 11:12:57 2005
+++ b/xen/include/asm-x86/config.h      Thu Nov 17 11:52:42 2005
@@ -291,6 +291,9 @@
 
 #define PDPT_VCPU_SHIFT       5
 #define PDPT_VCPU_VA_SHIFT    (PDPT_VCPU_SHIFT + PAGE_SHIFT)
+#define PDPT_L1_ENTRIES       (MAX_VIRT_CPUS << PDPT_VCPU_SHIFT)
+#define PDPT_L2_ENTRIES       \
+    ((PDPT_L1_ENTRIES + (1 << PAGETABLE_ORDER) - 1) >> PAGETABLE_ORDER)
 
 #if defined(__x86_64__)
 #define ELFSIZE 64

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] The perdomain mapping area in Xen space requires more than, Xen patchbot -unstable <=