diff options
author | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2010-12-02 18:30:06 -0500 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2010-12-02 18:30:06 -0500 |
commit | 2a4c92fa24e1853d0e21f9e6e45859b832240f94 (patch) | |
tree | 03550915de5b335b5c333a75709e8c8b46514703 /drivers/xen | |
parent | bc15fde77fc5d9ec2eec6066a5ab554ea1266a0a (diff) |
xen: prevent crashes with non-HIGHMEM 32-bit kernels with largeish memory
If this is a non-HIGHMEM 32-bit kernel, then the page structures only go
up to the limit of addressable memory, even if more memory is physically
present. Don't try to add that extra memory to the balloon.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/balloon.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 2b17ad5b4b32..43f9f02c7db0 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -412,8 +412,16 @@ static int __init balloon_init(void) | |||
412 | 412 | ||
413 | register_balloon(&balloon_sysdev); | 413 | register_balloon(&balloon_sysdev); |
414 | 414 | ||
415 | /* Initialise the balloon with excess memory space. */ | 415 | /* |
416 | extra_pfn_end = min(e820_end_of_ram_pfn(), | 416 | * Initialise the balloon with excess memory space. We need |
417 | * to make sure we don't add memory which doesn't exist or | ||
418 | * logically exist. The E820 map can be trimmed to be smaller | ||
419 | * than the amount of physical memory due to the mem= command | ||
420 | * line parameter. And if this is a 32-bit non-HIGHMEM kernel | ||
421 | * on a system with memory which requires highmem to access, | ||
422 | * don't try to use it. | ||
423 | */ | ||
424 | extra_pfn_end = min(min(max_pfn, e820_end_of_ram_pfn()), | ||
417 | (unsigned long)PFN_DOWN(xen_extra_mem_start + xen_extra_mem_size)); | 425 | (unsigned long)PFN_DOWN(xen_extra_mem_start + xen_extra_mem_size)); |
418 | for (pfn = PFN_UP(xen_extra_mem_start); | 426 | for (pfn = PFN_UP(xen_extra_mem_start); |
419 | pfn < extra_pfn_end; | 427 | pfn < extra_pfn_end; |