* Contiguous Memory Allocator (CMA) @ 2021-12-21 14:35 Sadanand Warrier 2022-01-08 12:22 ` FMDF 0 siblings, 1 reply; 5+ messages in thread From: Sadanand Warrier @ 2021-12-21 14:35 UTC (permalink / raw) To: kernelnewbies [-- Attachment #1.1: Type: text/plain, Size: 535 bytes --] Hello Is CMA still supported as described in this document https://lwn.net/Articles/396707/ ? Or has it changed and there is a newer version which details how to allocate a chunk of contiguous memory on bootup and then use it with a loadable kernel module? What I want to do is allocate a chunk of contiguous memory at boot time and use it with a loadable driver. It will be a vanilla Centos kernel and I wonder if they are compiled with the CMA enabled. When I check dmesg I see " 0K cma-reserved" so it still exists. Thanks S [-- Attachment #1.2: Type: text/html, Size: 749 bytes --] [-- Attachment #2: Type: text/plain, Size: 170 bytes --] _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Contiguous Memory Allocator (CMA) 2021-12-21 14:35 Contiguous Memory Allocator (CMA) Sadanand Warrier @ 2022-01-08 12:22 ` FMDF 2022-01-08 13:37 ` Sadanand Warrier 0 siblings, 1 reply; 5+ messages in thread From: FMDF @ 2022-01-08 12:22 UTC (permalink / raw) To: Sadanand Warrier; +Cc: kernelnewbies [-- Attachment #1.1: Type: text/plain, Size: 354 bytes --] On Tue, 21 Dec 2021, 15:36 Sadanand Warrier, <sadanandwarrier@gmail.com> wrote: > Hello > Is CMA still supported as described in this document > https://lwn.net/Articles/396707/ ? > Yes, it is. Read the following instructions on how to use that feature: "A deep dive into CMA" at https://lwn.net/Articles/486301/ Regards, Fabio M. De Francesco [-- Attachment #1.2: Type: text/html, Size: 1096 bytes --] [-- Attachment #2: Type: text/plain, Size: 170 bytes --] _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Contiguous Memory Allocator (CMA) 2022-01-08 12:22 ` FMDF @ 2022-01-08 13:37 ` Sadanand Warrier 2022-01-08 22:14 ` FMDF 0 siblings, 1 reply; 5+ messages in thread From: Sadanand Warrier @ 2022-01-08 13:37 UTC (permalink / raw) To: FMDF; +Cc: kernelnewbies Hello Fabio Thanks for the response. I had already accessed that link that you have pasted. Michal Nazarewicz also has a few other points on using CMA. When I tried to use the API after setting cma=128M on the kernel boot command line and booted the kernel, the api returned without allocating memory when the driver was installed. The dmesg shows that 128M was reserved for CMA but dma_alloc_coherent failed. It seems that default CentOS and perhaps Ubuntu kernels are not compiled with CONFIG_DMA_CMA=yes for the dma_alloc_coherent to work. I'm not sure if this is a valid assumption. I haven't tried recompiling the kernel yet with that option set. From what I have managed to eke out we need CONFIG_CMA=yes and CONFIG_DMA_CMA=yes too. Thanks S On Sat, 8 Jan 2022 at 07:23, FMDF <fmdefrancesco@gmail.com> wrote: > > On Tue, 21 Dec 2021, 15:36 Sadanand Warrier, <sadanandwarrier@gmail.com> wrote: >> >> Hello >> Is CMA still supported as described in this document >> https://lwn.net/Articles/396707/ ? > > > Yes, it is. > > Read the following instructions on how to use that feature: > > "A deep dive into CMA" at > https://lwn.net/Articles/486301/ > > Regards, > > Fabio M. De Francesco > _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Contiguous Memory Allocator (CMA) 2022-01-08 13:37 ` Sadanand Warrier @ 2022-01-08 22:14 ` FMDF 2022-01-08 22:49 ` Sadanand Warrier 0 siblings, 1 reply; 5+ messages in thread From: FMDF @ 2022-01-08 22:14 UTC (permalink / raw) To: Sadanand Warrier; +Cc: kernelnewbies [-- Attachment #1.1: Type: text/plain, Size: 2312 bytes --] On Sat, 8 Jan 2022, 14:37 Sadanand Warrier, <sadanandwarrier@gmail.com> wrote: > Hello Fabio > Thanks for the response. I had already accessed that link that you > have pasted. Michal Nazarewicz also has a few other points on using > CMA. > When I tried to use the API after setting cma=128M on the kernel boot > command line and booted the kernel, the api returned without > allocating memory > when the driver was installed. > The dmesg shows that 128M was reserved for CMA but dma_alloc_coherent > failed. > It seems that default CentOS and perhaps Ubuntu kernels are not > compiled with CONFIG_DMA_CMA=yes for the dma_alloc_coherent to work. > I'm not sure if this is a valid assumption. I haven't tried > recompiling the kernel yet with that option set. > From what I have managed to eke out we need CONFIG_CMA=yes and > CONFIG_DMA_CMA=yes too. > If I recall it well, I think they are needed. Why haven't you yet checked? I assume that you know how to change your .config, re-build the kernel and the modules and install everything in the right places. Don't you? > Just grep the ".config" of your distro. It should be placed in /boot/ with a name like "config-`uname -r`" or in /usr/src/linux/ with its true name (.config) and see if those options are enabled. Or you may use directly "make menuconfig" and search with its special keys. Then "make -jN && sudo make modules_install install" (and hope that installkernel is not broken like it has been in openSUSE Tumbleweed for weeks). :( I'm not an expert about this particular subject, so if they have already been enabled I cannot help you with more than the above information. That article in lwn.net is everything I've studied about this subject and I haven't ever used it in kernel programming. Regards, Fabio M. De Francesco > Thanks > S > > > On Sat, 8 Jan 2022 at 07:23, FMDF <fmdefrancesco@gmail.com> wrote: > > > > On Tue, 21 Dec 2021, 15:36 Sadanand Warrier, <sadanandwarrier@gmail.com> > wrote: > >> > >> Hello > >> Is CMA still supported as described in this document > >> https://lwn.net/Articles/396707/ ? > > > > > > Yes, it is. > > > > Read the following instructions on how to use that feature: > > > > "A deep dive into CMA" at > > https://lwn.net/Articles/486301/ > > > > Regards, > > > > Fabio M. De Francesco > > > [-- Attachment #1.2: Type: text/html, Size: 3889 bytes --] [-- Attachment #2: Type: text/plain, Size: 170 bytes --] _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Contiguous Memory Allocator (CMA) 2022-01-08 22:14 ` FMDF @ 2022-01-08 22:49 ` Sadanand Warrier 0 siblings, 0 replies; 5+ messages in thread From: Sadanand Warrier @ 2022-01-08 22:49 UTC (permalink / raw) To: FMDF; +Cc: kernelnewbies [-- Attachment #1.1: Type: text/plain, Size: 2715 bytes --] Hello Fabio, I haven't done it because I haven't had time and CONFIG_DMA_CMA has not been enabled in the kernel I was fooling with. Yes I do know how to build the kernel. Thanks for all the help. Once I get it working I'll let you know. Cheerio S On Sat, Jan 8, 2022, 17:14 FMDF <fmdefrancesco@gmail.com> wrote: > On Sat, 8 Jan 2022, 14:37 Sadanand Warrier, <sadanandwarrier@gmail.com> > wrote: > >> Hello Fabio >> Thanks for the response. I had already accessed that link that you >> have pasted. Michal Nazarewicz also has a few other points on using >> CMA. >> When I tried to use the API after setting cma=128M on the kernel boot >> command line and booted the kernel, the api returned without >> allocating memory >> when the driver was installed. >> The dmesg shows that 128M was reserved for CMA but dma_alloc_coherent >> failed. >> It seems that default CentOS and perhaps Ubuntu kernels are not >> compiled with CONFIG_DMA_CMA=yes for the dma_alloc_coherent to work. >> I'm not sure if this is a valid assumption. I haven't tried >> recompiling the kernel yet with that option set. >> From what I have managed to eke out we need CONFIG_CMA=yes and >> CONFIG_DMA_CMA=yes too. >> > > If I recall it well, I think they are needed. Why haven't you yet checked? > > I assume that you know how to change your .config, re-build the kernel and > the modules and install everything in the right places. Don't you? > >> > Just grep the ".config" of your distro. It should be placed in /boot/ > with a name like "config-`uname -r`" or in /usr/src/linux/ with its true > name (.config) and see if those options are enabled. Or you may use > directly "make menuconfig" and search with its special keys. Then "make -jN > && sudo make modules_install install" (and hope that installkernel is not > broken like it has been in openSUSE Tumbleweed for weeks). :( > > I'm not an expert about this particular subject, so if they have already > been enabled I cannot help you with more than the above information. That > article in lwn.net is everything I've studied about this subject and I > haven't ever used it in kernel programming. > > Regards, > > Fabio M. De Francesco > > >> Thanks >> S >> >> >> On Sat, 8 Jan 2022 at 07:23, FMDF <fmdefrancesco@gmail.com> wrote: >> > >> > On Tue, 21 Dec 2021, 15:36 Sadanand Warrier, <sadanandwarrier@gmail.com> >> wrote: >> >> >> >> Hello >> >> Is CMA still supported as described in this document >> >> https://lwn.net/Articles/396707/ ? >> > >> > >> > Yes, it is. >> > >> > Read the following instructions on how to use that feature: >> > >> > "A deep dive into CMA" at >> > https://lwn.net/Articles/486301/ >> > >> > Regards, >> > >> > Fabio M. De Francesco >> > >> > [-- Attachment #1.2: Type: text/html, Size: 4703 bytes --] [-- Attachment #2: Type: text/plain, Size: 170 bytes --] _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-08 22:49 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-12-21 14:35 Contiguous Memory Allocator (CMA) Sadanand Warrier 2022-01-08 12:22 ` FMDF 2022-01-08 13:37 ` Sadanand Warrier 2022-01-08 22:14 ` FMDF 2022-01-08 22:49 ` Sadanand Warrier
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.