Problems allocating buffers > 4Mb (dma_alloc_coherent)
Trying to allocate some large buffers in a driver, but seem to be hitting a 4Mb limit. Research indicates this is the X86 default and needs to be increased. Temp soln is to add cma= to the boot command line arguments, which I have done, but no success.
dmesg snippets for
4Mb buff
[ 288.381972] grab data memory
[ 288.386124] Got buffers, kern1 ffff96ae9f800000, phys1 000000005f800000
kern2 ffff96ae9f400000 phys2 000000005f400000
[ 288.386177] update regs ffffa8828056c010 and ffffa8828056c014
[ 288.386178] with values now 5f800000, 5f400000
[ 288.386232] major dev 237
5Mb buff some nasty trace during the alloc
[ 445.586292] grab data memory
[ 445.588981] ------------[ cut here ]------------
[ 445.588983] WARNING: CPU: 1 PID: 3552 at mm/page_alloc.c:5361 __alloc_pages+0x208/0x230
....
[[ 445.589138] ---[ end trace 791dc27be71bed84 ]---
[ 445.589139] failed to get cpi az block
[ 445.589182] major dev 237
and 5Mb with insmod
[ 558.148610] grab data memory
[ 558.150568] failed to get memory block
[ 558.150611] major dev 237
I'm am not convinced CMA is actually running, given this from /var/log/messages
Aug 17 10:33:09 localhost kernel: Command line: BOOT_IMAGE=(hd0,gpt2)/vmlinuz-5.14.0-70.13.1.el9_0.x86_64 root=/dev/mapper/rhel-root ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb cma=128M quiet
Aug 17 10:33:09 localhost kernel: cma: Reserved 128 MiB at 0x0000000100000000
Aug 17 10:33:09 localhost kernel: Reserving 256MB of memory at 2688MB for crashkernel (System RAM: 8108MB)
Aug 17 10:33:09 localhost kernel: Zone ranges:
Aug 17 10:33:09 localhost kernel: DMA [mem 0x0000000000001000-0x0000000000ffffff]
Aug 17 10:33:09 localhost kernel: DMA32 [mem 0x0000000001000000-0x00000000ffffffff]
Aug 17 10:33:09 localhost kernel: Normal [mem 0x0000000100000000-0x000000022fffffff]
Aug 17 10:33:09 localhost kernel: Device empty
Aug 17 10:33:09 localhost kernel: Movable zone start for each node
Aug 17 10:33:09 localhost kernel: Early memory node ranges
Aug 17 10:33:09 localhost kernel: node 0: [mem 0x0000000000001000-0x000000000009ffff]
Aug 17 10:33:09 localhost kernel: node 0: [mem 0x0000000000110000-0x00000000c83dbfff]
Aug 17 10:33:09 localhost kernel: node 0: [mem 0x00000000c83e7000-0x00000000cac7cfff]
Aug 17 10:33:09 localhost kernel: node 0: [mem 0x00000000cbfcd000-0x00000000cbffffff]
Aug 17 10:33:09 localhost kernel: node 0: [mem 0x0000000100000000-0x000000022fffffff]
Aug 17 10:33:09 localhost kernel: Initmem setup node 0 [mem 0x0000000000001000-0x000000022fffffff]
Aug 17 10:33:09 localhost kernel: On node 0, zone DMA: 1 pages in unavailable ranges
Aug 17 10:33:09 localhost kernel: On node 0, zone DMA: 112 pages in unavailable ranges
Aug 17 10:33:09 localhost kernel: On node 0, zone DMA32: 11 pages in unavailable ranges
Aug 17 10:33:09 localhost kernel: On node 0, zone DMA32: 4944 pages in unavailable ranges
Aug 17 10:33:09 localhost kernel: On node 0, zone Normal: 16384 pages in unavailable ranges
Aug 17 10:33:09 localhost kernel: Kernel command line: BOOT_IMAGE=(hd0,gpt2)/vmlinuz-5.14.0-70.13.1.el9_0.x86_64 root=/dev/mapper/rhel-root ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb cma=128M quiet
Aug 17 10:33:09 localhost kernel: TECH PREVIEW: CMA may not be fully supported.#012Please review provided documentation for limitations.
Aug 17 10:33:09 localhost kernel: cma: Initial CMA usage detected
Aug 17 10:33:09 localhost dracut-cmdline[288]: Using kernel command line parameters: BOOT_IMAGE=(hd0,gpt2)/vmlinuz-5.14.0-70.13.1.el9_0.x86_64 root=/dev/mapper/rhel-root ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb cma=128M quiet
:1.2-org.gnome.Shell.HotplugSniffer@0.service.
The "TECH PREVIEW: CMA may not be fully supported" is worrying.
What did I miss?
Responses