From: Keir Fraser Date: Tue, 22 Jul 2008 12:36:56 +0000 (+0100) Subject: x86/64: Account for allocation bitmap by making Xen heap appropriately larger. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14171^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=23b812f67fa7ffd933e7550a3b645e0d012e03c6;p=xen.git x86/64: Account for allocation bitmap by making Xen heap appropriately larger. Signed-off-by: Keir Fraser --- 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));