Commit 04362c4c authored by Yanmin Zhang's avatar Yanmin Zhang Committed by Tony Luck

[IA64] Fix boot problems when using "mem=" boot parameter.

My tiger-4 machine has 16GB memory. Kernel 2.6.8 fails to boot on it
when command line parameter mem=8G, and it also fails when mem being
set to other value, such as 7G, 10G.

Basically, in function efi_memmap_walk, md->num_pages might be decreased
if mem_limit is set, and then at the next time when efi_memmap_walk is
called, trim_top might trim the md again because of IA64_GRANULE_SIZE
alignment, then another md which is beyond mem_limit at the beginning
will be chosen, and its physical page number is larger than max_pfn. Then,
a BUG check is triggered.
Signed-off-by: default avatarZhang Yanmin <yanmin.zhang@intel.com>
Signed-off-by: default avatarYao Jun      <junx.yao@intel.com>
Signed-off-by: default avatarTony Luck    <tony.luck@intel.com>
parent 65fd90f1
...@@ -357,8 +357,10 @@ efi_memmap_walk (efi_freemem_callback_t callback, void *arg) ...@@ -357,8 +357,10 @@ efi_memmap_walk (efi_freemem_callback_t callback, void *arg)
if (total_mem >= mem_limit) if (total_mem >= mem_limit)
continue; continue;
total_mem += (md->num_pages << EFI_PAGE_SHIFT); total_mem += (md->num_pages << EFI_PAGE_SHIFT);
if (total_mem > mem_limit) if (total_mem > mem_limit) {
md->num_pages -= ((total_mem - mem_limit) >> EFI_PAGE_SHIFT); md->num_pages -= ((total_mem - mem_limit) >> EFI_PAGE_SHIFT);
max_addr = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT);
}
if (md->num_pages == 0) if (md->num_pages == 0)
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment