Re: Suspected regression in "x86: extend e820 ealy_res support 32bit"

From: Yinghai Lu
Date: Wed May 21 2008 - 18:41:17 EST


On Wed, May 21, 2008 at 3:01 PM, Jeremy Fitzhardinge <jeremy@xxxxxxxx> wrote:
> Yinghai Lu wrote:
>>
>> On Wed, May 21, 2008 at 11:19 AM, Jeremy Fitzhardinge <jeremy@xxxxxxxx>
>> wrote:
>>
>>>
>>> I'm seeing a crash in current x86.git tip/auto-latest when booting under
>>> Xen. The crash is rather early, but it's in __alloc_bootmem_core() in
>>> the
>>> final memset clear. Apparently the allocator is returning a bad page.
>>>
>>> This points to changes in the setup of the bootmem allocator, and the
>>> changes "x86: extend e820 ealy_res support 32bit" make to
>>> arch/x86/kernel/setup_32.c:setup_bootmem_allocator() looks like the most
>>> likely suspect. Unfortunately its a rather large patch which is not easy
>>> to
>>> revert, so I haven't actually confirmed this yet.
>>>
>>
>>
>> thanks. please check the attached patch
>>
>
> Thanks for the quick response. I definitely confirmed that "x86: extend
> e820 ealy_res support 32bit" is the source of the regression, and reverting
> the change makes the system bootable under Xen. (My previous reversion
> failed because I didn't actually have the x86.git changes applied :-/)
>
> This patch generates the warning:
>
> CC arch/x86/kernel/setup_32.o
> /home/jeremy/hg/xen/paravirt/linux/arch/x86/kernel/setup_32.c: In
> function 'setup_arch':
> /home/jeremy/hg/xen/paravirt/linux/arch/x86/kernel/setup_32.c:580:
> warning: 'bootmap_size' is used uninitialized in this function
>
> but I think it's just that the panic() message still uses it before its
> assigned.
>
> Hm, and it also fails to fix the problem. I'm still seeing the virtual
> machine crash in the same way.

noticed that bootmap_size is shifted already...

please use attached patch to see if bootmap is right...

YH
[PATCH] x86: bootmap size fix for 32 bit

Jeremy Fitzhardinge found
x86: extend e820 ealy_res support 32bit
cause regression...

in setup_bootmem_allocator

Signed-off-by: Yinghai Lu <yhlu.kernel@xxxxxxxxx>

Index: linux-2.6/arch/x86/kernel/setup_32.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup_32.c
+++ linux-2.6/arch/x86/kernel/setup_32.c
@@ -577,6 +577,8 @@ void __init setup_bootmem_allocator(void
if (bootmap == -1L)
panic("Cannot find bootmem map of size %ld\n", bootmap_size);
bootmap_size = init_bootmem(bootmap >> PAGE_SHIFT, max_low_pfn);
+ printk(KERN_INFO " bootmap [%016lx - %016lx] min_low_pfn: %016x\n",
+ bootmap, bootmap + bootmap_size - 1, min_low_pfn);
register_bootmem_low_pages(max_low_pfn);
early_res_to_bootmem(0, max_low_pfn<<PAGE_SHIFT);
reserve_bootmem(bootmap, bootmap_size, BOOTMEM_DEFAULT);