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-ia64-devel

[Xen-ia64-devel] [PATCH] Automatic xenheap sizing

To: xen-ia64-devel <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-ia64-devel] [PATCH] Automatic xenheap sizing
From: Alex Williamson <alex.williamson@xxxxxx>
Date: Fri, 07 Mar 2008 11:26:30 -0700
Delivery-date: Fri, 07 Mar 2008 10:26:44 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: OSLO R&D
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
   Thanks to Yamahata-san's prior work, we can now size the xenheap with
a boot option.  However, a user isn't always going to know to do this.
For instance, when I configure an HP superdome system in NUMA mode, I
get much higher physical addresses, which makes the boot allocator
alloc_bitmap exceed the default xenheap size on it's own.  This leads to
a failure trying to allocate a ridiculously huge block of memory later
on.  This patch adds in a test to make sure we don't hit this case and
automatically increases xenheap_size to account for it.  Thanks,

        Alex

Signed-off-by: Alex Williamson <alex.williamson@xxxxxx>
---

diff -r 59b8768d0d0d xen/arch/ia64/xen/xensetup.c
--- a/xen/arch/ia64/xen/xensetup.c      Wed Mar 05 11:18:25 2008 +0000
+++ b/xen/arch/ia64/xen/xensetup.c      Fri Mar 07 11:19:02 2008 -0700
@@ -80,11 +80,11 @@ static void __init parse_xenheap_megabyt
 {
     unsigned long megabytes = simple_strtoll(s, NULL, 0);
 
-#define XENHEAP_MEGABYTES_MIN   16
+#define XENHEAP_MEGABYTES_MIN   16UL
     if (megabytes < XENHEAP_MEGABYTES_MIN)
         megabytes = XENHEAP_MEGABYTES_MIN;
 
-#define XENHEAP_MEGABYTES_MAX   4096    /* need more? If so,
+#define XENHEAP_MEGABYTES_MAX   4096UL  /* need more? If so,
                                            __pickle()/__unpickle() must be
                                            revised. */
     if (megabytes > XENHEAP_MEGABYTES_MAX)
@@ -258,6 +258,26 @@ md_overlap_with_boot_param(const efi_mem
 #define MD_SIZE(md) (md->num_pages << EFI_PAGE_SHIFT)
 #define MD_END(md) ((md)->phys_addr + MD_SIZE(md))
 
+static unsigned long __init
+efi_get_max_addr (void)
+{
+    void *efi_map_start, *efi_map_end, *p;
+    efi_memory_desc_t *md;
+    u64 efi_desc_size;
+    unsigned long max_addr = 0;
+
+    efi_map_start = __va(ia64_boot_param->efi_memmap);
+    efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
+    efi_desc_size = ia64_boot_param->efi_memdesc_size;
+
+    for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
+        md = p;
+        if (is_xenheap_usable_memory(md) && MD_END(md) > max_addr)
+            max_addr = MD_END(md);
+    }
+    return max_addr;
+}
+
 extern char __init_begin[], __init_end[];
 static void noinline init_done(void)
 {
@@ -398,6 +418,17 @@ void __init start_kernel(void)
     }
 
     printk("Xen command line: %s\n", saved_command_line);
+
+    /*
+     * Test if the boot allocator bitmap will overflow xenheap_size.  If
+     * so, continue to bump it up until we have at least a minimum space
+     * for the actual xenheap.
+     */
+    max_page = efi_get_max_addr() >> PAGE_SHIFT;
+    while ((max_page >> 3) > xenheap_size - (XENHEAP_MEGABYTES_MIN << 20))
+        xenheap_size <<= 1;
+
+    BUG_ON(xenheap_size > (XENHEAP_MEGABYTES_MAX << 20));
 
     xenheap_phys_end = xen_pstart + xenheap_size;
     printk("xen image pstart: 0x%lx, xenheap pend: 0x%lx\n",




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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-ia64-devel] [PATCH] Automatic xenheap sizing, Alex Williamson <=