diff options
author | Juergen Gross <jgross@suse.com> | 2015-07-17 06:51:25 +0200 |
---|---|---|
committer | David Vrabel <david.vrabel@citrix.com> | 2015-08-20 12:24:18 +0100 |
commit | 8f5b0c63987207fd5c3c1f89c9eb6cb95b30386e (patch) | |
tree | 1fafc4612d09a433c6e7e0523fb5a110f15aebc6 /arch/x86/xen/setup.c | |
parent | d51e8b3e85972dee10be7943b0b0106742b1e847 (diff) | |
download | blackbird-op-linux-8f5b0c63987207fd5c3c1f89c9eb6cb95b30386e.tar.gz blackbird-op-linux-8f5b0c63987207fd5c3c1f89c9eb6cb95b30386e.zip |
xen: eliminate scalability issues from initial mapping setup
Direct Xen to place the initial P->M table outside of the initial
mapping, as otherwise the 1G (implementation) / 2G (theoretical)
restriction on the size of the initial mapping limits the amount
of memory a domain can be handed initially.
As the initial P->M table is copied rather early during boot to
domain private memory and it's initial virtual mapping is dropped,
the easiest way to avoid virtual address conflicts with other
addresses in the kernel is to use a user address area for the
virtual address of the initial P->M table. This allows us to just
throw away the page tables of the initial mapping after the copy
without having to care about address invalidation.
It should be noted that this patch won't enable a pv-domain to USE
more than 512 GB of RAM. It just enables it to be started with a
P->M table covering more memory. This is especially important for
being able to boot a Dom0 on a system with more than 512 GB memory.
Signed-off-by: Juergen Gross <jgross@suse.com>
Based-on-patch-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Konrad Rzeszutek Wilk <Konrad.wilk@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Diffstat (limited to 'arch/x86/xen/setup.c')
-rw-r--r-- | arch/x86/xen/setup.c | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 55f388ef481a..adad417ca1ba 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -560,6 +560,41 @@ static void __init xen_ignore_unusable(struct e820entry *list, size_t map_size) } } +/* + * Reserve Xen mfn_list. + * See comment above "struct start_info" in <xen/interface/xen.h> + * We tried to make the the memblock_reserve more selective so + * that it would be clear what region is reserved. Sadly we ran + * in the problem wherein on a 64-bit hypervisor with a 32-bit + * initial domain, the pt_base has the cr3 value which is not + * neccessarily where the pagetable starts! As Jan put it: " + * Actually, the adjustment turns out to be correct: The page + * tables for a 32-on-64 dom0 get allocated in the order "first L1", + * "first L2", "first L3", so the offset to the page table base is + * indeed 2. When reading xen/include/public/xen.h's comment + * very strictly, this is not a violation (since there nothing is said + * that the first thing in the page table space is pointed to by + * pt_base; I admit that this seems to be implied though, namely + * do I think that it is implied that the page table space is the + * range [pt_base, pt_base + nt_pt_frames), whereas that + * range here indeed is [pt_base - 2, pt_base - 2 + nt_pt_frames), + * which - without a priori knowledge - the kernel would have + * difficulty to figure out)." - so lets just fall back to the + * easy way and reserve the whole region. + */ +static void __init xen_reserve_xen_mfnlist(void) +{ + if (xen_start_info->mfn_list >= __START_KERNEL_map) { + memblock_reserve(__pa(xen_start_info->mfn_list), + xen_start_info->pt_base - + xen_start_info->mfn_list); + return; + } + + memblock_reserve(PFN_PHYS(xen_start_info->first_p2m_pfn), + PFN_PHYS(xen_start_info->nr_p2m_frames)); +} + /** * machine_specific_memory_setup - Hook for machine specific memory setup. **/ @@ -684,35 +719,10 @@ char * __init xen_memory_setup(void) e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, E820_RESERVED); - /* - * Reserve Xen bits: - * - mfn_list - * - xen_start_info - * See comment above "struct start_info" in <xen/interface/xen.h> - * We tried to make the the memblock_reserve more selective so - * that it would be clear what region is reserved. Sadly we ran - * in the problem wherein on a 64-bit hypervisor with a 32-bit - * initial domain, the pt_base has the cr3 value which is not - * neccessarily where the pagetable starts! As Jan put it: " - * Actually, the adjustment turns out to be correct: The page - * tables for a 32-on-64 dom0 get allocated in the order "first L1", - * "first L2", "first L3", so the offset to the page table base is - * indeed 2. When reading xen/include/public/xen.h's comment - * very strictly, this is not a violation (since there nothing is said - * that the first thing in the page table space is pointed to by - * pt_base; I admit that this seems to be implied though, namely - * do I think that it is implied that the page table space is the - * range [pt_base, pt_base + nt_pt_frames), whereas that - * range here indeed is [pt_base - 2, pt_base - 2 + nt_pt_frames), - * which - without a priori knowledge - the kernel would have - * difficulty to figure out)." - so lets just fall back to the - * easy way and reserve the whole region. - */ - memblock_reserve(__pa(xen_start_info->mfn_list), - xen_start_info->pt_base - xen_start_info->mfn_list); - sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); + xen_reserve_xen_mfnlist(); + return "Xen"; } @@ -739,8 +749,7 @@ char * __init xen_auto_xlated_memory_setup(void) for (i = 0; i < memmap.nr_entries; i++) e820_add_region(map[i].addr, map[i].size, map[i].type); - memblock_reserve(__pa(xen_start_info->mfn_list), - xen_start_info->pt_base - xen_start_info->mfn_list); + xen_reserve_xen_mfnlist(); return "Xen"; } |