aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-07-22 13:36:56 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-07-22 13:36:56 +0100
commit23b812f67fa7ffd933e7550a3b645e0d012e03c6 (patch)
treed3a51106fa8d1ec6cab3e798d9f683798cd5cdac
parent7d621b2b12051ccea88b4927da273488ed1c6ddb (diff)
downloadxen-23b812f67fa7ffd933e7550a3b645e0d012e03c6.tar.gz
xen-23b812f67fa7ffd933e7550a3b645e0d012e03c6.tar.bz2
xen-23b812f67fa7ffd933e7550a3b645e0d012e03c6.zip
x86/64: Account for allocation bitmap by making Xen heap appropriately larger.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
-rw-r--r--xen/arch/x86/setup.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index ad86fa8919..cd0c892a86 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -521,14 +521,6 @@ void __init __start_xen(unsigned long mbi_p)
if ( ((unsigned long)cpu0_stack & (STACK_SIZE-1)) != 0 )
EARLY_FAIL("Misaligned CPU0 stack.\n");
- /*
- * Since there are some stubs getting built on the stacks which use
- * direct calls/jumps, the heap must be confined to the lower 2G so
- * that those branches can reach their targets.
- */
- if ( opt_xenheap_megabytes > 2048 )
- opt_xenheap_megabytes = 2048;
-
if ( e820_raw_nr != 0 )
{
memmap_type = "Xen-e820";
@@ -600,6 +592,23 @@ void __init __start_xen(unsigned long mbi_p)
/* Sanitise the raw E820 map to produce a final clean version. */
max_page = init_e820(memmap_type, e820_raw, &e820_raw_nr);
+#ifdef CONFIG_X86_64
+ /*
+ * On x86/64 we are able to account for the allocation bitmap
+ * (allocated in common/page_alloc.c:init_boot_allocator()) stealing
+ * from the Xen heap. Here we make the Xen heap appropriately larger.
+ */
+ opt_xenheap_megabytes += (max_page / 8) >> 20;
+#endif
+
+ /*
+ * Since there are some stubs getting built on the stacks which use
+ * direct calls/jumps, the heap must be confined to the lower 2G so
+ * that those branches can reach their targets.
+ */
+ if ( opt_xenheap_megabytes > 2048 )
+ opt_xenheap_megabytes = 2048;
+
/* Create a temporary copy of the E820 map. */
memcpy(&boot_e820, &e820, sizeof(e820));