]> git.baikalelectronics.ru Git - kernel.git/commit
x86, mm: Make sure to find a 2M free block for the first mapped area
authorYinghai Lu <yinghai@kernel.org>
Thu, 7 Mar 2013 04:18:21 +0000 (20:18 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Thu, 7 Mar 2013 04:18:32 +0000 (20:18 -0800)
commitfb6ded5437f139f1185a52ff2412b849b72918f4
tree52da45c05dff2ba6da79bcbf17ea464829ab8304
parent3c3f0567a462f14f08698acfa8b3b3202175c7bd
x86, mm: Make sure to find a 2M free block for the first mapped area

Henrik reported that his MacAir 3.1 would not boot with

| commit 97714e9098aed42a82e373f5264bbcdbacc4222d
| Date:   Fri Nov 16 19:38:58 2012 -0800
|
|    x86, mm: setup page table in top-down

It turns out that we do not calculate the real_end properly:
We try to get 2M size with 4K alignment, and later will round down
to 2M, so we will get less then 2M for first mapping, in extreme
case could be only 4K only. In Henrik's system it has (1M-32K) as
last usable rage is [mem 0x7f9db000-0x7fef8fff].

The problem is exposed when EFI booting have several holes and it
will force mapping to use PTE instead as we only map usable areas.

To fix it, just make it be 2M aligned, so we can be guaranteed to be
able to use large pages to map it.

Reported-by: Henrik Rydberg <rydberg@euromail.se>
Bisected-by: Henrik Rydberg <rydberg@euromail.se>
Tested-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/CAE9FiQX4nQ7_1kg5RL_vh56rmcSHXUi1ExrZX7CwED4NGMnHfg@mail.gmail.com
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
arch/x86/mm/init.c