Re: Linux 3.9-rc1

Yinghai Lu
2013-03-06T22:44:03Z

[-- Attachment #1: Type: text/plain, Size: 805 bytes --]

On Wed, Mar 6, 2013 at 2:27 PM, H. Peter Anvin <hpa@linux.intel.com> wrote:
> On 03/06/2013 02:04 PM, Henrik Rydberg wrote:
>>>
>>> Sigh. This is why "keep the page tables together" is fundamentally the
>>> wrong strategy.
>>>
>>> 8M means that we won't even be able to boot on machines with less than
>>> 16M or so of RAM... I'm not sure if anyone still cares, but that is a
>>> pretty aggressive heuristic.
>>
>> Maybe this should be a config option, given the ad-hoc nature of the
>> chosen value? Anyway, the patch works.
>>
>
> Can we make a sensible argument for what the value *needs* to be? 2M at
> least makes a modicum of sense. Either way, it's clear we still have
> plenty of cleaning up to do...

ok, let's stay with 2M.

Please check attached v1 with updated commit log.

Thanks

Yinghai

[-- Attachment #2: fix_real_end_v1.patch --]
[-- Type: application/octet-stream, Size: 1772 bytes --]

Subject: [PATCH] x86, mm: First mapped area need to be 2M for sure.

Henrik reported that his MacAir 3.1 would not boot with

| commit 8d57470d8f859635deffe3919d7d4867b488b85a
| 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.

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>

---
arch/x86/mm/init.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

Index: linux-2.6/arch/x86/mm/init.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/init.c
+++ linux-2.6/arch/x86/mm/init.c
@@ -410,9 +410,8 @@ void __init init_mem_mapping(void)
/* the ISA range is always mapped regardless of memory holes */
init_memory_mapping(0, ISA_END_ADDRESS);

- /* xen has big range in reserved near end of ram, skip it at first */
- addr = memblock_find_in_range(ISA_END_ADDRESS, end, PMD_SIZE,
- PAGE_SIZE);
+ /* xen has big range in reserved near end of ram, skip it at first.*/
+ addr = memblock_find_in_range(ISA_END_ADDRESS, end, PMD_SIZE, PMD_SIZE);
real_end = addr + PMD_SIZE;

/* step_size need to be small so pgt_buf from BRK could cover it */