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: AM572x - Access IPC between A15 and M4 using docker

Part Number: AM5728

Tool/software: Linux

Hi,
I am running my software in armv7 Ubuntu 16.04 docker container on A15 processor. My software running inside docker container uses libtiipc* libraries that are currently on host A15 processor. When I run the docker, software is unable to connect to ipu2 (M4 processor) and following error comes -


```--> main:
Ipc_start: LAD_connect() failed: 4
Ipc_start failed: status = -1
<-- main:```

I tired running the LAD deamon manually using `/usr/bin/lad_dra7xx -g -l lad.txt -p 777` and I get the following error in lad.txt log file -


```Initializing LAD... [0.653065] NameServer_setup: entered, refCount=0
[0.653130] NameServer_setup: creating listener thread
[0.653266] NameServer_setup: exiting, refCount=1
[0.653334] GateHWSpinlock_start: failed to open the spinlock device[0.653346]
ERROR: unable to start GateHWSpinlock```


What is the best way for the software inside docker to communicate with software on M4 using TI-RTOS IPC libraries?

Thanks,

Christine and Akshay

  • Hi, Christine,

    What ProcSDK release version are you based on? We have not tried running Ubuntu on top of AM5728 EVM. Does it run without the Ubuntu?
    Is this application TI IPC example? If not, could you try to see if it works with TI IPC ex02_messageq example. The prebuilt images are in

    root@am57xx-evm:/usr/bin/ipc/examples/ex02_messageq/debug# ls
    app_host server_dsp2.xe66 server_ipu2.xem4
    server_dsp1.xe66 server_ipu1.xem4

    Rex
  • Hi Rex,

    We are running on a Linux built by Yocto using the 5.0.0.15 SDK with meta-virtualization layer into for docker.

    Yes the application does run natively outside of a docker container.

    The application is based on the TI IPC example.  Basically I took the ex02_messageq example and modified it for our purposes.

    Our guess is permissions issues on  /tmp/LAD from the docker container.  If you have other ideas, please let us know.

    Thanks,

    Christine

  • Hi, Christine,

    Let me discuss internally to see what the ubuntu docker container would possibly have anything to do with it.

    Rex
  • Hi Christine,

    The TI Processor SDK doesn't support Docker yet. We probably won't be able point out what causes the failure, but based on my experience with Docker, you have to ensure *all* userspace libraries which are required by the application (directly or indirectly linked) have to be included in the docker image. For example, libc.so or ld-linux-armhf.so is almost required by any userspace application, they have to be in the docker image.

    So please examine your use case, to ensure you didn't miss any additional libraries in your docker image, pay attention on those add-on packages which are NOT from Ubuntu natively.

  • Hi,

    We have added the meta-virtualization layer to our Yocto image to support docker. We are running the LAD daemon natively in Linux and the IPC test application is running in Docker and can connect to the LAD daemon as shown here:

    Initializing LAD... [0.602339] NameServer_setup: entered, refCount=0
    [0.602365] NameServer_setup: creating listener thread
    [0.602480] NameServer_setup: exiting, refCount=1
    [0.602574] listener_cb: Entered Listener thread.
    [0.602590] NameServer: waiting for unblockFd: 0, and socks: maxfd: 0
    [0.602596] NameServer_create(): 'GateMP'
    [0.602648]
    opening FIFO: /tmp/LAD/LADCMDS
    [143.359481] Retrieving command...
    [143.359844]
    LAD_CONNECT:
    [143.359861] client FIFO name = /tmp/LAD/106
    [143.359874] client PID = 106
    [143.359886] assigned client handle = 0
    [143.359932] FIFO /tmp/LAD/106 created
    [143.360074] FIFO /tmp/LAD/106 opened for writing
    [143.360124] sent response
    [143.360135] DONE
    [143.360144] Retrieving command...
    [143.360244]
    DETECTED CONNECTED CLIENT #0 HAS DEPARTED![143.360257]
    Doing DISCONNECT on behalf of client...[143.360265]
    closing FIFO /tmp/LAD/106 (filePtr=0x32808)
    [143.360286] done, unlinking /tmp/LAD/106

    however, the IPC test application encounters a HW Spin Lock failure:

    root@am57xx-evm:/home# ./app_host ipu2
    --> main:
    Ipc_start: GateHWSpinlock_start failed: -10
    Ipc_start failed: status = -1
    <-- main:

    The -10 error code looks like the same error as we looked at yesterday can't open /dev/mem
    or mapping error.

    source code:
    /* Fall back to /dev/mem if hwspinlock_user driver is not supported */
    Mod->fd = open("/dev/hwspinlock", O_RDWR);
    if (Mod->fd < 0) {
    Mod->fd = open ("/dev/mem", O_RDWR | O_SYNC);
    }
    else {
    Mod->useHwlockDrv = true;
    }

    if (Mod->fd < 0){
    LOG0("GateHWSpinlock_start: failed to open the spinlock device");
    status = GateHWSpinlock_E_OSFAILURE;
    }

    /* map the hardware lock registers into the local address space */
    if (!Mod->useHwlockDrv && status == GateHWSpinlock_S_SUCCESS) {
    dst = (UInt32)mmap(NULL, _GateHWSpinlock_cfgParams.size,
    (PROT_READ | PROT_WRITE),
    (MAP_SHARED), Mod->fd,
    (off_t)_GateHWSpinlock_cfgParams.baseAddr);

    if (dst == (UInt32)MAP_FAILED) {
    LOG0("GateHWSpinlock_start: Memory map failed")
    status = GateHWSpinlock_E_OSFAILURE;
    close(Mod->fd);
    Mod->fd = -1;
    }
    else {
    Mod->baseAddr = (UInt32 *)(dst + _GateHWSpinlock_cfgParams.offset);
    status = GateHWSpinlock_S_SUCCESS;
    }
    }


    Any tips would be appreciated.

    Thanks,
    Christine
  • We are sharing the ti ipc libraries into the docker image and the libraries are being found and used, but encounter the HW Spin Lock failure.
  • HI, Christine,

    I am not sure if this is Docker limitation. I google searched and saw the following threads. Could you see if these help?
    stackoverflow.com/.../docker-error-no-access-to-dev-mem-try-running-as-root
    forums.docker.com/.../28403

    At the mean time, I am running it by coworker internally to see if he has any idea why spinlock fails.

    Rex
  • Hi Rex,

    We figured it out! We had to use the --privileged option when sharing /dev/mem described here: stackoverflow.com/.../docker-a-way-to-give-access-to-a-host-usb-or-serial-device

    Thanks for your help!
    Christine