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] [xen-unstable] x86: don't map more than the allocated sp

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: don't map more than the allocated space for frame_table
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 26 May 2009 05:50:20 -0700
Delivery-date: Tue, 26 May 2009 05:50:38 -0700
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1242830132 -3600
# Node ID cafab208441018ca2d7f4f0b015b647b2a9cb4fc
# Parent  1695a86b3d7c161a45dbc4b42446b07f87b281fc
x86: don't map more than the allocated space for frame_table

This is to avoid undue virtual address aliases in case the over-mapped
pages happen to get allocated to a domain, and then get their
cacheability attributes changed.

At the same time, use 1Gb mappings if possible and reasonable.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/mm.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff -r 1695a86b3d7c -r cafab2084410 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Wed May 20 15:30:36 2009 +0100
+++ b/xen/arch/x86/mm.c Wed May 20 15:35:32 2009 +0100
@@ -154,7 +154,7 @@ struct domain *dom_xen, *dom_io;
 struct domain *dom_xen, *dom_io;
 
 /* Frame table and its size in pages. */
-struct page_info *frame_table;
+struct page_info *__read_mostly frame_table;
 unsigned long max_page;
 unsigned long total_pages;
 
@@ -186,11 +186,18 @@ void __init init_frametable(void)
     frame_table = (struct page_info *)FRAMETABLE_VIRT_START;
 
     nr_pages  = PFN_UP(max_page * sizeof(*frame_table));
-    page_step = (1 << L2_PAGETABLE_SHIFT) >> PAGE_SHIFT;
+    page_step = 1 << (cpu_has_page1gb ? L3_PAGETABLE_SHIFT - PAGE_SHIFT
+                                      : L2_PAGETABLE_SHIFT - PAGE_SHIFT);
 
     for ( i = 0; i < nr_pages; i += page_step )
     {
-        mfn = alloc_boot_pages(min(nr_pages - i, page_step), page_step);
+        /*
+         * The hardcoded 4 below is arbitrary - just pick whatever you think
+         * is reasonable to waste as a trade-off for using a large page.
+         */
+        while (nr_pages + 4 - i < page_step)
+            page_step >>= PAGETABLE_ORDER;
+        mfn = alloc_boot_pages(page_step, page_step);
         if ( mfn == 0 )
             panic("Not enough memory for frame table\n");
         map_pages_to_xen(

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86: don't map more than the allocated space for frame_table, Xen patchbot-unstable <=