atmel_isc - v4l2src0:src: page allocation failure

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

gselabs
Posts: 28
Joined: Sun Feb 17, 2019 7:04 pm

atmel_isc - v4l2src0:src: page allocation failure

Fri Mar 06, 2020 8:35 pm

I am trying to use the atmel_isc with the gstreamer-1.0 on a SAMA5D27C-D1G based board but faced with the page allocation failure. The problem comes when I am trying to start a gstreamer pipeline. It becomes on resolutions greater than 1024x768.

My pipeline looks as follows:

Code: Select all

v4l2src device=/dev/video0 ! video/x-raw,format=RGB16,framerate=10/1,width=1280,height=1024 ! appsink name="mysink"
I've tried to set the coherent_pool parameter to 8192, but got the following error while booting.

Code: Select all

[    0.000000] cma: Failed to reserve 64 MiB
I've heard about the scatter/gather DMA and about the physical memory reserve but I cannot understend how can it help me in this case?

Could I configure something in the system to solve the problem?

Code: Select all

[  288.070000] v4l2src0:src: page allocation failure: order:10, mode:0x6000c0(GFP_KERNEL), nodemask=(null)                                                                                                
[  288.070000] CPU: 0 PID: 2299 Comm: v4l2src0:src Tainted: G         C O      4.19.78-linux4sam-6.2-00035-ge646810badca-dirty #1                                                                         
[  288.080000] Hardware name: Atmel SAMA5                                                                                                                                                                 
[  288.090000] Function entered at [<c010e7c0>] from [<c010b750>]                                                                                                                                         
[  288.090000] Function entered at [<c010b750>] from [<c018cae4>]                                                                                                                                         
[  288.090000] Function entered at [<c018cae4>] from [<c018d5cc>]                                                                                                                                         
[  288.100000] Function entered at [<c018d5cc>] from [<c01109b0>]                                                                                                                                         
[  288.100000] Function entered at [<c01109b0>] from [<c0110a2c>]                                                                                                                                         
[  288.110000] Function entered at [<c0110a2c>] from [<c0110ad0>]                                                                                                                                         
[  288.110000] Function entered at [<c0110ad0>] from [<c010fe78>]                                                                                                                                         
[  288.120000] Function entered at [<c010fe78>] from [<c01100a8>]                                                                                                                                         
[  288.120000] Function entered at [<c01100a8>] from [<c053ae8c>]                                                                                                                                         
[  288.130000] Function entered at [<c053ae8c>] from [<c05356b8>]                                                                                                                                         
[  288.130000] Function entered at [<c05356b8>] from [<c05372dc>]                                                                                                                                         
[  288.140000] Function entered at [<c05372dc>] from [<c053926c>]                                                                                                                                         
[  288.140000] Function entered at [<c053926c>] from [<c052226c>]                                                                                                                                         
[  288.140000] Function entered at [<c052226c>] from [<c0525518>]                                                                                                                                         
[  288.150000] Function entered at [<c0525518>] from [<c01e3418>]                                                                                                                                         
[  288.150000] Function entered at [<c01e3418>] from [<c01e3be0>]                                                                                                                                         
[  288.160000] Function entered at [<c01e3be0>] from [<c0101000>]                                                                                                                                         
[  288.160000] Exception stack(0xc0a2ffa8 to 0xc0a2fff0)                                                                                                                                                  
[  288.170000] ffa0:                   008a7610 00000004 00000016 c0145608 b0adebe8 b5c3e0c1                                                                                                              
[  288.170000] ffc0: 008a7610 00000004 00000001 00000036 00754c08 b0dc595c 00000000 00000001                                                                                                              
[  288.180000] ffe0: b0dc5db0 b0adebcc b0d8aeb1 b5c3e0c8                                                                                                                                                  
[  288.180000] warn_alloc_show_mem: 1 callbacks suppressed                                                                                                                                                
[  288.180000] Mem-Info:                                                                                                                                                                                  
[  288.190000] active_anon:2678 inactive_anon:87 isolated_anon:0                                                                                                                                          
                active_file:3379 inactive_file:6869 isolated_file:32                                                                                                                                      
                unevictable:0 dirty:1075 writeback:0 unstable:0                                                                                                                                           
                slab_reclaimable:685 slab_unreclaimable:1669                                                                                                                                              
                mapped:4429 shmem:147 pagetables:127 bounce:0                                                                                                                                             
                free:10718 free_pcp:0 free_cma:0                                                                                                                                                          
[  288.200000] Node 0 active_anon:10712kB inactive_anon:348kB active_file:13516kB inactive_file:27476kB unevictable:0kB isolated(anon):0kB isolated(file):128kB mapped:17716kB dirty:4300kB writeback:0kBo
[  288.210000] Normal free:42872kB min:16192kB low:20240kB high:24288kB active_anon:10712kB inactive_anon:348kB active_file:13516kB inactive_file:27476kB unevictable:0kB writepending:4300kB present:131B
[  288.220000] lowmem_reserve[]: 0 0                                                                                                                                                                      
[  288.220000] Normal: 314*4kB (U) 740*8kB (U) 229*16kB (U) 123*32kB (U) 59*64kB (U) 16*128kB (U) 5*256kB (U) 9*512kB (U) 2*1024kB (U) 7*2048kB (U) 0*4096kB 0*8192kB 0*16384kB 0*32768kB 0*65536kB = 428B
[  288.230000] 10422 total pagecache pages                                                                                                                                                                
[  288.230000] 32768 pages RAM                                                                                                                                                                            
[  288.240000] 0 pages HighMem/MovableOnly                                                                                                                                                                
[  288.240000] 3063 pages reserved                                                                                                                                                                        
[  288.240000] 0 pages cma reserved                                                                                                                                                                       
[  288.240000] atmel_isc f0008000.isc: dma_alloc_coherent of size 2621440 failed

Code: Select all

[    0.000000] Booting Linux on physical CPU 0x0                                                                                                                                                          
[    0.000000] Linux version 4.19.78-linux4sam-6.2-00035-ge646810badca-dirty (oe-user@oe-host) (gcc version 8.3.0 (GCC)) #1 Wed Feb 19 12:40:09 UTC 2020                                                  
[    0.000000] CPU: ARMv7 Processor [410fc051] revision 1 (ARMv7), cr=10c53c7d                                                                                                                            
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache                                                                                                                   
[    0.000000] OF: fdt: Machine model: aQsi Cube rev.A ISO7816                                                                                                                                            
[    0.000000] Memory policy: Data cache writeback                                                                                                                                                        
[    0.000000] cma: Failed to reserve 64 MiB                                                                                                                                                              
[    0.000000] On node 0 totalpages: 32768                                                                                                                                                                
[    0.000000]   Normal zone: 288 pages used for memmap                                                                                                                                                   
[    0.000000]   Normal zone: 0 pages reserved                                                                                                                                                            
[    0.000000]   Normal zone: 32768 pages, LIFO batch:7                                                                                                                                                   
[    0.000000] CPU: All CPU(s) started in SVC mode.                                                                                                                                                       
[    0.000000] random: get_random_bytes called from 0xc0a00904 with crng_init=0                                                                                                                           
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768                                                                                                                                              
[    0.000000] pcpu-alloc: [0] 0                                                                                                                                                                          
[    0.000000] Built 1 zonelists, mobility grouping off.  Total pages: 32480                                                                                                                              
[    0.000000] Kernel command line: console=ttyS0,115200 earlyprintk log_buf_len=1M mtdparts=atmel_nand:256k(bootstrap)ro,1280k(uboot)ro,-(ubi) rootfstype=ubifs ubi.mtd=2 root=ubi0:rootfs ubi.fm_autocoM
[    0.000000] log_buf_len: 1048576 bytes                                                                                                                                                                 
[    0.000000] early log buf free: 64252(98%)                                                                                                                                                             
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)                                                                                                                             
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)                                                                                                                               
[    0.000000] Memory: 117796K/131072K available (7168K kernel code, 352K rwdata, 1344K rodata, 1024K init, 168K bss, 13276K reserved, 0K cma-reserved)                                                   
[    0.000000] Virtual kernel memory layout:                                                                                                                                                              
                   vector  : 0xffff0000 - 0xffff1000   (   4 kB)                                                                                                                                          
                   fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)                                                                                                                                          
                   vmalloc : 0xc8800000 - 0xff800000   ( 880 MB)                                                                                                                                          
                   lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)                                                                                                                                          
                   modules : 0xbf000000 - 0xc0000000   (  16 MB)                                                                                                                                          
                     .text : 0x(ptrval) - 0x(ptrval)   (8160 kB)                                                                                                                                          
                     .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)                                                                                                                                          
                     .data : 0x(ptrval) - 0x(ptrval)   ( 353 kB)                                                                                                                                          
                      .bss : 0x(ptrval) - 0x(ptrval)   ( 169 kB)                                                                                                                                          
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
gselabs
Posts: 28
Joined: Sun Feb 17, 2019 7:04 pm

Re: atmel_isc - v4l2src0:src: page allocation failure

Mon Mar 16, 2020 9:04 pm

Now I am using the default config - sama5_defconfig but without any luck.
My investigation brings me to another problem. I have found that problem is connected to rarely used configuration parameter of the ARM arch :

Code: Select all

CONFIG_FORCE_MAX_ZONEORDER=15
It is set in sama5_defconfig
Because of this any sama5 based board tries to allocate 64MiB or more for the CMA. The following code in mm/cma.c does the job:

Code: Select all

	
	/*
	 * Sanitise input arguments.
	 * Pages both ends in CMA area could be merged into adjacent unmovable
	 * migratetype page by page allocator's buddy algorithm. In the case,
	 * you couldn't get a contiguous memory, which is not what we want.
	 */
	alignment = max(alignment,  (phys_addr_t)PAGE_SIZE <<
			  max_t(unsigned long, MAX_ORDER - 1, pageblock_order));
For the at91 the PAGE_SIZE is set to 4KB in arch/arm/include/asm/page.h:

Code: Select all

/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT		12
#define PAGE_SIZE		(_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK		(~((1 << PAGE_SHIFT) - 1))
MAX_ORDER is defined in include/linux/mmzone.h and equal to CONFIG_FORCE_MAX_ZONEORDER:

Code: Select all

/* Free memory management - zoned buddy allocator.  */
#ifndef CONFIG_FORCE_MAX_ZONEORDER
#define MAX_ORDER 11
#else
#define MAX_ORDER CONFIG_FORCE_MAX_ZONEORDER
#endif
#define MAX_ORDER_NR_PAGES (1 << (MAX_ORDER - 1))
So that's why the system is trying to reserve 64MiB. One thing which I cannot understand is that SOM1-EK reserves only 16MiB with the same kernel configuration. Why ? Can anybody help me to solve the problem?
gselabs
Posts: 28
Joined: Sun Feb 17, 2019 7:04 pm

Re: atmel_isc - v4l2src0:src: page allocation failure

Tue Mar 17, 2020 10:29 am

Also I've found that when I build the poky-atmel distro for SOM1-EK board I get the following in .config file in linux-at91 build directory:

Code: Select all

CONFIG_FORCE_MAX_ZONEORDER=11
But in sama5_defconfig we have:

Code: Select all

CONFIG_FORCE_MAX_ZONEORDER=15
Yocto uses own Linux kernel config which located in

Code: Select all

meta-atmel/recipes-kernel/linux/linux-at91-4.19/sama5/defconfig
This config has

Code: Select all

CONFIG_FORCE_MAX_ZONEORDER=11
and then allocates CMA without any problem.
diffconfig between these two files gives the following result:

Code: Select all

$ ./scripts/diffconfig arch/arm/configs/sama5_defconfig ../yocto-atocha/atocha/meta-atmel/recipes-kernel/linux/linux-at91-4.19/sama5/defconfig 
-CRYPTO_ARC4 y
-CRYPTO_CCM y
-CRYPTO_GCM y
-FORCE_MAX_ZONEORDER 15
+ARM_AT91_CPUIDLE n
+BT_HCIBTUART y
+CPU_IDLE y
+FHANDLE y
+IRQ_DOMAIN_DEBUG y
+LEDS_TRIGGERS y
+SERIAL_DEV_CTRL_TTYPORT y
So why doesn't the Yocto use sama5_defconfig from linux-at91 repo?

Return to “LINUX”

Who is online

Users browsing this forum: No registered users and 1 guest