Re: Early memory patch, revised

From: Eric W. Biederman
Date: Wed Feb 25 2004 - 13:38:36 EST


"H. Peter Anvin" <hpa@xxxxxxxxx> writes:

> Hi all,
>
> This is the latest version of the i386 early memory cleanup patch. It has the
> additional advantage that it removes some of the special casing for VISWS --
> this is still untested; if you have access to a VISWS *please* test this out.
>
> The main difference other than the VISWS code is that it always sets up the GDT.
>
> I agree with Eric this is a lot cleaner.

Thanks. :)

Two little tweaks I can think of.
1) Can we reserve space between __bss_stop and _end for the page
tables and the bitmap of memory?

This should make it obvious that the early boot code is touching
that memory.

2) Can we export _end in setup.S so a bootloader can verify the
kernel + bss will fit in memory?

Roughly the additions needed to vmlinux.lds.S look like:
+++ arch/i386/kernel/vmlinux.lds.S
@@ -105,6 +105,18 @@

__bss_start = .; /* BSS */
.bss : { *(.bss) }
+ . = ALIGN(4);
__bss_stop = .;
+
+ /* Reserve space for the initial page tables.
+ * A 1GB kernel needs 1MB of page tables.
+ * We must cover the first 1M ourselves and the initial memory bitmap.
+ * In the worst (1G kernel + 36G of ram) case this increases our
+ * page table size by 3K.
+ */
+ . += (((__bss_stop - _text + 4095) / 4096) + ((4*1024*1024) / 4096)) * 4 ;
+
+ /* Reserve space for the initial memory bitmap 2^36/4096/8 = 2MB */
+ . += 2*1024*1024;

_end = . ;

Eric
-
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/