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.

Linux/AM5728: CMEM error

Part Number: AM5728

Tool/software: Linux

Hello,

I am getting an error trying to communicate between Linux and DSP1. Here are the messages running the program on the host:

-------------------------------------

root@am57xx-evm:~/test/messageq/hostex# ./hostex2 DSP1
--> main:
--> Main_main:
--> App_create:
CMEM_init success
MessageQ_Params_init
MessageQ_create
queue name DSP1:MsgQ:01
MessageQ_open
App_create: Host is ready
<-- App_create:
--> App_exec:
App_exec: sending message
user: 0xaa5a2000 phys: 0xa0000000
Data 0 in xor = 0xad[ 2211.926600] CMEMK Error: Failed to find a pool which fits 0x70

CMEM Error: getPool: Failed to get a pool fitting a size 0x70[ 2211.943117] CMEMK Error: ALLOC: invalid pool (-1) passed.

CMEM Error: allocPool: ioctl CMEM_IOCALLOC failed from pool -1: -1
CMEM_alloc() failed (returned NULL)
<-- App_exec: -1
<-- Main_main:
<-- main:
root@am57xx-evm:~/test/messageq/hostex#

-------------------------------------

I had checked the /sys/module/cmemk/parameters/phys_start and phys_end files via 'cat' and they showed 'null'. I then ran 'rmmod cmemk' and ran insmod this way,

       insmod /lib/modules/4.4.19-rt25-gf572d285f0/extra/cmemk.ko phys_start=0xa0000000 phys_end=0xac000000 pools=4x50331648

The following messaged occured,

-------------------------------------

[ 6264.961831] CMEMK module: reference Linux version 4.4.19
[ 6264.969162] allocated heap buffer 0x40500000 of size 0x100000
[ 6264.975069] cmemk initialized
-------------------------------------

I checked phys_start and phys_end again, which now show 0xa0000000 and 0xac000000 respectively.

  • More information. Using the ger_zel example with resource table for host and DSP1 only.

    bitbucket.org/.../cmem.git

    The error is happen in the second loop of the allocation. The first loop was find even for a PAYLOADSIZE of 0x700000. Here are the messages with a comment added in the loop followed by the loop code getting the error, (this occurs for both PAYLOADSIZE values used, 0x700000 and 0x70).
    ---------------------------------------------
    root@am57xx-evm:~/test/messageq/hostex# ./hostex2 DSP1
    --> main:
    --> Main_main:
    --> App_create:
    CMEM_init success
    MessageQ_Params_init
    MessageQ_create
    queue name DSP1:MsgQ:01
    MessageQ_open
    App_create: Host is ready
    <-- App_create:
    --> App_exec:
    App_exec: sending message

    At loop 0 of 4.

    user: 0xaa5b5000 phys: 0xa0000000
    Data 0 in xor = 0xc6

    At loop 1 of 4.

    [15557.259602] CMEMK Error: Failed to find a pool which fits 0x700000
    CMEM Error: getPool: Failed to get a pool fitting a size 0x700000[15557.269706] CMEMK Error: ALLOC: invalid pool (-1) passed.

    CMEM Error: allocPool: ioctl CMEM_IOCALLOC failed from pool -1: -1

    CMEM_alloc() failed (returned NULL)
    <-- App_exec: -1
    <-- Main_main:
    <-- main:
    root@am57xx-evm:~/test/messageq/hostex#
    ---------------------------------------------

    The code segment
    ---------------------------------------------
    for (i = 0; i < 4; i++) {

    printf("\n\tAt loop %d of 4.\n\n", i);
    fflush(stdout);

    msg->dataIn[i] = CMEM_allocPool(CMEM_getPool(PAYLOADSIZE), &cmemAttrs);
    if (msg->dataIn[i] == NULL) {
    printf("\nCMEM_alloc() failed (returned NULL)\n");
    status = -1;
    goto leave;
    }
    msg->dataInPhys[i] = CMEM_getPhys(msg->dataIn[i]);

    printf("user: %p phys: 0x%x\n", msg->dataIn[i], msg->dataInPhys[i]);

    uint8_t *dataIn = (uint8_t*)msg->dataIn[i];

    msg->inXor[i] = 0;

    for(j = 0; j < PAYLOADSIZE; j++) {
    dataIn[j] = rand();
    msg->inXor[i] ^= dataIn[j];
    }

    printf("Data %d in xor = 0x%x\n", i, msg->inXor[i]);
    }
    ---------------------------------------------
  • The software team have been notified. They will respond here.
  • Were you trying to run TI IPC ex02 messageQ example?
  • I used the host/DSP1 example posted here,

    bitbucket.org/.../cmem.git
  • Also, I am wondering if the resource table included in the example, rsc_table_dsp.h, has some conflicts within all of the define statements.
    Thanks
  • Shouldn't, but last time I ran this example was 1 or 2 releases ago. I'll retry it with the same release as yours (ProcSDK 3.2, kernel v4.4) and see what's going on.
  • Hello,

    I noticed that with I removed and then insmod cmemk again with the following command,

    insmod /lib/modules/4.4.19-rt25-gf572d285f0/extra/cmemk.ko phys_start=0xa0000000 phys_end=0xac000000 pools=4x50331648

    And then cat /proc/cmem, I still get the default 1 pool that occurs during the boot process,
    ------------------------------------------------------------------------------
    Block 0: Pool 0: 1 bufs size 0xc000000 (0xc000000 requested)

    Pool 0 busy bufs:

    Pool 0 free bufs:
    id 0: phys addr 0xa0000000
    -----------------------------------------------------------------------------
    I was looking at the cmemk/parameters file, which shows what I used with insmod,

    cat /sys/module/cmemk/parameters/pools --- shows ----> 4x50331648

    Could this be related to getting only one pool? I though a pool could be used more than once if enough memory is available?

    Thanks,
    Dan
  • Ok, I changed the cmem dtsi file and created 8 pools of equal size using all of the available memory.
    Creating four pools now works. Now the the second DSP2 will not load using the same resource table that points to the DSP2 base address of 0x9f000000.

    This is the output allocating buffers in four different pools:
    -----------------------------------------------------------------------------
    root@am57xx-evm:~/test/messageq/hostex# ./hostex2 DSP1
    --> main:
    --> Main_main:
    --> App_create:
    CMEM_init success
    MessageQ_Params_init
    MessageQ_create
    queue name DSP1:MsgQ:01
    MessageQ_open
    App_create: Host is ready
    <-- App_create:
    --> App_exec:
    App_exec: sending message

    At loop 0 of 4.

    user: 0xb4e41000 phys: 0xaa800000

    inXor: 0
    msg->inXor[i]: 0
    inXor: 16
    msg->inXor[i]: 0
    At loop 1 of 4.

    user: 0xb3641000 phys: 0xa9000000

    inXor: 0
    msg->inXor[i]: 0
    inXor: 16
    msg->inXor[i]: 0
    At loop 2 of 4.

    user: 0xb1e41000 phys: 0xa7800000

    inXor: 0
    msg->inXor[i]: 0
    inXor: 16
    msg->inXor[i]: 0
    At loop 3 of 4.

    user: 0xb0641000 phys: 0xa6000000

    inXor: 0
    msg->inXor[i]: 0
    inXor: 16
    msg->inXor[i]: 0
    inXor: 16
    msg->inXor[0]: 0
    Message put done.

    Message get done.

    inXor: 16
    msg->inXor[0]: 16
    <-- App_exec: 0

    --> App_delete:
    <-- App_delete:
    <-- Main_main:
    <-- main:
    -----------------------------------------------------------------------------
    Thanks
  • Also, a clarification may be needed in configuration the cmem pools.
    If cmem is configured in a dtsi file that also means the 'insmod cmemk ...' command cannot update the pools configuration?
    Thanks
  • I don't see any issue running the ex02_messageq example. The relevant logs from my run are shown below:

    [ 9.160260] remoteproc3: powering up 41000000.dsp
    [ 9.192047] remoteproc3: Booting fw image dra7-dsp2-fw.xe66, size 4528816
    [ 9.222290] omap_hwmod: mmu0_dsp2: _wait_target_disable failed
    [ 9.228186] omap-iommu 41501000.mmu: 41501000.mmu: version 3.0
    [ 9.234131] omap-iommu 41502000.mmu: 41502000.mmu: version 3.0
    [ 9.297451] remoteproc3: remote processor 41000000.dsp is now up
    [ 9.313289] virtio_rpmsg_bus virtio2: rpmsg host is online
    [ 9.313672] virtio_rpmsg_bus virtio2: creating channel rpmsg-proto addr 0x3d
    [ 9.333941] remoteproc2: powering up 40800000.dsp
    [ 9.356598] remoteproc2: Booting fw image dra7-dsp1-fw.xe66, size 4681692
    [ 9.378185] omap_hwmod: mmu0_dsp1: _wait_target_disable failed
    [ 9.384076] omap-iommu 40d01000.mmu: 40d01000.mmu: version 3.0
    [ 9.390011] omap-iommu 40d02000.mmu: 40d02000.mmu: version 3.0
    [ 9.440844] remoteproc2: remote processor 40800000.dsp is now up
    [ 9.458507] virtio_rpmsg_bus virtio3: rpmsg host is online


    root@am57xx-evm:/lib/firmware# ls -l dra7*.xe66
    lrwxrwxrwx 1 root root 25 Apr 26 2017 dra7-dsp1-fw.xe66 -> ex02_server_dsp1_320.xe66
    lrwxrwxrwx 1 root root 25 Apr 26 2017 dra7-dsp2-fw.xe66 -> ex02_server_dsp2_320.xe66

    root@am57xx-evm:~# uname -a
    Linux am57xx-evm 4.4.32-gadde2ca9f8 #8 SMP PREEMPT Fri Apr 7 14:16:56 EDT 2017 armv7l GNU/Linux


    root@am57xx-evm:~# ./app_host_ex02_320 DSP1
    --> main:
    --> Main_main:
    --> App_create:
    App_create: Host is ready
    <-- App_create:
    --> App_exec:
    App_exec: sending message 1
    App_exec: sending message 2
    App_exec: sending message 3
    App_exec: message received, sending message 4
    App_exec: message received, sending message 5
    App_exec: message received, sending message 6
    App_exec: message received, sending message 7
    App_exec: message received, sending message 8
    App_exec: message received, sending message 9
    App_exec: message received, sending message 10
    App_exec: message received, sending message 11
    App_exec: message received, sending message 12
    App_exec: message received, sending message 13
    App_exec: message received, sending message 14
    App_exec: message received, sending message 15
    App_exec: message received
    App_exec: message received
    App_exec: message received
    <-- App_exec: 0
    --> App_delete:
    <-- App_delete:
    <-- Main_main:
    <-- main:
    root@am57xx-evm:~#

    root@am57xx-evm:~# lsmod | grep -ir cmem
    cmemk 31462 0

    You can try to follow the instructions in IPC Quick Start Guide at processors.wiki.ti.com/.../Processor_SDK_IPC_Quick_Start_Guide

    You do need to build the IPC library on ARM Linux side before building the IPC examples on DSP RTOS side. If the RTOS SDK and CCS are not installed at the default folders, then TI_RTOS_PATH and TI_CCS_PATH need to be exported.

    The ex02_messageq example is included in RTOS SDK and under RTOS_SDK/IPC_xx_xx_xx/examples/DRA7_linux_elf/ex02_messageq

    I am using ProcSDK 3.2 release which has kernel 4.4.32. Last time I ran the example was using ProcSDK 3.1 which is the same kernel version as yours, v4.4.19.

    Rex