arjun.a
rename files
6c7b14a
Ticket Name: Linux/TDA2: how to use the malloc() & OSA_memAllocSR to apply the mem on tda2px ??
Query Text:
Part Number: TDA2 Tool/software: Linux i use our pcb board . total mem size is 512MB . run hlos on A15 , linux used 64MB mem. & OSA_HEAPID_DDR_CACHED_SR1 used 205 MB proble 1. : on linux , i excute the cmd "free" i found the mem info as follow, why the total mem is 250M ??? OSA_HEAPID_DDR_CACHED_SR1 this mem area can be found on linux ?? total used free shared buffers cached Mem: 250752 142764 107988 4636 4336 47188 -/+ buffers/cache: 91240 159512 Swap: 0 0 0 proble 2: i run my usecase isscapture > isp > my alg (A15) >enc > rtsp server(A15) ; when i run the usecase , error "virtio_rpmsg_bus virtio2: msg received with no recipient" encountered . it seems like mem malloc is not used correctly . how to use malloc() & OSA_memAllocSR ? because i use some opensource code , there must mem malloc is use malloc or new in thems . if i malloc() a big size mem area , is it conflict with OSA_memAllocSR ??? or other mem area will be used ?
Responses:
Hi, Entries which lie in the 'reserved-memory' entry of the device tree, are carved out from the memory accessible to Linux. Thus the 205MB which is allocated for shared-region is mapped in Linux, but isn't available for generic applications to use. Applications like Vision-SDK (apps.out), which rely on M4 to allocate the buffers, are capable of accessing these regions through the use of memcache module. You can find more information here: www.kernel.org/.../reserved-memory.txt We recommend using OSA_memAllocSR for all memory allocations which are shared across cores. The malloc call doesn't allocate memory from the SR region, instead it allocates from the Linux kernel's high-mem. Regards Shravan
hi Shravan there is some log of my usecase , i want you help me check if the mem is ok ? because before i change malloc to OSA_memAllocSR, more my usecase can not run , and after that ,some usecase can run , and some also can not run . thanks . [HOST] [HOST ] 72.553772 s: NULL Link: Create in progress !!! [HOST] [HOST ] 72.553803 s: RTSP Link: Create done !!! [HOST] [HOST ] 72.555419 s: guoqiang Entered chains_issSimpleIsp_Display_StartApp [HOST] [DSP1 ] 72.553894 s: SYSTEM: SW Message Box Msg Pool, Free Msg Count = 1023 [HOST] [DSP1 ] 72.553925 s: SYSTEM: Heap = LOCAL_L2 @ 0x00800000, Total size = 227264 B (221 KB), Free size = 227264 B (221 KB) [HOST] [DSP1 ] 72.553955 s: SYSTEM: Heap = LOCAL_DDR @ 0x00000000, Total size = 524288 B (512 KB), Free size = 520464 B (508 KB) [HOST] [DSP2 ] 72.554169 s: SYSTEM: SW Message Box Msg Pool, Free Msg Count = 1023 [HOST] [DSP2 ] 72.554199 s: SYSTEM: Heap = LOCAL_L2 @ 0x00800000, Total size = 227264 B (221 KB), Free size = 227264 B (221 KB) [HOST] [DSP2 ] 72.554260 s: SYSTEM: Heap = LOCAL_DDR @ 0x00000000, Total size = 524288 B (512 KB), Free size = 520464 B (508 KB) [HOST] [IPU2 ] 72.550661 s: ENCODE: CH0: H264EncCreated:H264ENC_TI DEV.500.V.H264AVC.E.IVAHD.02.01.09.01 [HOST] [IPU2 ] 72.550936 s: ENCODE: All CH Create ... DONE !!! [HOST] [IPU2 ] 72.552339 s: ENCODE: Create ... DONE !!! [HOST] [IPU2 ] 72.552796 s: IPC_OUT_1 : Create in progress !!! [HOST] [IPU2 ] 72.553132 s: IPC_OUT_1 : Create Done !!! [HOST] [IPU2 ] 72.554535 s: SYSTEM: SW Message Box Msg Pool, Free Msg Count = 1023 [HOST] [IPU2 ] 72.554657 s: SYSTEM: Heap = LOCAL_DDR @ 0x00000000, Total size = 262144 B (256 KB), Free size = 252096 B (246 KB) [HOST] [IPU2 ] 72.554809 s: SYSTEM: Heap = SR_OCMC @ 0x00000000, Total size = 0 B (0 KB), Free size = 0 B (0 KB) [HOST] [IPU2 ] 72.554962 s: SYSTEM: Heap = SR_DDR_CACHED @ 0x84203000, Total size = 214958080 B (205 MB), Free size = 171809792 B (163 MB) [HOST] [IPU2 ] 72.555145 s: SYSTEM: Heap = SR_DDR_NON_CACHED @ 0xbfc00000, Total size = 1046912 B (0 MB), Free size = 1019264 B (0 MB) [HOST] [IPU2 ] 72.555572 s: *** UTILS: CPU KHz = 20000 Khz *** [HOST] [IPU2 ] 72.855426 s: Setting Camera Power to 3!!! [HOST] [IPU2 ] 72.855517 s: Waiting for 500 milliseconds!!! [HOST] [IPU2 ] 73.355456 s: Serilaizer # 0 has I2CAddr 74 !!! [HOST] [IPU2 ] 73.856463 s: AR0144_Start :read some reg i2cinstid = 4 , i2c addr = 40 [HOST] [IPU2 ] 73.857317 s: AR0144_Start :read the regAddr 0x3000 regValue: 1356 [HOST] [IPU2 ] 73.857378 s: AR0144_Start :start write default reg [HOST] [HOST ] 74.917373 s: guoqiang 11 Entered chains_issSimpleIsp_Display_StartApp [HOST] [HOST ] 74.918959 s: guoqiang 55 Entered chains_issSimpleIsp_Display_StartApp [HOST] [HOST ] 74.919477 s: [HOST] [HOST ] [HOST] [HOST ] ==================== [HOST] [HOST ] Chains Run-time Menu [HOST] [HOST ] ==================== [HOST] [HOST ] [HOST] [HOST ] 0: Stop Chain [HOST] [HOST ] [HOST] [HOST ] p: Print Performance Statistics [HOST] [HOST ] [HOST] [HOST ] Enter Choice: [ 68.639840] omap_l3_noc 44000000.ocp: L3 application error: target 5 mod:1 (unclearable) [HOST] [IPU2 ] 74.915634 s: AR0144_Start :end write defa[ 68.650614] omap_l3_noc 44000000.ocp: L3 debug error: target 5 mod:1 (unclearable) ult reg [HOST] [IPU2 ] 74.917037 s: AR0144_Start :read the regAddr 0x3270 regValue: 100 [HOST] [IPU2 ] 74.917129 s: #### Sensor Config time = 2361 msec #### [HOST] [IPU2 ] 74.918593 s: ISSCAPTURE: Start in progress !!! [HOST] [IPU2 ] 74.918776 s: ISSCAPTURE: Start Done !!! [HOST] [HOST ] 74.970444 s: the detect face num is : 0 the pitch(1280, 1280) use 3 ms [HOST] [HOST ] 75.004758 s: the detect face num is : 0 the pitch(1280, 1280) use 3 ms [HOST] [HOST ] 75.037180 s: the detect face num is : 0 the pitch(1280, 1280) use 4 ms
Hi, malloc will allocate from the memory available to the Linux kernel (in your cases its 512MB - reserved mem regions). As indicated in the previous posts, if you want IPU and DSP to access memory you need to allocate using Osa_memAllocSR. If its local to a process in Linux, you can use malloc. You can use the information from the below command to see the amount of memory available to Linux. cat /proc/meminfo If you notice your available memory on linux is low, you can reduce your SR-1 region size, by updating the kernel device tree entry and accordingly update the linux memory map file found in apps/build/tda2px/mem_segment_definition_linux.xs in VSDK and perform a clean build. Regards Shravan