# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1205168325 21600
# Node ID d234874339119e0513bbfb826d60ac6132030a78
# Parent 7619c93e60285922692f0d4719c956221ab53c5b
[IA64] Automatic xenheap sizing
Automatically bump up the size of xenheap to account for the range
used by the boot allocator. On systems like the HP superdome, when
cell local memory is enabled, the physical address space used for
memory gets much larger, causing the alloc_bitmap to slightly exceed
the default 64MB xenheap. This is easily detected and prevented.
Signed-off-by: Alex Williamson <alex.williamson@xxxxxx>
---
xen/arch/ia64/xen/xensetup.c | 35 +++++++++++++++++++++++++++++++++--
1 files changed, 33 insertions(+), 2 deletions(-)
diff -r 7619c93e6028 -r d23487433911 xen/arch/ia64/xen/xensetup.c
--- a/xen/arch/ia64/xen/xensetup.c Fri Mar 07 13:26:40 2008 -0700
+++ b/xen/arch/ia64/xen/xensetup.c Mon Mar 10 10:58:45 2008 -0600
@@ -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)
@@ -257,6 +257,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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|