Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xen/x86: Increase xen_e820_map to E820_X_MAX possible entries

On systems with sufficiently large e820 tables, and several IOAPICs, it
is possible for the XENMEM_machine_memory_map callback (and its
counterpart, XENMEM_memory_map) to attempt to return an e820 table with
more than 128 entries. This callback adds entries to the BIOS-provided
e820 table to account for IOAPIC registers, which, on sufficiently large
systems, can result in an e820 table that is too large to copy back into
xen_e820_map.

This change simply increases the size of xen_e820_map to E820_X_MAX to
ensure that there is enough room to store the entire e820 map returned
from this callback.

Signed-off-by: Alex Thorlton <athorlton@sgi.com>
Suggested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Juergen Gross <jgross@suse.com>

authored by

Alex Thorlton and committed by
Juergen Gross
738662c3 9d2f86c6

+3 -3
+3 -3
arch/x86/xen/setup.c
··· 41 41 unsigned long xen_released_pages; 42 42 43 43 /* E820 map used during setting up memory. */ 44 - static struct e820entry xen_e820_map[E820MAX] __initdata; 44 + static struct e820entry xen_e820_map[E820_X_MAX] __initdata; 45 45 static u32 xen_e820_map_entries __initdata; 46 46 47 47 /* ··· 750 750 max_pfn = min(max_pfn, xen_start_info->nr_pages); 751 751 mem_end = PFN_PHYS(max_pfn); 752 752 753 - memmap.nr_entries = E820MAX; 753 + memmap.nr_entries = ARRAY_SIZE(xen_e820_map); 754 754 set_xen_guest_handle(memmap.buffer, xen_e820_map); 755 755 756 756 op = xen_initial_domain() ? ··· 923 923 int i; 924 924 int rc; 925 925 926 - memmap.nr_entries = E820MAX; 926 + memmap.nr_entries = ARRAY_SIZE(xen_e820_map); 927 927 set_xen_guest_handle(memmap.buffer, xen_e820_map); 928 928 929 929 rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);