[PATCH] x86: extend e820 ealy_res support 32bit - fix #2




remove extra -1 in reseve_early calling
panic if can not find space for new RAMDISK

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

Index: linux-2.6/arch/x86/kernel/setup_32.c
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index 361e5c9..eed7121 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -479,7 +479,7 @@ static void __init reserve_initrd(void)
initrd_start = 0;

if (ramdisk_size >= end_of_lowmem/2) {
- free_early(ramdisk_image, ramdisk_image + ramdisk_size - 1);
+ free_early(ramdisk_image, ramdisk_end);
printk(KERN_ERR "initrd too large to handle, "
"disabling initrd\n");
return;
@@ -501,9 +501,13 @@ static void __init reserve_initrd(void)
end_of_lowmem, ramdisk_size,
PAGE_SIZE);

+ if (ramdisk_here == -1ULL)
+ panic("Cannot find place for new RAMDISK of size %lld\n",
+ ramdisk_size);
+
/* Note: this includes all the lowmem currently occupied by
the initrd, we rely on that fact to keep the data intact. */
- reserve_early(ramdisk_here, ramdisk_here + ramdisk_size - 1,
+ reserve_early(ramdisk_here, ramdisk_here + ramdisk_size,
"NEW RAMDISK");
initrd_start = ramdisk_here + PAGE_OFFSET;
initrd_end = initrd_start + ramdisk_size;
@@ -579,15 +583,15 @@ void __init setup_bootmem_allocator(void)
PAGE_SIZE);
if (bootmap == -1L)
panic("Cannot find bootmem map of size %ld\n", bootmap_size);
- reserve_early(bootmap, bootmap + bootmap_size - 1, "BOOTMAP");
+ reserve_early(bootmap, bootmap + bootmap_size, "BOOTMAP");
#ifdef CONFIG_BLK_DEV_INITRD
reserve_initrd();
#endif
bootmap_size = init_bootmem(bootmap >> PAGE_SHIFT, max_low_pfn);
printk(KERN_INFO " low ram: %08lx - %08lx\n",
min_low_pfn<<PAGE_SHIFT, max_low_pfn<<PAGE_SHIFT);
- printk(KERN_INFO " bootmap [%08lx - %08lx]\n",
- bootmap, bootmap + bootmap_size - 1);
+ printk(KERN_INFO " bootmap %08lx - %08lx\n",
+ bootmap, bootmap + bootmap_size);
register_bootmem_low_pages(max_low_pfn);
early_res_to_bootmem(0, max_low_pfn<<PAGE_SHIFT);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: Disc driver is module, software suspend fails
    ... >> But the patch is very dangerous. ... >> systems resumed after unsafe initrd is ran. ... I don't see why calling it repeatedly would be that bad. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: BOOT_CS
    ... the CRC32 of the decompressed RAM disk - and stop the boot process ... another kernel version / initrd to load. ... You cannot place the decompressed initrd at a maximum address before ... address minus ramdisk size if I remember ...
    (Linux-Kernel)
  • [PATCH] i386: handle an initrd in highmem (version 2)
    ... The boot protocol has until now required that the initrd be located in ... have the kernel relocate the initrd down below the ... lowmem boundary inside the kernel itself. ...
    (Linux-Kernel)
  • Re: Source code for Install init
    ... Perhaps even a bad boot parameter? ... > Oh, looks like you are trying make a bootable tape, bare metal restore ... > that the initrd is loaded from tape*. ... ramdisk for a custom network kickstart. ...
    (RedHat)
  • [PATCH] Suspend2 Merge: init hooks
    ... [Only sent this to Andrew the first time, ... This patch adds code to files in the init directory to fire suspend at ... can be loaded from an initrd, so we don't use straight initcalls. ...
    (Linux-Kernel)