This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CMEM Error: getPool: Failed to get a pool fitting a size 4149248



 

Hi all,

 

I am trying to run example-davinci on DM355 LeopardBoard but i am getting the following output:

./capture_prev_rsz_ss_raw_bayer[ 7355.8
                                                                               
input_std_params: name = V4L2_STD_MT9T001_VGA                                  
input_std_params: output width = 640                                           
calling cmem utilities for allocating frame buffers                            
Allocating capture buffers :buf size = 4149248                                 
CMEM Error: getPool: Failed to get a pool fitting a size 4149248               
Failed to allocate cmem buffer                                                 
Unable to Allocate user buffers                                

I have seen some posts regarding the above error but could not get exactly how should i change the cmem memory map(i.e in

which files i have to change to modify the memory map).

Please guide how can i get rid of this error:

Thanks and Regards,

Mayank

 

 

  • How much memory you have reserved for kernel using env variable MEM? If it is 60M, rest of the memory(128M-60M=68M) will be used by CMEM.

  • Hi Nagabhushan,

     

    Thanks for your prompt reply.Please find the output of following commands and let me know where i

    can change to get the write memory configuration:

    /usr/share/myprojects/examples-davinci # cat /proc/meminfo                     
    MemTotal:         114484 kB                                                    
    MemFree:          105560 kB                                                    
    Buffers:               0 kB                                                    
    Cached:             2540 kB                                                    
    SwapCached:            0 kB                                                    
    Active:             1320 kB                                                    
    Inactive:           1500 kB                                                    
    Active(anon):        280 kB                                                    
    Inactive(anon):        0 kB                                                    
    Active(file):       1040 kB                                                    
    Inactive(file):     1500 kB                                                    
    Unevictable:           0 kB                                                    
    Mlocked:               0 kB                                                    
    SwapTotal:             0 kB                                                    
    SwapFree:              0 kB                                                    
    Dirty:                 0 kB                                                    
    Writeback:             0 kB                                                    
    AnonPages:           312 kB                                                    
    Mapped:              752 kB                                                    
    Slab:               1284 kB                                                    
    SReclaimable:        444 kB                                                    
    SUnreclaim:          840 kB                                                    
    PageTables:           60 kB                                                    
    NFS_Unstable:          0 kB                                                    
    Bounce:                0 kB                                                    
    WritebackTmp:          0 kB                                                    
    CommitLimit:       57240 kB                                                    
    Committed_AS:       1224 kB                                                    
    VmallocTotal:     903168 kB                                                    
    VmallocUsed:       12316 kB                                                    
    VmallocChunk:     882684 kB                                                    
    /usr/share/myprojects/examples-davinci # dmesg |grep mem                       
    [    0.000000] free_area_init_node: node 0, pgdat c0320e14, node_mem_map c033800
    [    0.000000]   DMA zone: 232 pages used for memmap                           
    [    0.000000] Kernel command line: console=ttyS0,115200n8 video=davincifb:osd11
    [42949373.450000] musb_hdrc: 7/9 max ep, 2624/4096 memory                      
    [42949376.090000] Freeing init memory: 116K                                    
    [42949419.940000]   File /home/mayank/DM355SDK789311/proprietary/dvsdk_2_00_00/c
    [42949420.010000] cmem initialized 8 pools between 0x87400000 and 0x88000000   
    [ 4320.910000] cmemk: no symbol version for struct_module                      
    /usr/share/myprojects/examples-davinci # dmesg |grep [Mm]em                    
    [    0.000000] Memory policy: ECC disabled, Data cache writeback               
    [    0.000000] free_area_init_node: node 0, pgdat c0320e14, node_mem_map c033800
    [    0.000000]   DMA zone: 232 pages used for memmap                           
    [    0.000000] Kernel command line: console=ttyS0,115200n8 video=davincifb:osd11
    [42949372.980000] Memory: 116MB = 116MB total                                  
    [42949372.980000] Memory: 114204KB available (2936K code, 203K data, 116K init)
    [42949373.450000] musb_hdrc: 7/9 max ep, 2624/4096 memory                      
    [42949376.090000] Freeing init memory: 116K                                    
    [42949419.940000]   File /home/mayank/DM355SDK789311/proprietary/dvsdk_2_00_00/c
    [42949420.010000] cmem initialized 8 pools between 0x87400000 and 0x88000000   
    [ 4320.910000] cmemk: no symbol version for struct_module

     

     

    Thanks and Regards,

    Mayank

  • I am referring to MEM=60M which is part of u-boot bootargs.

  • Hi Mayank,

    maybe CMEM Overview gives you an entry into that. The error message "CMEM Error: getPool: Failed to get a pool fitting a size 4149248" lets me assume that the cmemk.ko driver at least is loaded. What now would be of an interest was to investigate the memory settings.

    This is at 1st step the linux boot parameter "mem" which allows to limit the memory being actual used and controlled by Linux.

    Secondly, and maybe more of interest here, is how cmem.ko is currently configured. As you will find within the CMEM Overview it can and has to be configured concerning controlled memory area and it's partitioning into several buffer pools.

    To see the current configuration try this from the prompt of the Linux shell:

    cat /proc/cmem

    That should deliver an output beginning like that:

    Block 0: Pool 0: 20 bufs size 4096 (4096 requested)

    Pool 0 busy bufs:

    Pool 0 free bufs:
    id 0: phys addr 0x947ff000
    id 1: phys addr 0x947fe000
    id 2: phys addr 0x947fd000
    [...]

    There you could investigate if the cmemk.ko configuration is fitting the allocation wants of your software. If that does not clarify your question, it might be helpful to post that output here (or the actual cmem configuration, if you find it).

    Regards,
    Joern.

     

  •  

     

    Hi,

     

    My bootargs is as follows:

    setenv bootargs "console=ttyS0,115200n8 video=davincifb:osd1=0x0x8 mem=116M root=/dev/nfs nfsroot=10.17.8.125:/home/mayank/DM355SDK789311/fs/fs rw ip=10.17.8.131"

    so in it the mem=116M still i am getting the cmem error.

     

    Thanks and Regards,

    Mayank

     

  • As it seems right to assume you have 128MByte RAM available, with mem=116M there should be left about 12MByte for being controlled by cmemk.ko (and to be accesses by the CMEM API). That's even not too much.

    But however, if you just need one or two buffers of 4MBytes, it should work, as far as your cmemk.ko configuration fits that need.

    What is the current output of "cat /proc/cmem"?

    What is your current command line which loads cmem.ko (it's arguments allow to set the memory area and its partitioning into buffer pools)?

    Regards,
    Joern.

  •  

    Hi,

     

    Current output of cat proc/cmem:

     

    Block 0: Pool 0: 1 bufs size 421888 (421888 requested)

    Pool 0 busy bufs:

    Pool 0 free bufs:
    id 0: phys addr 0x87f99000

    error occurs while running capture demo .o file:

    /usr/share/myprojects/examples-davinci # ./capture_prev_rsz_ss_raw_bayer
    input_std_params: name = V4L2_STD_MT9T001_VGA
    input_std_params:[42949425.000000] CMEMK Error: Failed to find a pool which fits 4149248
     output width = 640
    calling cmem utilities for allocating frame buffers
    Allocating capture buffers :buf size = 4149248
    CMEM Error: getPool: Failed to get a pool fitting a size 4149248
    Failed to allocate cmem buffer
    Unable to Allocate user buffers

    i am loading cmem by running loadmodules.sh from sdk/fs/fs/bin folder:

    which is as follows:

    #!/bin/sh
    # WARNING: this file is generated automatically, and any change will be overwritten by the Makefile
    # The reserved memory that is used by cmemk is cut from the end of RAM by the mem=XX param of the kernel

    #modprobe cmemk phys_start=0x87400000 phys_end=0x88000000 pools=1x2097152,2x1529856,7x829440,1x524288,1x108680,1x81920,2x8192,6x4096
    modprobe cmemk phys_start=0x87400000 phys_end=0x88000000 pools=1x421888

    /sbin/mapdmaq

    modprobe dm350mmap
    rm -f /dev/cmem ; mknod /dev/cmem c `awk '$2 ~ /cmem/ {print $1}' /proc/devices` 0
    rm -f /dev/dm350mmap ; mknod /dev/dm350mmap c `awk '$2  ~ /dm350mmap/ {print $1}' /proc/devices` 0

     

    Any solutions to this problem.Completely fed of debuggin this error.Please provide some concrete answer how can i get rid of this error.

     

    Thanks and Regards,

    Mayank

     

     

     

     

     

     

  • That helps for the nextsteps...

    At the tms320dm355 you find the datasheet, where at page 9 you find the 256MByte DDR memory space being mapped to the physical address space 0x80000000-0x8FFFFFFF. Obviously that is the maximum you can have, what actually your hardware provides is another question.

    Within your current load line for cmemk:

    MAYANK AGARWAL said:
    modprobe cmemk phys_start=0x87400000 phys_end=0x88000000 pools=1x421888

    the physical end address for cmemk is 0x88000000 and marks relatively to the physical start address of tms320dm355 0x80000000 the position of 128MByte. Okay, lets assume, that this is what your hardware actually provides.

    Now take a look on the physical start address of cmemk set within the start line, 0x87400000 - that is, relatively to the whole memory, at position 116MByte. Oh, surprise! That fits the mem=116M parameter.

    So until now all looks fine: Linux gets the lower 116MByte for its own purposes and has full control over them, and cmemk gets the rest of memory, from 116MByte until 128MByte - that means, cmemk controls exactly 12MByte of RAM.

    If you need more controlled by cmemk, you would have to change the physical start address of cmemk to a lower value and, respectively, lower the mem Linux boot parameter. As far as Linux and your programs running at Linux yet are willing to work correctly with less memory.

    Now the last, yet non-discussed parameter of the cmemk start line: pools=1x421888.

    That tells cmemk to provide exactly one pool with one songle buffer in it, which shall have a size of 421888Byte. That is much less than cmemk could provide, but however.

    But form the error message "CMEM Error: getPool: Failed to get a pool fitting a size 4149248" we know: you need at least one buffer being at least 414928 Bytes long.

    I would try it with one or two buffers of 4MByte size. That's big enough to contain the 414928. So please try it with that cmemk starting line, let's try with two buffers :

    modprobe cmemk phys_start=0x87400000 phys_end=0x88000000 pools=2x4194304


    Please let me know if that lead one step further - as I could make only assumptions; I have a different platform working...

    Regards,
    Joern.