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.

out of memory issue in rdk3.0

Hi,

I am working at rdk 03.00.00.00. I got an "out of memory" issue when I dynamic change codec resolution and type, this application continuously run about two weeks and change codec once every three seconds. I use "top" to check process memory usage and find process "dvr_rdk_demo_mcfw_api.out" memory occupy slowly more and more.

Does any possible reason cause this issue?

Thanks,

Jacson

  • Can you share the logs of the failure.Is dvr_rdk_mcfw_api.out application getting terminated by the os ?

    How do we confirm OCMC is disabled

  • Hi Badri Narayanan,

    Yes, the dvr_rdk_mcfw_api.out application is terminated by the os.

    Log show in following. Myapp is my another application that is duty send bitstream to dvr_rdk_mcfw_api.out.

    Myapp invoked oom-killer: gfp_mask=0x201da, order=0, oom_adj=0, oom_score_adj=
    Backtrace:
    [<c004abd0>] (dump_backtrace+0x0/0x110) from [<c03d7ff0>] (dump_stack+0x18/0x1c
     r7:00000000 r6:00000000 r5:d5d8c000 r4:000201da
    [<c03d7fd8>] (dump_stack+0x0/0x1c) from [<c00a3e10>] (dump_header+0x60/0x138)
    [<c00a3db0>] (dump_header+0x0/0x138) from [<c00a416c>] (oom_kill_process+0x50/01f8)
     r8:d4dde000 r7:000002ff r6:00000000 r5:d5d8c000 r4:000201da
    [<c00a411c>] (oom_kill_process+0x0/0x1f8) from [<c00a4578>] (out_of_memory+0x26/0x2e0)
    [<c00a4314>] (out_of_memory+0x0/0x2e0) from [<c00a779c>] (__alloc_pages_nodemas+0x430/0x51c)
    [<c00a736c>] (__alloc_pages_nodemask+0x0/0x51c) from [<c00a911c>] (__do_page_cahe_readahead+0x9c/0x1e8)
    [<c00a9080>] (__do_page_cache_readahead+0x0/0x1e8) from [<c00a9294>] (ra_submit0x2c/0x34)
    [<c00a9268>] (ra_submit+0x0/0x34) from [<c00a9524>] (ondemand_readahead+0x1ac/01bc)
    [<c00a9378>] (ondemand_readahead+0x0/0x1bc) from [<c00a967c>] (page_cache_sync_eadahead+0x70/0x78)
    [<c00a960c>] (page_cache_sync_readahead+0x0/0x78) from [<c00a30ac>] (generic_fie_aio_read+0x2ec/0x738)
     r6:00000000 r5:0000011f r4:00001000
    [<c00a2dc0>] (generic_file_aio_read+0x0/0x738) from [<c01463d8>] (nfs_file_read0xd0/0x104)
    [<c0146308>] (nfs_file_read+0x0/0x104) from [<c00c86bc>] (do_sync_read+0xa0/0xe)
    [<c00c861c>] (do_sync_read+0x0/0xec) from [<c00c9190>] (vfs_read+0xb0/0xd8)
     r8:401a7000 r7:00008000 r6:d4ddff70 r5:401a7000 r4:d5ee5180
    [<c00c90e0>] (vfs_read+0x0/0xd8) from [<c00c927c>] (sys_read+0x44/0x70)
     r7:00008000 r6:d5ee5180 r5:00000000 r4:00118000
    [<c00c9238>] (sys_read+0x0/0x70) from [<c0046e00>] (ret_fast_syscall+0x0/0x30)
     r8:c0046fa8 r7:00000003 r6:40342000 r5:0003b208 r4:0003b208
    Mem-info:
    Normal per-cpu:
    CPU    0: hi:  186, btch:  31 usd: 122
    active_anon:76884 inactive_anon:8217 isolated_anon:0
     active_file:316 inactive_file:455 isolated_file:0
     unevictable:0 dirty:0 writeback:0 unstable:0
     free:594 slab_reclaimable:347 slab_unreclaimable:874
     mapped:8307 shmem:8228 pagetables:293 bounce:0
    Normal free:2376kB min:2428kB low:3032kB high:3640kB active_anon:307536kB inactve_anon:32868kB active_file:1264kB inactive_file:1820kB unevictable:0kB isolate(anon):0kB isolated(file):0kB present:368648kB mlocked:0kB dirty:0kB writeback:kB mapped:33228kB shmem:32912kB slab_reclaimable:1388kB slab_unreclaimable:3496B kernel_stack:664kB pagetables:1172kB unstable:0kB bounce:0kB writeback_tmp:0k pages_scanned:0 all_unreclaimable? no
    lowmem_reserve[]: 0 0 0
    Normal: 24*4kB 61*8kB 12*16kB 6*32kB 2*64kB 2*128kB 2*256kB 1*512kB 0*1024kB 0*048kB 0*4096kB = 2376kB
    8999 total pagecache pages
    98048 pages of RAM
    844 free pages
    7402 reserved pages
    1055 slab pages
    12863 pages shared
    0 pages swap cached
    [ pid ]   uid  tgid total_vm      rss cpu oom_adj oom_score_adj name
    [   90]     0    90      489       47   0     -17         -1000 udevd
    [ 1106]    42  1106      831       45   0       0             0 dbus-daemon
    [ 1111]     0  1111      734       18   0       0             0 telnetd
    [ 1118]     0  1118      750       39   0       0             0 syslogd
    [ 1120]     0  1120      734       23   0       0             0 klogd
    [ 1127]     0  1127      573       71   0       0             0 thttpd
    [ 1139]     0  1139      629       47   0       0             0 login
    [ 1140]     0  1140      492       25   0       0             0 getty
    [ 1142]     0  1142      782       34   0       0             0 sh
    [ 1160]     0  1160      438       40   0       0             0 remote_debug_cl
    [ 1234]     0  1234    27542    16702   0       0             0 Myapp
    [ 1238]     0  1238   134506    72304   0       0             0 dvr_rdk_demo_mc
    Out of memory: Kill process 1238 (dvr_rdk_demo_mc) score 767 or sacrifice child
    Killed process 1238 (dvr_rdk_demo_mc) total-vm:538024kB, anon-rss:256092kB, fil-rss:33124kB
    SendSettingData: recv: Connection reset by peer
    Set Display Mode fail
     [m3vpss ]  1209629150: DISPLAY: SDDAC(SEC1): 0 fps, Latency (Min / Max) = ( 0 / 34 ), Callback Interval (Min / Max) = ( 25 / 31 ) !!!
     [m3vpss ]  1209629169: DISPLAY: HDDAC(BP0) : 0 fps, Latency (Min / Max) = ( 2 / 84 ), Callback Interval (Min / Max) = ( 11 / 16 ) !!!
     [m3vpss ]  1209629169: DISPLAY: UNDERFLOW COUNT: HDMI(BP0) 6220800, HDDAC(BP0) 0, DVO2(BP1) 6220800, SDDAC(SEC1) 6134798
     [m3vpss ]  1209629169: SYSTEM  : FREE SPACE : System Heap      = 182672 B, Mbx = 10240 msgs)
     [m3vpss ]  1209629169: SYSTEM  : FREE SPACE : SR0 Heap         = 1304320 B (1 MB)
     [m3vpss ]  1209629170: SYSTEM  : FREE SPACE : Frame Buffer     = 259467136 B (247 MB)
     [m3vpss ]  1209629170: SYSTEM  : FREE SPACE : Bitstream Buffer = 43908224 B (41 MB)
     [m3vpss ]  1209629170: SYSTEM  : FREE SPACE : Tiler Buffer     = 0 B (0 MB)  - TILER OFF

  • Hi Badri Narayanan,

    What is the OCMC you said?

    Jacson

  • Ignore that I typed by mistake.How are u deleting and creating channels. Are you using demo -> decode option ? Are you seeing the same issue if you invoke Vdec_create and Vdec_delete in your application ? How much is the increase in memory each time u delete and create a decode channel.

  • Hi Badri Narayanan,

    We have some modify in the original rdk source code, not using demo->decode option to do that. I am a little hard to try Vdec_create and Vdec_delete in my application. It increase about 1M bytes per hour. we totally run delete and create about one million times causing system hang. Does any possible memory leak happen at ipcBitsOutLink?

    Thanks,

    Jacson

  • IpcBitsOutLink will print the memory allocated and freed and you should see them matching in the console logs.Anyway what you are seeing in leak in virtual memory which is causing oom killer to activate. Can you use getrusage() on the ipcBitsOutLink thread and confirm the vm allocated before and after the channel delete and create cmd to confirm there is no leak. If rusage doesnt work try /proc/PID/task/TID/stat to get the stats.

  • Hi Badri Narayanan,

    Can you teach me how to analysis tid stat information?

    root@dm816x:/proc/7426/task/7431# cat stat
    7431 (dvr_rdk_demo_mc) S 1 7424 947 64770 7424 4194624 517 198 1 0 4079 7128 0 2
     -3 0 22 0 8049928 504135680 21476 4294967295 32768 698492 2126335328 1084816696
     717218304 0 0 0 2147155711 2148059580 0 0 -1 0 2 1 0 0 0

    I do channel delete and create and cat stat again.

    root@dm816x:/proc/7426/task/7431# cat stat
    7431 (dvr_rdk_demo_mc) S 1 7424 947 64770 7424 4194624 542 198 2 0 4126 7253 0 2
     -3 0 22 0 8049928 504135680 21515 4294967295 32768 698492 2126335328 1084816696
     717218304 0 0 0 2147155711 2148059580 0 0 -1 0 2 1 0 0 0

    Thanks,

    Jacson

  • Pls refer http://linux.die.net/man/5/proc for info on each field.

    http://brokestream.com/procstat.html is a utility that can be used to print info in human readable form.

    I see the following difference in resident memory size before and after delete/create:

    rss

    21476 - Before

    21515 - After

    There is a 39 byte increase. Does this match your calculation on memory increase per hour based on number of delete/create you are doing ?

    Were you able to get getrusage working. That is better since the info is returned in a structure with proper fields which can be programatically checked for leaks.

    Which thread does this stat correspond to ?

  • Hi Badri Narayanan,

    Thanks for your help analysis. This stat data correspond to thread ipcBitsOutLink. If we delete/create bitstream buffer will be cause this issue?

    Thanks,

    Jacson

  • I have tried out delete create with dvr rdk demo and I dont see any memory leak in ipcBitsOutLink thread when deleting and creating a channel. Pls try the same at your end as well and confirm .If you dont see any leak you will have to check your app changes to see where the leak occured.

  • I found a memory leak in syslink which results in 96 bytes memory leak every time IpcBitsOut delete and create is done. I will provide a patch to avoid this issue later today. I am not sure if it resolves the issue you are seeing as I dont see the issue you are seeing in /proc/pid/task/tid/stat rss size. Anyhow pls retest after applying the patch.Pls paralleley look into any changes you have done to check if any of these could cause the leak.

  • Hi Badri Narayanan,

    This is a great news for us, we are vary appreciate your support, we are looking forward this patch can resolve our problem.

    Thanks a lot,

    Jacson

  • Pls find attached the patch to workaround the syslink memory leak. Patch is based off RDK 3.5 but changes are fairly simple and you should be able to manually make the changes if patch apply fails.

    diff --git a/mcfw/interfaces/link_api/system_common.h b/mcfw/interfaces/link_api/system_common.h
    index 13b995e..702064f 100755
    --- a/mcfw/interfaces/link_api/system_common.h
    +++ b/mcfw/interfaces/link_api/system_common.h
    @@ -81,6 +81,7 @@
     #define SYSTEM_IPC_SR_VIDEO_FRAME            (2)
     #define SYSTEM_IPC_SR_AVSYNC                 (0)
     #define SYSTEM_IPC_SR_EXTRA_HEAP             (3)
    +#define SYSTEM_IPC_SR_MAX                    (16)
     
     #define SYSTEM_IPC_PROC_NAME_DSP             "DSP"
     #define SYSTEM_IPC_PROC_NAME_M3VIDEO         "VIDEO-M3"
    diff --git a/mcfw/src_linux/links/audio/audio_utils.c b/mcfw/src_linux/links/audio/audio_utils.c
    index 9348059..6c0ea96 100755
    --- a/mcfw/src_linux/links/audio/audio_utils.c
    +++ b/mcfw/src_linux/links/audio/audio_utils.c
    @@ -17,6 +17,7 @@
     #include <ti/syslink/utils/IHeap.h>
     #include <ti/syslink/utils/Memory.h>
     #include <ti/ipc/SharedRegion.h>
    +#include <mcfw/src_linux/links/system/system_priv_ipc.h>
     
     #define SR_FRAME_BUFFERS_ID     1   /* same as UTILS_MEM_VID_BITS_BUF_HEAP */
     /**  ------ Globals  */
    @@ -97,7 +98,7 @@ Void *Audio_allocateSharedRegionBuf (Int32 bufSize)
         IHeap_Handle    heap = NULL;
         Void *tmp = NULL;
     
    -    heap = SharedRegion_getHeap(SR_FRAME_BUFFERS_ID);
    +    heap = System_ipcGetSRHeap(SR_FRAME_BUFFERS_ID);
         tmp = Memory_calloc (heap, bufSize, 128, NULL);
         if (tmp)
         {
    @@ -110,7 +111,7 @@ Void Audio_freeSharedRegionBuf (Void *buf, Int32 bufSize)
     {
         IHeap_Handle    heap = NULL;
     
    -    heap = SharedRegion_getHeap(SR_FRAME_BUFFERS_ID);
    +    heap = System_ipcGetSRHeap(SR_FRAME_BUFFERS_ID);
         if (heap)
         {
             Memory_free(heap, buf, bufSize);
    diff --git a/mcfw/src_linux/links/ipcBitsOut/ipcBitsOutLink_tsk.c b/mcfw/src_linux/links/ipcBitsOut/ipcBitsOutLink_tsk.c
    index c8afa56..b7d1dfe 100755
    --- a/mcfw/src_linux/links/ipcBitsOut/ipcBitsOutLink_tsk.c
    +++ b/mcfw/src_linux/links/ipcBitsOut/ipcBitsOutLink_tsk.c
    @@ -615,7 +615,7 @@ static Int IpcBitsOutLink_createOutObj(IpcBitsOutLink_Obj * pObj)
                                                       &pObj->createArgs.inQueInfo,
                                                       &pObj->outQueInfo);
         elemId = 0;
    -    srBitBufHeapHandle = SharedRegion_getHeap(srIndex);
    +    srBitBufHeapHandle = System_ipcGetSRHeap(srIndex);
         OSA_assert(srBitBufHeapHandle != NULL);
         cacheLineSize = SharedRegion_getCacheLineSize(srIndex);
     
    @@ -688,7 +688,7 @@ static Int IpcBitsOutLink_deleteOutObj(IpcBitsOutLink_Obj * pObj)
         const UInt32 srIndex = SYSTEM_IPC_SR_CACHED;
     
         elemId = 0;
    -    srBitBufHeapHandle = SharedRegion_getHeap(srIndex);
    +    srBitBufHeapHandle = System_ipcGetSRHeap(srIndex);
         OSA_assert(srBitBufHeapHandle != NULL);
         for (poolId = 0; poolId < pObj->outQueInfo.allocPoolInfo.numPools; poolId++)
         {
    @@ -1160,7 +1160,7 @@ Void ipcbitsoutlink_do_delete_ch_buffer_pool(IpcBitsOutLink_Obj * pObj,
         Int status,i;
         SystemIpcBits_ListElem *pListElem;
     
    -    srBitBufHeapHandle = SharedRegion_getHeap(srIndex);
    +    srBitBufHeapHandle = System_ipcGetSRHeap(srIndex);
         OSA_assert(srBitBufHeapHandle != NULL);
     
         OSA_assert(OSA_queGetQueuedCount(&pObj->listElemQue[chId]) ==
    @@ -1330,7 +1330,7 @@ Int32 IpcBitsOutLink_doChBufCreate(IpcBitsOutLink_Obj * pObj,
         numBufs = pObj->outQueInfo.allocPoolInfo.bufPoolInfo[chId].numBufs;
         totBufSize = bufSize * numBufs;
         printf ("###Bit buff of size from the SR # %d : %d\n", srIndex, totBufSize);
    -    srBitBufHeapHandle = SharedRegion_getHeap(srIndex);
    +    srBitBufHeapHandle = System_ipcGetSRHeap(srIndex);
         OSA_assert(srBitBufHeapHandle != NULL);
         Memory_getStats(srBitBufHeapHandle,&memstats);
         if (memstats.largestFreeSize >= totBufSize)
    diff --git a/mcfw/src_linux/links/system/system_ipc.c b/mcfw/src_linux/links/system/system_ipc.c
    index f3a1901..df1457d 100755
    --- a/mcfw/src_linux/links/system/system_ipc.c
    +++ b/mcfw/src_linux/links/system/system_ipc.c
    @@ -42,6 +42,31 @@ Int32 System_printProcId(UInt32 procId)
         return 0;
     }
     
    +static
    +Void system_ipc_set_srheaps()
    +{
    +    Int i;
    +    memset(gSystem_ipcObj.srHeaps,0,sizeof(gSystem_ipcObj.srHeaps));
    +    for (i = 0; i < SharedRegion_getNumRegions();i++)
    +    {
    +        OSA_assert(i < OSA_ARRAYSIZE(gSystem_ipcObj.srHeaps));
    +        gSystem_ipcObj.srHeaps[i] = SharedRegion_getHeap(i);
    +    }
    +}
    +
    +static
    +Void system_ipc_reset_srheaps()
    +{
    +    memset(gSystem_ipcObj.srHeaps,0,sizeof(gSystem_ipcObj.srHeaps));
    +}
    +
    +IHeap_Handle System_ipcGetSRHeap(UInt32 srIndex)
    +{
    +    OSA_assert(srIndex < OSA_ARRAYSIZE(gSystem_ipcObj.srHeaps));
    +    return gSystem_ipcObj.srHeaps[srIndex];
    +}
    +
    +
     Int32 System_ipcInit()
     {
         printf(" %u: SYSTEM: IPC init in progress !!!\n", OSA_getCurTimeInMsec());
    @@ -59,6 +84,8 @@ Int32 System_ipcInit()
     
         System_ipcNotifyInit();
     
    +    system_ipc_set_srheaps();
    +
     
         printf(" %u: SYSTEM: IPC init DONE !!!\n", OSA_getCurTimeInMsec());
     
    @@ -69,6 +96,8 @@ Int32 System_ipcDeInit()
     {
         printf(" %u: SYSTEM: IPC de-init in progress !!!\n", OSA_getCurTimeInMsec());
     
    +    system_ipc_reset_srheaps();
    +
         System_ipcNotifyDeInit();
     
         System_ipcMsgQDeInit();
    diff --git a/mcfw/src_linux/links/system/system_ipc_listMP.c b/mcfw/src_linux/links/system/system_ipc_listMP.c
    index 09edee6..9de8462 100755
    --- a/mcfw/src_linux/links/system/system_ipc_listMP.c
    +++ b/mcfw/src_linux/links/system/system_ipc_listMP.c
    @@ -200,7 +200,7 @@ UInt32 System_ipcListMPAllocListElemMem(UInt32 regionId, UInt32 size)
         Error_Block  eb;
         UInt32       shAddr;
     
    -    heapHndl = SharedRegion_getHeap(regionId);
    +    heapHndl = System_ipcGetSRHeap(regionId);
         UTILS_assert(heapHndl!=NULL);
     
         Error_init(&eb);
    @@ -222,7 +222,7 @@ Int32 System_ipcListMPFreeListElemMem(UInt32 regionId, UInt32 shAddr, UInt32 siz
     {
         IHeap_Handle heapHndl;
     
    -    heapHndl = SharedRegion_getHeap(regionId);
    +    heapHndl = System_ipcGetSRHeap(regionId);
         UTILS_assert(heapHndl!=NULL);
     
         Memory_free(heapHndl, (Ptr)shAddr, size);
    diff --git a/mcfw/src_linux/links/system/system_ipc_msgq.c b/mcfw/src_linux/links/system/system_ipc_msgq.c
    index d534949..89db70a 100755
    --- a/mcfw/src_linux/links/system/system_ipc_msgq.c
    +++ b/mcfw/src_linux/links/system/system_ipc_msgq.c
    @@ -115,7 +115,7 @@ Int32 System_ipcMsgQHeapCreate()
             printf(" %d: SYSTEM: Creating MsgQ Heap [%s] ...\n",
                       OSA_getCurTimeInMsec(), msgq_heap_name);
     
    -        srHeap = SharedRegion_getHeap(SYSTEM_IPC_SR_NON_CACHED_DEFAULT);
    +        srHeap = System_ipcGetSRHeap(SYSTEM_IPC_SR_NON_CACHED_DEFAULT);
             UTILS_assert(srHeap != NULL);
     
             gSystem_ipcObj.msgQHeapBaseAddr =
    @@ -166,7 +166,7 @@ Int32 System_ipcMsgQHeapDelete()
         status = HeapMemMP_delete(&gSystem_ipcObj.msgQHeapHndl);
         UTILS_assert(status == OSA_SOK);
     
    -    srHeap = SharedRegion_getHeap(SYSTEM_IPC_SR_NON_CACHED_DEFAULT);
    +    srHeap = System_ipcGetSRHeap(SYSTEM_IPC_SR_NON_CACHED_DEFAULT);
         UTILS_assert(srHeap != NULL);
     
         Memory_free(srHeap,
    @@ -586,7 +586,7 @@ static Void system_ipc_msgq_register_rpe_msgq_heap()
         IHeap_Handle srHeap;
     
         UTILS_assert(Rpe_messageqHeapId != SYSTEM_IPC_MSGQ_HEAP);
    -    srHeap = SharedRegion_getHeap(SYSTEM_IPC_SR_NON_CACHED_DEFAULT);
    +    srHeap = System_ipcGetSRHeap(SYSTEM_IPC_SR_NON_CACHED_DEFAULT);
         UTILS_assert(srHeap != NULL);
     
         MessageQ_registerHeap(srHeap,
    diff --git a/mcfw/src_linux/links/system/system_priv_ipc.h b/mcfw/src_linux/links/system/system_priv_ipc.h
    index 6b4e192..ba0dbe0 100755
    --- a/mcfw/src_linux/links/system/system_priv_ipc.h
    +++ b/mcfw/src_linux/links/system/system_priv_ipc.h
    @@ -35,6 +35,7 @@ typedef struct {
         MessageQ_Msg     freeMsgQueMem[(SYSTEM_IPC_MSGQ_HEAP_SIZE/SYSTEM_IPC_MSGQ_MSG_SIZE_MAX)];
     
         System_ipcNotifyCb notifyCb[SYSTEM_LINK_ID_MAX];
    +    IHeap_Handle       srHeaps[SYSTEM_IPC_SR_MAX];
     
     } System_IpcObj;
     
    @@ -73,5 +74,6 @@ Int32 System_ipcCopySlaveCoreSymbolContents(char *symbolName,
                                           UInt16 procId,
                                           Ptr  dstPtr,
                                           UInt32 copySize);
    +IHeap_Handle System_ipcGetSRHeap(UInt32 srIndex);
     
     #endif
    diff --git a/mcfw/src_linux/mcfw_api/ti_vsys.c b/mcfw/src_linux/mcfw_api/ti_vsys.c
    index 0f9e163..2e30822 100755
    --- a/mcfw/src_linux/mcfw_api/ti_vsys.c
    +++ b/mcfw/src_linux/mcfw_api/ti_vsys.c
    @@ -41,7 +41,7 @@
     
     
     #include "ti_vsys_priv.h"
    -
    +#include <mcfw/src_linux/links/system/system_priv_ipc.h>
     /* =============================================================================
      * Globals
      * =============================================================================
    @@ -400,7 +400,7 @@ Int32 Vsys_allocBuf(UInt32 srRegId, UInt32 bufSize, UInt32 bufAlign, Vsys_AllocB
     {
         IHeap_Handle heapHndl;
     
    -    heapHndl = SharedRegion_getHeap(srRegId);
    +    heapHndl = System_ipcGetSRHeap(srRegId);
         OSA_assert(heapHndl != NULL);
     
         bufInfo->virtAddr = NULL;
    @@ -426,7 +426,7 @@ Int32 Vsys_freeBuf(UInt32 srRegId, UInt8 *virtAddr, UInt32 bufSize)
     {
         IHeap_Handle heapHndl;
     
    -    heapHndl = SharedRegion_getHeap(srRegId);
    +    heapHndl = System_ipcGetSRHeap(srRegId);
         OSA_assert(heapHndl != NULL);
     
         OSA_assert(virtAddr != NULL);
    

  • Hi Badri Narayanan,

    Thanks for your patch.

    After we apply this patch, we see some assertion message show as following but the application is still working, is this message serious?

    Thanks,

    Jacson

     0: SYSTEM: IPC init in progress !!!
     12: SYSTEM: Opening MsgQ Heap [IPC_MSGQ_MSG_HEAP] ...
     14: SYSTEM: Creating MsgQ [HOST_MSGQ] .Assertion at Line no: 445 in /home/Jacson/RDK/DVRRDK_03.00.00.00/DVRRDK_03.00.00.00/ti_tools/syslink/syslink_2_10_02_17_patched/packages/ti/syslink/utils/hlos/knl/Linux/../../../../../../ti/syslink/ipc/hlos/knl/Linux/SharedRegionDrv.c: (heapHandle != NULL) : failed
    ..
     16: SYSTEM:Assertion at Line no: 445 in /home/Jacson/RDK/DVRRDK_03.00.00.00/DVRRDK_03.00.00.00/ti_tools/syslink/syslink_2_10_02_17_patched/packages/ti/syslink/utils/hlos/knl/Linux/../../../../../../ti/syslink/ipc/hlos/knl/Linux/SharedRegionDrv.c: (heapHandle != NULL) : failed
     Creating MsgQ [HOST_ACK_MSGQ] ...
     17: SYSTEM: Opening MsgQ [DSP_MSGQ] ...
     17: SYSTEM: Opening MsgQ [VIDEO-M3_MSGQ] ...
     18: SYSTEM: Opening MsgQ [VPSS-M3_MSGQ] ...
     19: SYSTEM: Notify register to [DSP] line 0, event 15 ...
     19: SYSTEM: Notify register to [VIDEO-M3] line 0, event 15 ...
     20: SYSTEM: Notify register to [VPSS-M3] line 0, event 15 ...
    Assertion at Line no: 1354 in /home/Jacson/RDK/DVRRDK_03.00.00.00/DVRRDK_03.00.00.00/dvr_rdk/../ti_tools/syslink/syslink_2_10_02_17_patched/packages/ti/syslink/ipc/hlos/usr/HeapMemMP.c: (hpHandle != NULL) : failed
    Assertion at Line no: 1354 in /home/Jacson/RDK/DVRRDK_03.00.00.00/DVRRDK_03.00.00.00/dvr_rdk/../ti_tools/syslink/syslink_2_10_02_17_patched/packages/ti/syslink/ipc/hlos/usr/HeapMemMP.c: (hpHandle != NULL) : failed
     71: SYSTEM: IPC init DONE !!!
     73: SYSTEM: Creating ListMP [HOST_IPC_OUT_24] in region 0 ...
     75: SYSTEM: Creating ListMP [HOST_IPC_IN_24] in region 0 ...
     77: SYSTEM: ListElem Shared Addr = 0x2d182300
     78: SYSTEM: Creating ListMP [HOST_IPC_OUT_25] in region 0 ...
     80: SYSTEM: Creating ListMP [HOST_IPC_IN_25] in region 0 ...

  • Can you check if the assert msg goes away with below patch:

    diff --git a/mcfw/src_linux/links/system/system_ipc.c b/mcfw/src_linux/links/system/system_ipc.c
    index df1457d..3ce0332 100755
    --- a/mcfw/src_linux/links/system/system_ipc.c
    +++ b/mcfw/src_linux/links/system/system_ipc.c
    @@ -72,6 +72,7 @@ Int32 System_ipcInit()
         printf(" %u: SYSTEM: IPC init in progress !!!\n", OSA_getCurTimeInMsec());

         SysLink_setup ();
    +    system_ipc_set_srheaps();

         {
             UInt32 procId;
    @@ -84,8 +85,6 @@ Int32 System_ipcInit()

         System_ipcNotifyInit();

    -    system_ipc_set_srheaps();
    -

         printf(" %u: SYSTEM: IPC init DONE !!!\n", OSA_getCurTimeInMsec());

    @@ -96,12 +95,13 @@ Int32 System_ipcDeInit()
     {
         printf(" %u: SYSTEM: IPC de-init in progress !!!\n", OSA_getCurTimeInMsec());

    -    system_ipc_reset_srheaps();

         System_ipcNotifyDeInit();

         System_ipcMsgQDeInit();

    +    system_ipc_reset_srheaps();
    +
         SysLink_destroy ();

         printf(" %u: SYSTEM: IPC de-init DONE !!!\n", OSA_getCurTimeInMsec());

    You should apply this on top of previous patch. CHange is to do system_ipc_set_srheaps immediately after SysLink_setup and 
    system_ipc_reset_srheaps just before SysLink_destroy

  • Hi Badri Narayanan,

    The assert message still happen after following your patch. Log like below.

    Thanks,

    Jacson

     0: SYSTEM: System Common Init in progress !!!
     0: SYSTEM: IPC init in progress !!!
    Assertion at Line no: 445 in /home/Jacson/RDK/DVRRDK_03.00.00.00/DVRRDK_03.00.00.00/ti_tools/syslink/syslink_2_10_02_17_patched/packages/ti/syslink/utils/hlos/knl/Linux/../../../../../../ti/syslink/ipc/hlos/knl/Linux/SharedRegionDrv.c: (heapHandle != NULL) : failed
    Assertion at LinAssertion at Line no: 445 in /home/Jacson/RDK/DVRRDK_03.00.00.00/DVRRDK_03.00.00.00/ti_tools/syslink/syslink_2_10_02_17_patched/packages/ti/syslink/utils/hlos/knl/Linux/../../../../../../ti/syslink/ipc/hlos/knl/Linux/SharedRegionDrv.c: (heapHandle != NULL) : failed
    e no: 1354 in /home/Jacson/RDK/DVRRDK_03.00.00.00/DVRRDK_03.00.00.00/dvr_rdk/../ti_tools/syslink/syslink_2_10_02_17_patched/packages/ti/syslink/ipc/hlos/usr/HeapMemMP.c: (hpHandle != NULL) : failed
    Assertion at Line no: 1354 in /home/Jacson/RDK/DVRRDK_03.00.00.00/DVRRDK_03.00.00.00/dvr_rdk/../ti_tools/syslink/syslink_2_10_02_17_patched/packages/ti/syslink/ipc/hlos/usr/HeapMemMP.c: (hpHandle != NULL) : failed
     62: SYSTEM: Opening MsgQ Heap [IPC_MSGQ_MSG_HEAP] ...
     65: SYSTEM: Creating MsgQ [HOST_MSGQ] ...
     67: SYSTEM: Creating MsgQ [HOST_ACK_MSGQ] ...
     69: SYSTEM: Opening MsgQ [DSP_MSGQ] ...

  • When do you see these msgs. When you run your app or when you run ..load.sh

  • Hi,

    It is happen when run our application.

    Jacson

  • Hi Badri Narayanan,

    In my application, system_init() will be called at Vsys_init().

    Jacson

    Int32 Vsys_init(VSYS_PARAMS_S * pContext)
    {

        if(pContext==NULL)
        {
            Vsys_params_init(&gVsysModuleContext.vsysConfig);
        }
        else
        {
            memcpy(&gVsysModuleContext.vsysConfig, pContext, sizeof(VSYS_PARAMS_S));
        }
        Vcap_init(NULL);
        Vdis_init(NULL);

        Vdec_init(NULL);
        Venc_init(NULL);

        if(gVsysModuleContext.enableFastUsecaseSwitch==FALSE)
        {
            if(gVsysModuleContext.initDone == FALSE)
            {
                gVsysModuleContext.initDone = TRUE;
                System_init();
            }
        }

        return 0;
    }

  • Hi Badri Narayanan,

    I modify code as below to avoid assert message, is it ok?

    IHeap_Handle System_ipcGetSRHeap(UInt32 srIndex)
    {
        OSA_assert(srIndex < OSA_ARRAYSIZE(gSystem_ipcObj.srHeaps));
        if (gSystem_ipcObj.srHeaps[srIndex] == 0)
            gSystem_ipcObj.srHeaps[srIndex] = SharedRegion_getHeap(srIndex);

        return gSystem_ipcObj.srHeaps[srIndex];
    }

    Int32 System_ipcInit()
    {
        printf(" %u: SYSTEM: IPC init in progress !!!\n", OSA_getCurTimeInMsec());

        SysLink_setup ();
        //system_ipc_set_srheaps();
        system_ipc_reset_srheaps();
        
        System_ipcMsgQInit();

        System_ipcNotifyInit();

        printf(" %u: SYSTEM: IPC init DONE !!!\n", OSA_getCurTimeInMsec());

        return OSA_SOK;
    }

  • This change is fine but I am confused why moving to system_ipc_set_srheaps after Syslink_setup does not resolve the assert. I have to check this more.

  • Badri Narayanan said:

    Can you check if the assert msg goes away with below patch:

    diff --git a/mcfw/src_linux/links/system/system_ipc.c b/mcfw/src_linux/links/system/system_ipc.c
    index df1457d..3ce0332 100755
    --- a/mcfw/src_linux/links/system/system_ipc.c
    +++ b/mcfw/src_linux/links/system/system_ipc.c
    @@ -72,6 +72,7 @@ Int32 System_ipcInit()
         printf(" %u: SYSTEM: IPC init in progress !!!\n", OSA_getCurTimeInMsec());

         SysLink_setup ();
    +    system_ipc_set_srheaps();

         {
             UInt32 procId;
    @@ -84,8 +85,6 @@ Int32 System_ipcInit()

         System_ipcNotifyInit();

    -    system_ipc_set_srheaps();
    -

         printf(" %u: SYSTEM: IPC init DONE !!!\n", OSA_getCurTimeInMsec());

    @@ -96,12 +95,13 @@ Int32 System_ipcDeInit()
     {
         printf(" %u: SYSTEM: IPC de-init in progress !!!\n", OSA_getCurTimeInMsec());

    -    system_ipc_reset_srheaps();

         System_ipcNotifyDeInit();

         System_ipcMsgQDeInit();

    +    system_ipc_reset_srheaps();
    +
         SysLink_destroy ();

         printf(" %u: SYSTEM: IPC de-init DONE !!!\n", OSA_getCurTimeInMsec());

    You should apply this on top of previous patch. CHange is to do system_ipc_set_srheaps immediately after SysLink_setup and 
    system_ipc_reset_srheaps just before SysLink_destroy

     

    Hi Badri,

    Let me clarify something first

    Q1. did you mean "system_ipc_set_srheaps();" should be right behind "SysLink_setup ();" instead of "System_ipcNotifyInit();" . I mean if the order will influence the result?

    Q2. did you mean "system_ipc_reset_srheaps();" should be right behind "System_ipcMsgQDeInit();" ?

  • Q1. did you mean "system_ipc_set_srheaps();" should be right behind "SysLink_setup ();" instead of "System_ipcNotifyInit();" . I mean if the order will influence the result?

    - yes

    Q2. did you mean "system_ipc_reset_srheaps();" should be right behind "System_ipcMsgQDeInit();" ?

    - yes.

    The modification by Jacson in the post above is a better change as it doesn't depend on order of initialization