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: allocHeap failed

who can help me 

i used appro v2.6 ,

SYSTEM := EVM 

HARDWARE :=DM365 

BOARD_ID := BOARD_TI_EVM

IMGS_ID := IMGS_TVP514X
TARGET_FS_DIR := $(TARGET_FS)/opt/ipnc
AEWB_ID := AEWB_ENABLE
setenv bootargs 'mem=45M console=ttyS0,115200n8 root=/dev/nfs  nfsroot=192.168.11.224:/dm365/nfs ip=192.168.11.234:255.255.255.0:192.168.11.254 ' 

insmod cmemk.ko phys_start=0x84c00000 phys_end=0x88000000 pools=30x4096,30x8096,30x12096,10x131072,2x1048576,1x15180
root@dm365-evm:~# ./av_server.out DM365 D1

AVSERVER UI: Initializing.

CLK Hz,
ARM Hz = 297000000
DDR Hz = 243000000
VPSS Hz = 243000000
IMCOP Hz = 243000000

[OSA_FILE ] Reading file [/mnt/nand/IMG_Paramset.bin] ... ERROR
IMAGE TUNE: Paramset File is not available..... Setting DEFAULT parameter
CMEMK Error: ioctl: failed to allocate heap buffer of size 0x151800

CONFIGURING AVSERVER FOR DM365 .....
Creat queue id:0
queue id:0
SENSOR FPS VALUE = 30
CMEM Error: allocHeap: ioctl CMEM_IOCALLOCHEAP failed: -1
ERROR (drv_isif.c|DRV_isifOpen|92): OSA_cmemAlloc()
ERROR (drv_capture.c|DRV_captureOpen|63): Open failed
ERROR (videoCaptureThr.c|VIDEO_captureTskCreate|82): DRV_captureOpen()
ERROR (videoCaptureThr.c|VIDEO_captureTskMain|741): VIDEO_captureTskCreate() ERROR (avServerMainThr.c|AVSERVER_tskStart|24):
Linux version 2.6.18_pro500-davinci_IPNC_DM36x_2.6.0 (root@ubuntu) (gcc 鐗堟湰 4.2.0 (MontaVista 4.2.0-16.0.32.0801914 2008-08-30)) #1 PREEMPT Thu Mar 29 18:34:31 PDT 2012
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
Machine: DaVinci DM365 EVM
Memory policy: ECC disabled, Data cache writeback
DaVinci DM0365 variant 0x8
PLL0: fixedrate: 24000000, commonrate: 121500000, vpssrate: 243000000
PLL0: vencrate_sd: 27000000, ddrrate: 243000000 mmcsdrate: 121500000
PLL1: armrate: 297000000, voicerate: 20482758, vencrate_hd: 74250000
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
CPU0: D cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets
Built 1 zonelists. Total pages: 11520
Kernel command line: mem=45M console=ttyS0,115200n8 root=/dev/nfs nfsroot=192.168.11.224:/dm365/nfs ip=192.168.11.234:255.255.255.0:192.168.11.254
PID hash table entries: 256 (order: 8, 1024 bytes)
Clock event device timer0_0 configured with caps set: 07
Console: colour dummy device 80x30
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 45MB = 45MB total
Memory: 41600KB available (3177K code, 633K data, 184K init)
Security Framework v1.0.0 initialized
Capability LSM initialized
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
MUX: initialized SPI0_SCLK
MUX: initialized SPI0_SDO)
MUX: initialized SPI0_SDI
MUX: initialized SPI0_SDENA0
DaVinci: 104 gpio irqs
MUX: initialized GPIO20
MUX: initialized I2C_SCL
Generic PHY: Registered new driver
ch0 default output "COMPOSITE", mode "NTSC"
VPBE Encoder Initialized
SCSI subsystem initialized
NET: Registered protocol family 2
IP route cache hash table entries: 512 (order: -1, 2048 bytes)
TCP established hash table entries: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 2048 bind 1024)
TCP reno registered
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
squashfs: version 3.1 (2006/08/19) Phillip Lougher
JFFS2 version 2.2. (NAND) (C) 2001-2006 Red Hat, Inc.
yaffs Mar 29 2012 18:31:46 Installing.
SGI XFS with no debug enabled
Initializing Cryptographic API
io scheduler noop registered
io scheduler anticipatory registered (default)
DAVINCI-WDT: DaVinci Watchdog Timer: heartbeat 60 sec
Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO map 0x1c20000 mem 0xfbc20000 (irq = 40) is a 16550A
serial8250.0: ttyS1 at MMIO map 0x1d06000 mem 0xfbd06000 (irq = 41) is a 16550A
RAMDISK driver initialized: 1 RAM disks of 32768K size 1024 blocksize
Davinci EMAC MII Bus: probed
MAC address is 00:0e:99:02:cb:9f
TI DaVinci EMAC Linux version updated 4.0
netconsole: not configured, aborting
Linux video capture interface: v2.00
Trying to register davinci display video device.
layer=c2c87e00,layer->video_dev=c2c87f60
Trying to register davinci display video device.
layer=c2c87c00,layer->video_dev=c2c87d60
davinci_init:DaVinci V4L2 Display Driver V1.0 loaded
i2c /dev entries driver
nand_davinci nand_davinci.0: Using 4-bit hardware ECC
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xd3 (Micron NAND 1GiB 3,3V 8-bit)
2 NAND chips detected
Creating 5 MTD partitions on "nand_davinci.0":
0x00000000-0x003c0000 : "bootloader"
0x003c0000-0x00400000 : "params"
0x00400000-0x00800000 : "kernel"
0x00800000-0x20800000 : "filesystem1"
0x20800000-0x80000000 : "filesystem2"
nand_davinci nand_davinci.0: hardware revision: 2.3
musb_hdrc: version 6.0, cppi-dma, peripheral, debug=0
MUX: initialized GPIO33
musb_hdrc musb_hdrc: No DMA interrupt line
musb_hdrc: USB Peripheral mode controller at c301c000 using DMA, IRQ 12
rtc_davinci_dm365 rtc_davinci_dm365.0: rtc intf: proc
rtc_davinci_dm365 rtc_davinci_dm365.0: rtc intf: dev (254:0)
rtc_davinci_dm365 rtc_davinci_dm365.0: rtc core: registered rtc_davinci_dm365 as rtc0
davinci-mmc davinci-mmc.0: Supporting 4-bit mode
davinci-mmc davinci-mmc.0: Using DMA mode
Advanced Linux Sound Architecture Driver Version 1.0.12rc1 (Thu Jun 22 13:55:50 2006 UTC).
ASoC version 0.13.1
CQ0093 Voice Codec 0.1
asoc: cq93vc <-> davinci-vcif mapping ok
ALSA device list:
#0: On-chip voice codec (cq93vc)
IPv4 over IPv4 tunneling driver
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
Time: timer0_1 clocksource has been installed.
Clock event device timer0_0 configured with caps set: 08
Switched to high resolution mode on CPU 0
rtc_davinci_dm365 rtc_davinci_dm365.0: setting the system clock to 2000-01-01 00:00:00 (946684800)
IP-Config: Guessing netmask 255.255.255.0
IP-Config: Complete:
device=eth0, addr=192.168.11.234, mask=255.255.255.0, gw=192.168.11.254,
host=192.168.11.234, domain=, nis-domain=(none),
bootserver=255.255.255.0, rootserver=192.168.11.224, rootpath=
Looking up port of RPC 100003/2 on 192.168.11.224
Looking up port of RPC 100005/1 on 192.168.11.224
VFS: Mounted root (nfs filesystem).
Freeing init memory: 184K
INIT: version 2.86 booting
Please wait: booting...
Error opening /dev/fb0: No such device or address
Starting udev
udev: starting version 141
udev: deprecated sysfs layout; update the kernel or disable CONFIG_SYSFS_DEPRECATED; some udev features will not work correctly
Remounting root file system...
Caching udev devnodes
Populating dev cachemv: cannot rename '/tmp/devices': No such file or directory
logger: mount: mount point /proc/bus/usb does not exist
ALSA: Restoring mixer settings...
NOT configuring network interfaces: / is an NFS mount
No state is present for card codec
Unknown hardware: "cq93vc" "" "" "" ""
Hardware is initialized using a guess method
No state is present for card codec
Thu Mar 24 19:57:00 UTC 2011
INIT: Entering runlevel: 5
Starting system message bus: dbus.
Starting telnet daemon.
Starting syslogd/klogd: done
Starting thttpd.
FATAL: Module cmemk not found.
FATAL: Module irqk not found.
FATAL: Module edmak not found.
FATAL: Module dm365mmap not found.
BusyBox v1.13.2 (2011-03-24 18:58:44 CDT) multi-call binary

Usage: mknod [OPTIONS] NAME TYPE MAJOR MINOR

Create a special file (block, character, or pipe)

Options:
-m Create the special file using the specified mode (default a=rw)
TYPEs include:
b: Make a block device
c or u: Make a character device
p: Make a named pipe (MAJOR and MINOR are ignored)


_____ _____ _ _
| _ |___ ___ ___ ___ | _ |___ ___ |_|___ ___| |_
| | _| .'| . | . | | __| _| . | | | -_| _| _|
|__|__|_| |__,|_ |___| |__| |_| |___|_| |___|___|_|
|___| |___|

Arago Project http://arago-project.org dm365-evm ttyS0

Arago 2011.02 dm365-evm ttyS0

dm365-evm login: root
M.MSTPRI0 = 00440022
DRV: SYSTEM.MSTPRI1 = 00000244
DRV: ISP.BCR = 00000002
DRV: SYSTEM.MISC = 00000391
CMEMK module: built on Mar 30 2012 at 01:18:37
Reference Linux version 2.6.18
File /home/xia/ipc2.6/dvsdk_2_10_01_18/linuxutils_2_26_03_06/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c
allocated heap buffer 0xc4000000 of size 0x2bf2000
CMEM Range Overlaps Kernel Physical - allowing overlap
CMEM phys_start (0x1000) overlaps kernel (0x80000000 -> 0x82d00000)
allocated heap buffer 0xc3400000 of size 0x60000
cmemk initialized
EDMAK module: built on Mar 30 2012 at 00:34:45
Reference Linux version 2.6.18
File /home/xia/ipc2.6/dvsdk_2_10_01_18/linuxutils_2_24_04_05/packages/ti/sdo/linuxutils/edma/src/module/edmak.c
IRQK module: built on Mar 30 2012 at 00:34:46
Reference Linux version 2.6.18
File /home/xia/ipc2.6/dvsdk_2_10_01_18/linuxutils_2_24_04_05/packages/ti/sdo/linuxutils/irq/src/module/irqk.c
irqk initialized
root@dm365-evm:~# ./moduletest.out drv_isif 

CLK Hz,
ARM Hz = 297000000
DDR Hz = 243000000
VPSS Hz = 243000000
IMCOP Hz = 243000000

[OSA_FILE ] Reading file [/mnt/nand/IMG_Paramset.bin] ... ERROR
IMAGE TUNE: Paramset File is not available..... Setting DEFAULT parameter
ISIF: Opening imager.
SENSOR FPS VALUE = 30
ISIF: Opening ISIF.
CMEMK Error: ioctl: failed to allocate heap buffer of size 0x15180
CMEM Error: allocHeap: ioctl CMEM_IOCALLOCHEAP failed: -1
ERROR (drv_isif.c|DRV_isifOpen|114): OSA_cmemAlloc()
CMEMK Error: get_phys: Unable to find phys addr for 0x00000004
CMEMK Error: get_phys: get_user_pages() failed: -14
CMEMK Error: FREEHEAP: Failed to convert virtual 0x4 to physical
CMEMK Error: Failed to free memory at 0xbf00ff00
CMEM Error: freeCMEMK Error: get_phys: Unable to find phys addr for 0x41a6aaab
: failed to freeCMEMK Error: get_phys: get_user_pages() failed: -14
0x4
CMEM ErrorCMEMK Error: FREEHEAP: Failed to convert virtual 0x41a6aaab to physical
: free: failed tCMEMK Error: get_phys: Unable to find phys addr for 0x0000027f
o free 0xff00ff0CMEMK Error: get_phys: get_user_pages() failed: -14
0
CMEM Error: fCMEMK Error: FREEHEAP: Failed to convert virtual 0x27f to physical
ree: failed to fCMEMK Error: get_phys: Unable to find phys addr for 0x00000280
ree 0x41a6aaab
CMEMK Error: get_phys: get_user_pages() failed: -14
CMEM Error: freeCMEMK Error: FREEHEAP: Failed to convert virtual 0x280 to physical
: failed to freeCMEMK Error: get_phys: Unable to find phys addr for 0x00001388
0x27f
CMEM ErrCMEMK Error: get_phys: get_user_pages() failed: -14
or: free: failedCMEMK Error: FREEHEAP: Failed to convert virtual 0x1388 to physical
to free 0x280
CMEM Error: free: failed to free 0x1388
CMEMK Error: get_phys: Unable to find phys addr for 0x000275d8
CMEMK Error: get_phys: get_user_pages() failed: -14
CMEMK Error: FREEHEAP: Failed to convert virtual 0x275d8 to physical
CMEMK Error: get_phys: Unable to find phys addr for 0x0002b4d0
CMEM Error: freeCMEMK Error: get_phys: get_user_pages() failed: -14
: failed to freeCMEMK Error: FREEHEAP: Failed to convert virtual 0x2b4d0 to physical
0x275d8
CMEMK Error: get_phys: Unable to find phys addr for 0x0002bf94
CMEM Error: freeCMEMK Error: get_phys: get_user_pages() failed: -14
: failed to freeCMEMK Error: FREEHEAP: Failed to convert virtual 0x2bf94 to physical
0x2b4d0
i can't find the reason who can help me!!!!!
- _-  
  • jiliang xia said:
    insmod cmemk.ko phys_start=0x84c00000 phys_end=0x88000000 pools=30x4096,30x8096,30x12096,10x131072,2x1048576,1x15180

    I don't think the above is your actual command being used.  I say this because your console output shows 2 blocks being used:

    jiliang xia said:
    CMEMK module: built on Mar 30 2012 at 01:18:37
    Reference Linux version 2.6.18
    File /home/xia/ipc2.6/dvsdk_2_10_01_18/linuxutils_2_26_03_06/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c
    allocated heap buffer 0xc4000000 of size 0x2bf2000
    CMEM Range Overlaps Kernel Physical - allowing overlap
    CMEM phys_start (0x1000) overlaps kernel (0x80000000 -> 0x82d00000)
    allocated heap buffer 0xc3400000 of size 0x60000

    In addition to two heap buffers being created (one for each physically-contiguous block), we can see the "phys_start(0x1000)" which is showing that one of your CMEM blocks was specified to start at 0x1000 (which is typical for DM365 DVSDKs).

    I just wanted to point that out, that what you seem to think is your cmemk.ko insmod is not actually the one being used.  Somewhere in your DVSDK is a file that does 'insmod cmemk.ko' (or 'modprobe cmemk.ko') with both phys_start/phys_end *and* phys_start1/phys_end1.

    But on to your real problem - failure of CMEM allocations...

    We can see that these failed allocations are "heap" based.  In CMEM there are pools, which you specify with pools=..., and the heap, for each block.  The heap is constructed from memory left over in the physical block after all the pool specifications have been processed.  We can see that your heaps are of size 0x02bf2000 & 0x00060000 (that 2nd one confuses me - usually the 2nd block for CMEM on a DM365 is phys_start1=0x1000 phys_end1=0x8000, just 28K in size, so not nearly enough room for a heap block of 0x00060000).

    When CMEM memory is allocated through Codec Engine (CE), the CE Memory interface specifies what type of allocation (POOL vs HEAP, CACHED vs NONCACHED, etc).  The function Memory_alloc() takes a Memory_AllocParams structure, and one of those elements is the Memory_type.  To get heap-based allocation, you would specifiy Memory_CONTIGHEAP for the type (and Memory_CONTIGPOOL if you want to alloc from one of the "pools=..." specified on the insmod command line).  There is also the Memory_contigAlloc() API that essentially hardcodes Memory_CONTIGPOOL.

    I get the sense that you want Memory_CONTIGPOOL allocations here.  Without that, all your allocations will come from the heap, and all the pool blocks are left unused.

    Also, one other mini-confusion...

    jiliang xia said:
    CMEMK Error: ioctl: failed to allocate heap buffer of size 0x151800
        ...snip...
    CMEMK Error: ioctl: failed to allocate heap buffer of size 0x15180


    The size 0x15180 looks suspiciously like one of your pool sizes, 1x15180 (from your suspected-not-in-use 'insmod cmemk.ko'), but the pool size is in decimal and your failed allocation is printing hex.  I just wanted to point this out, as it's easy to wrongly assume that the pool sizes on the insmod command are in hex (that 'x', which means "by" as in 2x4, leads folks to think the number is hex).  The pool sizes are <#>x<decimal size> on the insmod command.  The first size I quote directly above (0x151800) has one more '0' than 0x15180, so I wonder if that is a cut-and-paste mistake, or you're specifying an extra '0' (or you really do mean 0x15180 and 0x151800 and this is all just a huge coincidence with the decimal 15180).

    Regards,

    - Rob