Hi,
I am trying to change HugeTLB size from 256Mb to 1G.
I observe 1G page getting allocated in kernel.
[ 0.479637] HugeTLB registered 1 GB page size, pre-allocated 1 pages
[ 0.485914] HugeTLB registered 1 MB page size, pre-allocated 0 pages
[ 0.492253] HugeTLB registered 4 MB page size, pre-allocated 0 pages
[ 0.498595] HugeTLB registered 16 MB page size, pre-allocated 0 pages
[ 0.505028] HugeTLB registered 64 MB page size, pre-allocated 0 pages
[ 0.511453] HugeTLB registered 256 MB page size, pre-allocated 0 pages
/proc/sys/kernel/shmmax is also updated to 1G
Loading DSP image also fine. But any shmmat from app to allocated segment fails
===B4860QDS DSP boot Application (3.0.0) ===
SYSTEM MAP
DSP PrivArea: Addr=c0000000 Size=3ff00000
Shared CtrlArea: Addr=fff00000 Size=100000
DSP Core0 M2: Addr=0 Size=0
DSP Core1 M2: Addr=0 Size=0
DSP M3: Addr=c40000000 Size=8000
PA CCSRBAR: Addr =ffe000000 Size=1000000
DSP CCSRBAR: Addr =ffe000000 Size=1000000
PA Shared Area: Addr=80000000 Size=3f000000
DSP Shared Area: Addr=bf000000 Size=1000000
Loading Dsp image /usr/bin/L1_cu_combined.bin
.........
sleep 1, waiting for hw sem
sleep 1, waiting for hw sem
HS_MPR[1]=0xfe
HS_MPR[1]=0x0
== DSP Booted up ==
[root@0005B932EFD4 /]# ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000002 0 root 600 1073741824 0
[root@0005B932EFD4 /]# cat /proc/meminfo | grep Huge
HugePages_Total: 1
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 1048576 kB
[root@0005B932EFD4 /]#
But from App, shmat fails for same shmid/key
dsplog -c showlog -n gstLOGDebugNC
SYSTEM MAP
DSP PrivArea: Addr=c0000000 Size=3ff00000
Shared CtrlArea: Addr=fff00000 Size=100000
DSP Core0 M2: Addr=0 Size=0
DSP Core1 M2: Addr=0 Size=0
DSP M3: Addr=c40000000 Size=8000
PA CCSRBAR: Addr =ffe000000 Size=1000000
DSP CCSRBAR: Addr =ffe000000 Size=1000000
shmat: Cannot allocate memory
Shared memory attach failure: Cannot allocate memory
Segmentation fault (core dumped)
Same works for 256Mb, but only fails for 1G. So, is there any constraint or config for 1G HugeTLB.
Hello Syamala Saripalli,
Increase huge page size, just set uboot env hugepagesz=1024m
To use 1GB on PA side: Modify this in libdspboot.c,
(shared_area).pa_ipc_shared.phys_addr = (unsigned long)pa_p;
(shared_area).pa_ipc_shared.size = MB_256 - (*het_sys_map).dsp_shared_size;
(shared_area).dsp_ipc_shared.phys_addr= (unsigned long)pa_p + MB_256 - (*het_sys_map).dsp_shared_size;
And this in /fsl_shm/lib/lg_shm.c
shmid = shmget(LG_SHM_KEY, HUGE_PAGE_256M,SHM_HUGETLB | IPC_CREAT | SHM_R | SHM_W);
if (shmid<0) {
perror("shmget");
close(fd);
return NULL;
}
memset(&shm, 0, sizeof(shm_seg_t));
shm.vaddr = (__u32)shmat(shmid, 0, 0);
if (shm.vaddr == -1) {
perror("Shared memory attach failure");
shmctl(shmid, IPC_RMID, NULL);
close(fd);
return NULL;}
shm.size = HUGE_PAGE_256M - (dsp_shared_size + IPC_METADATA_AREA_SZ);
ret = ioctl(fd, IOCTL_FSL_SHM_INIT,&shm);
if (ret == -1)
You can see the total size of pa_shared+ dsp_shared = bootm_size, you can set dsp_shared_size by passing it to hetmgr.k
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------