Re: [v3 PATCH] x86: let 'reservetop' functioning right

From: Ingo Molnar
Date: Fri Apr 30 2010 - 14:34:42 EST



* Liang Li <liang.li@xxxxxxxxxxxxx> wrote:

> When specify 'reservetop=0xbadc0de' kernel parameter, the kernel will
> stop booting due to a early_ioremap bug that relate to commit 8827247ff.
>
> The root cause of boot failure problem is the value of 'slot_virt[i]'
> was initialized in setup_arch->early_ioremap_init. But later in
> setup_arch, the function 'parse_early_param' will modify 'FIXADDR_TOP'
> when 'reservetop=0xbadc0de' being specified.
>
> The simplest fix might be use __fix_to_virt(idx0) to get updated value
> of 'FIXADDR_TOP' in '__early_ioremap' instead of reference old value
> from slot_virt[slot] directly.
>
> Changelog since v0:
>
> -v1: When reservetop being handled then FIXADDR_TOP get adjusted, Hence
> check prev_map then re-initialize slot_virt and PMD based on new
> FIXADDR_TOP.
>
> -v2: place fixup_early_ioremap hence call early_ioremap_init in
> reserve_top_address to re-initialize slot_virt and corresponding PMD
> when parse_reservertop
>
> -v3: move fixup_early_ioremap out of reserve_top_address to make sure
> other clients of reserve_top_address like xen/lguest won't broken
>
> Signed-off-by: Liang Li <liang.li@xxxxxxxxxxxxx>
> Cc: Wang Chen <wangchen@xxxxxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Acked-by: Yinghai Lu <yinghai@xxxxxxxxxx>
> Acked-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
> Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> ---
> Hi all,
>
> Just resend the patch according to Ingo's demand.
> Thanks.
>
> arch/x86/include/asm/io.h | 1 +
> arch/x86/mm/ioremap.c | 15 +++++++++++++++
> arch/x86/mm/pgtable_32.c | 1 +
> 3 files changed, 17 insertions(+), 0 deletions(-)

Applied, thanks. Note, i cleaned up the fixup_early_ioremap() code (and
changed the BUG_ON to WARN_ON - we dont want to crash the box), mind double
checking the end result? See the commit below.

Ingo

----------------->