Port-i386 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

heap full in boot(8) with compressed modules



Hi,

With -current boot(8) on i386, loading a (large) compressed module, such
as a kernel or an installation miniroot.kmod, leads to an error heap
full.  In qemu:

NetBSD/x86 BIOS Boot, Revision 5.4 (from NetBSD 5.99.24)
Memory: 639/130048 k
load /miniroot.kmod
boot /netbsd-GENERIC.gz
8982376+493364+539784 [476288+461807]=0xa73910
WARNING: couldn't open ffs (/stand/i386/5.99.24/modules/ffs/ffs.kmod)
Loading /miniroot.kmod heap full (0x48f9c+32768)
exit
exit
[many more exit]

This is likely related to PRs #41215 and #41524, and to [1].  The
following patch seems to work, but it's a wild guess:


diff -u -r1.42 Makefile.boot
--- sys/arch/i386/stand/boot/Makefile.boot
+++ sys/arch/i386/stand/boot/Makefile.boot
@@ -81,7 +81,7 @@
 # The biosboot code is linked to 'virtual' address of zero and is
 # loaded at physical address 0x10000.
 # XXX The heap values should be determined from _end.
-SAMISCCPPFLAGS+= -DHEAP_START=0x30000 -DHEAP_LIMIT=0x50000
+SAMISCCPPFLAGS+= -DHEAP_START=0x28000 -DHEAP_LIMIT=0x50000
 SAMISCMAKEFLAGS+= SA_USE_CREAD=yes     # Read compressed kernels
 SAMISCMAKEFLAGS+= SA_INCLUDE_NET=no    # Netboot via TFTP, NFS


According to the CVS logs, the value of HEAP_START was bumped from
0x20000 to 0x30000 a year ago since the size of /boot was getting
dangerously close to the limit (HEAP_START - 0x10000).  But the
downside is that the heap size was reduced from 0x30000 to 0x20000, and
the latter is apparently not enough (for compressed modules).  Using
0x28000 for HEAP_START leaves enough space for /boot, and enough room
for the heap in my tests.

I don't know what are the right values here, and why the HEAP_LIMIT is
set to 0x50000.  Some help would be welcome :-)

Thanks,

Grégoire

p.s. In my tests, the problem does not occur if the modules are
     uncompressed.

[1] http://mail-index.netbsd.org/port-xen/2009/10/29/msg005516.html



Home | Main Index | Thread Index | Old Index