How can I reserve contiguous mem alloc region?
Chan Kim
ckim at etri.re.kr
Tue Jan 3 03:48:16 EST 2023
Hi, all,
I was able to get cma-reserved region by adding CONFIG_DMA_CMA=y.
This is the result.
Memory: 233708K/1048576K available (3200K kernel code, 386K rwdata, 808K
rodata, 7808K init, 105K bss, 28436K reserved, 786432K cma-reserved)
Thanks!
Chan Kim
>-----Original Message-----
>From: Chan Kim <ckim at etri.re.kr>
>Sent: Tuesday, January 3, 2023 2:36 PM
>To: kernelnewbies at kernelnewbies.org
>Subject: How can I reserve contiguous mem alloc region?
>
>Hello kernel experts and users,
>
>I wanted to test cma-allocator in linux (5.15.68).
>So I added linux,cma node in the /reserved-memory node like this.
>
> reserved-memory {
> #address-cells = <2>;
> #size-cells = <2>;
> ranges;
>
> axpu_reserved_mem: axpursvd at 90000000 {
> no-map;
> reg = <0x0 0xc0000000 0x0 0x8000000>;
> };
>
> linux,cma {
> compatible = "shared-dma-pool";
> reusable;
> size = <0 0x30000000>;
> alloc-ranges = <0 0x90000000 0 0x30000000>;
> linux,cma-default;
> };
> };
>
>BTW, this test was done on qemu arm64 machine and there is only 1GB ram
>(from 0x80000000 ~ 0xbfffffff) in the virtual machine, and notice I'm
>assigning 3/4 of the ram to cma region and 1/8 to a device driver (just for
>test).
>
>When I boot the machine, I see this message during the boot.
>
> Memory: 1020140K/1048576K available (3200K kernel code, 386K rwdata,
>808K rodata, 7808K init, 106K bss, 28436K reserved, 0K cma-reserved)
>
>Why is the CMA-reserved area is 0KB?
>This is some config variables I added for CMA test.
>
> CONFIG_MEMORY_ISOLATION=y
> CONFIG_CONTIG_ALLOC=y
> ONFIG_CMA=y
> CONFIG_CMA_DEBUG=y
> CONFIG_CMA_DEBUGFS=y
> CONFIG_CMA_SYSFS=y
> CONFIG_CMA_AREAS=7
> # CONFIG_DMA_CMA is not set
>
>I tried adding 'cma=768MB' in the boot args or changed CONFIG_CMA_AREAS to
1
>but it is the same.
>What am I missing??
>
>Thank you.
>
>Chan Kim
More information about the Kernelnewbies
mailing list