[okl4-developer] How to deal with out of memory errors ? Test case using two oklinux cells.

Geoffrey Lee glee at ok-labs.com
Fri Dec 5 13:17:42 EST 2008


On Fri, Dec 05, 2008 at 12:04:18AM +0100, Hugues Balp wrote:
>
>                            Dear all,
>
>    in order to try multiple oklinux cells on one system
> I have cloned the cell "linux" into another one named "linux2"
> so as to enable two different configurations and compilations
> of OK linux, one per cell...
>
>    Then I have tried to build it from the sources of OKL4_3.0 with
> the following command:
>
> ./tools/build.py machine=versatile project=examples pyfreeze=false  
> EXAMPLE=oklinux,oklinux2 LINUX_APPS=hello kdb_serial=True  
> TOOLCHAIN=gnu_arm_eabi_toolchain pistachio.TOOLCHAIN=gnu_arm_toolchain  
> --debug=pdb
>
>    The compilation is ok but elfweaver crashes because of an *out of  
> memory* error
> detected by the memory allocator when trying to allocate the memory for  
> the second
> ok_linux cell....
>

Hugues  - 

Maybe you have run out of physical memory.  The amount of memory
available to OK Linux is configured statically at build time via 
the heap = argument in the OK Linux Sconscript.  If you run out 
of physical memory to back the heap then elfweaver will refuse 
to output the image.  

The amount of physical memory is specified in the machine
description file in platform/<platform>/tools/machines.py.

	-gl


>    You can find here attached the elfweaver merge specification file  
> named two_oklinux_weaver_ko.xml
> so as a log file ( named "two_oklinux_merge_ko.log.tgz" ) tracing the  
> scanned addresses
> just before the crash obtained with some additional prints in method  
> Allocator::__simple_alloc().
>
>    The problem is to find the reason of such a failure even if I cannot  
> use the memory usage tool
> simply because the image.elf file has not been created successfully...
>
>    I have seen in the elfweaver documentation the option "--ignore=" but 
> don't know how to use it from
> within the scripts build.py or elfweaver.py ... In case I add it to the  
> system arguments used in file build.py
> like this:   sys.argv.append("--ignore=ok_linux2",
> then I get the following usage message and scons error:
>    usage: scons [OPTION] [TARGET] ...
>    SCons error: --ignore-errors option does not take a value.
>
>    In order to get some more informations on the required memory usage  
> for such test case on the versatile
> platform I have build the cross-cell-demo example where only one oklinux  
> cell is used with an  additionnal decrypt cell...
> In that case the elf image is well created and I can look at the memory  
> usage thanks to memtests...
> I join also to this post the corresponding weaver file and memory usage  
> reports, named resp. "one_oklinux_weaver.xml" and  
> "one_oklinux_memory_usage.txt".
>
>    When looking in this last file at the physical memory value we have  
> 57344kB with 19358kB remaining...
> Normaly the resources required by the two OK linux cells should be the  
> same because I have just clone the linux cell
> without reconfiguring it by removing some devices etc...
>
>    My first reaction would be to try to increase "virtualy" the size of  
> the physical memory of the versatile platform
> by editing the appropriate descriptor in order to "force" elfweaver to  
> merge the system without any error and
> to be able to use the memory usage tool on the generated image.elf file....
>    The problem here is that I don't know where is located the default  
> physical memory value for the versatile platform
> and if I can really increase this value and how... (just for a virtual  
> test)...
>     When looking in the sources for the value 57344 I found it in file  
> okl4_3.0/linux/kernel-2.6.24-v2/fs/cifs/README
> as follows:
>  wsize     default write size (default 57344) maximum wsize currently  
> allowed by CIFS is 57344 (fourteen 4096 byte pages)
> So I suppose I cannot increase the physical value easily.
>
>    The solution to solve this out of memory error is probably to remove  
> all things that is not necessary for running the
> two ok linux cells... The problem is that I am not sure of what to  
> remove and how to do that correctly.
>
>    To sum up, I wonder simply how to deal with out of memory errors ?
>
>    Other said, what is the best suited process to get rid of such  
> problems ?
>
>    Thanks in advance,
>
>                Hugues Balp.
>
>
>            
>
>
>
>
>
>

> <?xml version="1.0" ?>
> <!DOCTYPE image
>   SYSTEM 'weaver-2.0.dtd'>
> <image>
> 	<machine>
> 		<cpu name="arm926ejs"/>
> 		<word_size size="0x20"/>
> 		<virtual_memory name="virtual">
> 			<region base="0x80000000" size="0x50000000"/>
> 		</virtual_memory>
> 		<physical_memory name="rom">
> 			<region base="0x7900000" rights="all" size="0x700000"/>
> 		</physical_memory>
> 		<physical_memory name="physical">
> 			<region base="0x4100000" rights="all" size="0x3800000"/>
> 		</physical_memory>
> 		<phys_device name="timer_dev">
> 			<physical_memory name="timer_mem0">
> 				<region base="0x101e3000" cache_policy="uncached" rights="all" size="0x1000"/>
> 			</physical_memory>
> 			<interrupt name="int_timer0" number="5"/>
> 		</phys_device>
> 		<phys_device name="serial_dev">
> 			<physical_memory name="serial_mem0">
> 				<region base="0x101f1000" cache_policy="uncached" rights="all" size="0x1000"/>
> 			</physical_memory>
> 			<interrupt name="int_serial0" number="12"/>
> 		</phys_device>
> 		<phys_device name="eth_dev">
> 			<physical_memory name="eth_mem0">
> 				<region base="0x10010000" cache_policy="uncached" rights="all" size="0x10000"/>
> 			</physical_memory>
> 			<interrupt name="int_eth0" number="25"/>
> 		</phys_device>
> 		<phys_device name="versatilesys_dev">
> 			<physical_memory name="versatilesys_mem0">
> 				<region base="0x10000000" cache_policy="uncached" rights="all" size="0x1000"/>
> 			</physical_memory>
> 		</phys_device>
> 		<phys_device name="kmi0_dev">
> 			<physical_memory name="kmi0_mem0">
> 				<region base="0x10006000" cache_policy="uncached" rights="all" size="0x1000"/>
> 			</physical_memory>
> 			<interrupt name="int_kmi00" number="35"/>
> 		</phys_device>
> 		<phys_device name="kmi1_dev">
> 			<physical_memory name="kmi1_mem0">
> 				<region base="0x10007000" cache_policy="uncached" rights="all" size="0x1000"/>
> 			</physical_memory>
> 			<interrupt name="int_kmi10" number="36"/>
> 		</phys_device>
> 		<phys_device name="clcd_dev">
> 			<physical_memory name="clcd_mem0">
> 				<region base="0x10120000" cache_policy="uncached" rights="all" size="0x1000"/>
> 			</physical_memory>
> 			<interrupt name="int_clcd0" number="16"/>
> 		</phys_device>
> 		<phys_device name="test_dev">
> 			<interrupt name="int_test0" number="6"/>
> 			<interrupt name="int_test1" number="7"/>
> 		</phys_device>
> 		<page_size size="0x1000"/>
> 		<page_size size="0x10000"/>
> 		<page_size size="0x100000"/>
> 	</machine>
> 	<physical_pool direct="true" name="rom">
> 		<memory src="rom"/>
> 	</physical_pool>
> 	<virtual_pool name="virtual">
> 		<memory src="virtual"/>
> 	</virtual_pool>
> 	<physical_pool direct="true" name="physical">
> 		<memory src="physical"/>
> 	</physical_pool>
> 	<kernel file="/home/hugues/tools/okl4/okl4_3.0/build/pistachio/bin/l4kernel" physpool="physical" virtpool="virtual"/>
> 	<linux clists="256" file="/home/hugues/tools/okl4/okl4_3.0/build/oklinux/wombat/vmlinux" kernel_heap="0x400000" mutexes="256" name="oklinux" spaces="128">
> 		<use_device name="serial_dev"/>
> 		<use_device name="timer_dev"/>
> 		<use_device name="eth_dev"/>
> 		<use_device name="versatilesys_dev"/>
> 		<use_device name="clcd_dev"/>
> 		<use_device name="kmi0_dev"/>
> 		<use_device name="kmi1_dev"/>
> 		<environment>
> 			<entry cap="heap/physical" key="heap_physical"/>
> 			<entry cap="/oklinux2/main" key="OK_LINUX_CELL_CAP"/>
> 		</environment>
> 		<memsection align="0x200000" attach="rwx" cache_policy="strong" mem_type="virtual" name="dma_heap_segment" size="0x200000"/>
> 		<memsection attach="rwx" mem_type="virtual" name="vmalloc" size="0x200000"/>
> 		<stack size="0x2000"/>
> 		<heap attach="rwx" size="0x1400000"/>
> 		<commandline>
> 			<arg value="vmlinux igms_name=ramdisk root=/dev/igms0 console=ttyAMA0,115200"/>
> 		</commandline>
> 		<memsection align="0x100000" file="/home/hugues/tools/okl4/okl4_3.0/build/linux/ext2ramdisk" name="rootfs"/>
> 	</linux>
> 	<linux clists="256" file="/home/hugues/tools/okl4/okl4_3.0/build/oklinux2/wombat/vmlinux" kernel_heap="0x400000" mutexes="256" name="oklinux2" spaces="128">
> 		<use_device name="serial_dev"/>
> 		<use_device name="timer_dev"/>
> 		<use_device name="versatilesys_dev"/>
> 		<environment>
> 			<entry cap="heap/physical" key="heap_physical"/>
> 			<entry cap="/oklinux/main" key="ROOT_CELL_CAP"/>
> 			<entry key="OK_LINUX_CELL_CAP" value="1"/>
> 		</environment>
> 		<memsection align="0x200000" attach="rwx" cache_policy="strong" mem_type="virtual" name="dma_heap_segment" size="0x200000"/>
> 		<memsection attach="rwx" mem_type="virtual" name="vmalloc" size="0x200000"/>
> 		<stack size="0x2000"/>
> 		<heap attach="rwx" size="0x1400000"/>
> 		<commandline>
> 			<arg value="vmlinux igms_name=ramdisk root=/dev/igms0 console=ttyS0,115200"/>
> 		</commandline>
> 		<memsection align="0x100000" file="/home/hugues/tools/okl4/okl4_3.0/build/linux2/ext2ramdisk" name="rootfs"/>
> 	</linux>
> </image>


> <?xml version="1.0" ?>
> <!DOCTYPE image
>   SYSTEM 'weaver-2.0.dtd'>
> <image>
> 	<machine>
> 		<cpu name="arm926ejs"/>
> 		<word_size size="0x20"/>
> 		<virtual_memory name="virtual">
> 			<region base="0x80000000" size="0x50000000"/>
> 		</virtual_memory>
> 		<physical_memory name="rom">
> 			<region base="0x7900000" rights="all" size="0x700000"/>
> 		</physical_memory>
> 		<physical_memory name="physical">
> 			<region base="0x4100000" rights="all" size="0x3800000"/>
> 		</physical_memory>
> 		<phys_device name="timer_dev">
> 			<physical_memory name="timer_mem0">
> 				<region base="0x101e3000" cache_policy="uncached" rights="all" size="0x1000"/>
> 			</physical_memory>
> 			<interrupt name="int_timer0" number="5"/>
> 		</phys_device>
> 		<phys_device name="serial_dev">
> 			<physical_memory name="serial_mem0">
> 				<region base="0x101f1000" cache_policy="uncached" rights="all" size="0x1000"/>
> 			</physical_memory>
> 			<interrupt name="int_serial0" number="12"/>
> 		</phys_device>
> 		<phys_device name="eth_dev">
> 			<physical_memory name="eth_mem0">
> 				<region base="0x10010000" cache_policy="uncached" rights="all" size="0x10000"/>
> 			</physical_memory>
> 			<interrupt name="int_eth0" number="25"/>
> 		</phys_device>
> 		<phys_device name="versatilesys_dev">
> 			<physical_memory name="versatilesys_mem0">
> 				<region base="0x10000000" cache_policy="uncached" rights="all" size="0x1000"/>
> 			</physical_memory>
> 		</phys_device>
> 		<phys_device name="kmi0_dev">
> 			<physical_memory name="kmi0_mem0">
> 				<region base="0x10006000" cache_policy="uncached" rights="all" size="0x1000"/>
> 			</physical_memory>
> 			<interrupt name="int_kmi00" number="35"/>
> 		</phys_device>
> 		<phys_device name="kmi1_dev">
> 			<physical_memory name="kmi1_mem0">
> 				<region base="0x10007000" cache_policy="uncached" rights="all" size="0x1000"/>
> 			</physical_memory>
> 			<interrupt name="int_kmi10" number="36"/>
> 		</phys_device>
> 		<phys_device name="clcd_dev">
> 			<physical_memory name="clcd_mem0">
> 				<region base="0x10120000" cache_policy="uncached" rights="all" size="0x1000"/>
> 			</physical_memory>
> 			<interrupt name="int_clcd0" number="16"/>
> 		</phys_device>
> 		<phys_device name="test_dev">
> 			<interrupt name="int_test0" number="6"/>
> 			<interrupt name="int_test1" number="7"/>
> 		</phys_device>
> 		<page_size size="0x1000"/>
> 		<page_size size="0x10000"/>
> 		<page_size size="0x100000"/>
> 	</machine>
> 	<physical_pool direct="true" name="rom">
> 		<memory src="rom"/>
> 	</physical_pool>
> 	<virtual_pool name="virtual">
> 		<memory src="virtual"/>
> 	</virtual_pool>
> 	<physical_pool direct="true" name="physical">
> 		<memory src="physical"/>
> 	</physical_pool>
> 	<kernel file="/home/hugues/tools/okl4/okl4_3.0/build/pistachio/bin/l4kernel" physpool="physical" virtpool="virtual"/>
> 	<linux clists="256" file="/home/hugues/tools/okl4/okl4_3.0/build/oklinux/wombat/vmlinux" kernel_heap="0x400000" mutexes="256" name="oklinux" spaces="128">
> 		<use_device name="serial_dev"/>
> 		<use_device name="timer_dev"/>
> 		<use_device name="eth_dev"/>
> 		<use_device name="versatilesys_dev"/>
> 		<use_device name="clcd_dev"/>
> 		<use_device name="kmi0_dev"/>
> 		<use_device name="kmi1_dev"/>
> 		<environment>
> 			<entry cap="heap/physical" key="heap_physical"/>
> 			<entry cap="/decrypt/shmem" key="SHMEM_CAP"/>
> 			<entry cap="/decrypt/main" key="DECRYPT_CELL_CAP"/>
> 		</environment>
> 		<memsection align="0x200000" attach="rwx" cache_policy="strong" mem_type="virtual" name="dma_heap_segment" size="0x200000"/>
> 		<memsection attach="rwx" mem_type="virtual" name="vmalloc" size="0x200000"/>
> 		<stack size="0x2000"/>
> 		<heap attach="rwx" size="0x1400000"/>
> 		<commandline>
> 			<arg value="vmlinux igms_name=ramdisk root=/dev/igms0 console=ttyAMA0,115200"/>
> 		</commandline>
> 		<memsection align="0x100000" file="/home/hugues/tools/okl4/okl4_3.0/build/linux/ext2ramdisk" name="rootfs"/>
> 	</linux>
> 	<okl4 clists="256" file="/home/hugues/tools/okl4/okl4_3.0/build/decrypt/bin/decrypt" kernel_heap="0x400000" mutexes="256" name="decrypt" spaces="128">
> 		<memsection attach="rw" name="shmem" size="0x1000"/>
> 		<heap size="0x100000"/>
> 		<commandline>
> 			<arg value="name"/>
> 		</commandline>
> 		<environment>
> 			<entry cap="/oklinux/main" key="ROOT_CELL_CAP"/>
> 			<entry key="CAESAR_CIPHER_SHIFT" value="1"/>
> 		</environment>
> 	</okl4>
> </image>

> 
> Memory in Use at end of initialization
> =======================================
> 
> Memory claimed by ELF image:
>   10 Segments giving   8167KB
> 
> SAS1:
>   14 additional sections giving  21627KB
> 
> Cell 1:
>   Heap:	  4096KB
> 
> Cell 2:
>   Heap:	  4096KB
> 
> Total Memory claimed for use:    37986KB
> 
> Physical memory remaining: 19358KB of 57344KB
> 
> Statistics for program kernel:
> 
> 	Sections (with debug and empty sections dropped):
> 
> 	kernel.text                             85028 Bytes
> 	kernel.rodata                           33075 Bytes
> 	kernel.init                             6824 Bytes
> 	kernel.roinit                           4 Bytes
> 	kernel.elfweaver_info                   104 Bytes
> 	kernel.data                             5600 Bytes
> 	kernel.got                              4 Bytes
> 	kernel.got.plt                          12 Bytes
> 	kernel.bss                              11560 Bytes
> 	kernel.kspace                           16384 Bytes
> 	kernel.traps                            4096 Bytes
> 	kernel.utcb_page                        4096 Bytes
> 	initscript                              4096 Bytes
> 
> 	Total static size by sections (unrounded) is 166.88 KB
> 
> 	Size by rounded segments (3 total) is 188.00 KB (47 pages)
> 
> Statistics for program decrypt:
> 
> 	Sections (with debug and empty sections dropped):
> 
> 	decrypt.text                            22800 Bytes
> 	decrypt.cell_environment                2610 Bytes
> 
> 	Total static size by sections (unrounded) is 24.81 KB
> 
> 	Size by rounded segments (2 total) is 32.00 KB (8 pages)
> 
> Statistics for program vmlinux:
> 
> 	Sections (with debug and empty sections dropped):
> 
> 	vmlinux.text                            1724416 Bytes
> 	vmlinux.data                            102400 Bytes
> 	                                        5734400 Bytes
> 	                                        3459 Bytes
> 
> 	Total static size by sections (unrounded) is 7387.38 KB
> 
> 	Size by rounded segments (4 total) is 7952.00 KB (1988 pages)
> 
> 
> 
> ID usage
> =========
> 
> Type spaceid           256 available,  256 allocated to spaces,    2 used
> Type clistid           512 available,  512 allocated to spaces,    2 used
> Type mutexid           512 available,  512 allocated to spaces,    0 used
> Type thread_handles   4092 available, 4092 allocated to spaces,    2 used
> Type capabilities0    1024 available, 1024 allocated to spaces,    1 used
> Type capabilities256  1024 available, 1024 allocated to spaces,    1 used
> 
> 
> Heap Usage
> ===========
> 
> Cell 1:
> Heap is Heap0 - size 4096KB with   43KB used
> 
> Cell 2:
> Heap is Heap1 - size 4096KB with   62KB used
> 
> 
> 
> Quick summary of environment:
> 
> In kernel:
>   Space called kspace
>   Id Ranges:
>   Pools:
>     vm0 on kspc
>   Programs:
>     kernel with 15 sections
> 
> In Cell decrypt:
>   Space called decrypt
>   Id Ranges:
>     4092 for threads
>     128 for spaces
>     256 for clists
>     256 for mutexes
>   Pools:
>     vm1 on vm_pool0
>   Programs:
>     decrypt with 6 sections
> 
> In Cell oklinux:
>   Space called oklinux
>   Id Ranges:
>     4092 for threads
>     128 for spaces
>     256 for clists
>     256 for mutexes
>   Pools:
>     vm2 on vm_pool1
>   Programs:
>     vmlinux with 14 sections
> 

> _______________________________________________
> Developer mailing list
> Developer at okl4.org
> https://lists.okl4.org/mailman/listinfo/developer


-- 




More information about the Developer mailing list