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] Fix PAE shadow on a machine with RAM above 4G on x86_64

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Fix PAE shadow on a machine with RAM above 4G on x86_64 xen.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 01 Nov 2005 17:36:05 +0000
Delivery-date: Tue, 01 Nov 2005 17:33:41 +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 8ded2066e16c360265f155d0eaa91a2497b475d9
# Parent  ea6d9f29dff5d429c0a7cb6c381628e6f2bb38e1
Fix PAE shadow on a machine with RAM above 4G on x86_64 xen.
Currently, on a machine with RAM above 4G, we can not run 32bit VMX
guest on x86_64 xen, the root cause is that the PAE page table PDPT must
below 4G, this patch fixes this issue.

Signed-off-by: Xin Li <xin.b.li@xxxxxxxxx>
Signed-off-by: Jun Nakajima <jun.nakajima@xxxxxxxxx>

diff -r ea6d9f29dff5 -r 8ded2066e16c xen/arch/x86/shadow.c
--- a/xen/arch/x86/shadow.c     Mon Oct 31 16:07:14 2005
+++ b/xen/arch/x86/shadow.c     Mon Oct 31 16:08:54 2005
@@ -228,18 +228,20 @@
                  */
                 page = alloc_domheap_pages(NULL, SL1_ORDER, 0);
                 if (!page)
-                    domain_crash_synchronous();
+                    goto no_shadow_page;
 
                 void *l1_0 = map_domain_page(page_to_pfn(page));
-                memset(l1_0,0,PAGE_SIZE);
+                memset(l1_0, 0, PAGE_SIZE);
                 unmap_domain_page(l1_0);
+
                 void *l1_1 = map_domain_page(page_to_pfn(page+1));
-                memset(l1_1,0,PAGE_SIZE);
+                memset(l1_1, 0, PAGE_SIZE);
                 unmap_domain_page(l1_1);
 #else
                 page = alloc_domheap_page(NULL);
                 if (!page)
-                    domain_crash_synchronous();
+                    goto no_shadow_page;
+
                 void *l1 = map_domain_page(page_to_pfn(page));
                 memset(l1, 0, PAGE_SIZE);
                 unmap_domain_page(l1);
@@ -248,6 +250,9 @@
             else
             {
                 page = alloc_domheap_page(NULL);
+                if (!page)
+                    goto no_shadow_page;
+
                 void *l1 = map_domain_page(page_to_pfn(page));
                 memset(l1, 0, PAGE_SIZE);
                 unmap_domain_page(l1);
@@ -255,22 +260,26 @@
         }
     }
     else {
+#if CONFIG_PAGING_LEVELS == 2
         page = alloc_domheap_page(NULL);
+#elif CONFIG_PAGING_LEVELS == 3
+        if ( psh_type == PGT_l3_shadow )
+            page = alloc_domheap_pages(NULL, 0, ALLOC_DOM_DMA);
+        else
+            page = alloc_domheap_page(NULL);
+#elif CONFIG_PAGING_LEVELS == 4
+        if ( (psh_type == PGT_l4_shadow) &&
+             (d->arch.ops->guest_paging_levels != PAGING_L4) )
+            page = alloc_domheap_pages(NULL, 0, ALLOC_DOM_DMA);
+        else
+            page = alloc_domheap_page(NULL);
+#endif
+        if (!page)
+            goto no_shadow_page;
+
         void *lp = map_domain_page(page_to_pfn(page));
         memset(lp, 0, PAGE_SIZE);
         unmap_domain_page(lp);
-
-    }
-    if ( unlikely(page == NULL) )
-    {
-        printk("Couldn't alloc shadow page! dom%d count=%d\n",
-               d->domain_id, d->arch.shadow_page_count);
-        printk("Shadow table counts: l1=%d l2=%d hl2=%d snapshot=%d\n",
-               perfc_value(shadow_l1_pages), 
-               perfc_value(shadow_l2_pages),
-               perfc_value(hl2_table_pages),
-               perfc_value(snapshot_pages));
-        BUG(); /* XXX FIXME: try a shadow flush to free up some memory. */
     }
 
     smfn = page_to_pfn(page);
@@ -359,7 +368,7 @@
 
     return smfn;
 
-  fail:
+fail:
     FSH_LOG("promotion of pfn=%lx mfn=%lx failed!  external gnttab refs?",
             gpfn, gmfn);
     if (psh_type == PGT_l1_shadow)
@@ -377,6 +386,20 @@
     }
     else
         free_domheap_page(page);
+
+    return 0;
+
+no_shadow_page:
+    ASSERT(page == NULL);
+    printk("Couldn't alloc shadow page! dom%d count=%d\n",
+           d->domain_id, d->arch.shadow_page_count);
+    printk("Shadow table counts: l1=%d l2=%d hl2=%d snapshot=%d\n",
+           perfc_value(shadow_l1_pages),
+           perfc_value(shadow_l2_pages),
+           perfc_value(hl2_table_pages),
+           perfc_value(snapshot_pages));
+    BUG(); /* XXX FIXME: try a shadow flush to free up some memory. */
+
     return 0;
 }
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Fix PAE shadow on a machine with RAM above 4G on x86_64 xen., Xen patchbot -unstable <=