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: New boot option availmem= to limit u

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: New boot option availmem= to limit usable system RAM.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 21 Jul 2010 00:45:10 -0700
Delivery-date: Wed, 21 Jul 2010 00:45:21 -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 1279698215 -3600
# Node ID 3c00cb0d9bc468c2dee2051c4e03a88e11e4c219
# Parent  8963f83ba73b16cf09c9a1dec3d80c7b5ffab6df
x86: New boot option availmem= to limit usable system RAM.

Unlike mem=, this specifies the limit on usable RAM, rather than a
limit on maximum physical address of RAM.

Original patch by Sarina Canelake <sarina.canelake@xxxxxxxxxx>

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/e820.c |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff -r 8963f83ba73b -r 3c00cb0d9bc4 xen/arch/x86/e820.c
--- a/xen/arch/x86/e820.c       Tue Jul 20 17:56:07 2010 +0100
+++ b/xen/arch/x86/e820.c       Wed Jul 21 08:43:35 2010 +0100
@@ -10,9 +10,19 @@
 #include <asm/mtrr.h>
 #include <asm/msr.h>
 
-/* opt_mem: Limit of physical RAM. Any RAM beyond this point is ignored. */
+/*
+ * opt_mem: Limit maximum address of physical RAM.
+ *          Any RAM beyond this address limit is ignored.
+ */
 static unsigned long long __initdata opt_mem;
 size_param("mem", opt_mem);
+
+/*
+ * opt_availmem: Limit maximum usable amount of physical RAM.
+ *               Any RAM beyond this limited amount is ignored.
+ */
+static unsigned long long __initdata opt_availmem;
+size_param("availmem", opt_availmem);
 
 /* opt_nomtrr_check: Don't clip ram to highest cacheable MTRR. */
 static int __initdata e820_mtrr_clip = -1;
@@ -503,7 +513,8 @@ static void __init machine_specific_memo
 static void __init machine_specific_memory_setup(
     struct e820entry *raw, int *raw_nr)
 {
-    uint64_t top_of_ram;
+    uint64_t top_of_ram, size;
+    int i;
 
     char nr = (char)*raw_nr;
     sanitize_e820_map(raw, &nr);
@@ -512,6 +523,17 @@ static void __init machine_specific_memo
 
     if ( opt_mem )
         clip_to_limit(opt_mem, NULL);
+
+    if ( opt_availmem )
+    {
+        for ( i = size = 0; (i < e820.nr_map) && (size <= opt_availmem); i++ )
+            if ( e820.map[i].type == E820_RAM )
+                size += e820.map[i].size;
+        if ( size > opt_availmem )
+            clip_to_limit(
+                e820.map[i-1].addr + e820.map[i-1].size - (size-opt_availmem),
+                NULL);
+    }
 
 #ifdef __i386__
     clip_to_limit((1ULL << 30) * MACHPHYS_MBYTES,

_______________________________________________
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: New boot option availmem= to limit usable system RAM., Xen patchbot-unstable <=