Re: Contiguous Memory Allocator (CMA)

2022-01-08 Thread Sadanand Warrier
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  wrote:

> On Sat, 8 Jan 2022, 14:37 Sadanand Warrier, 
> 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  wrote:
>> >
>> > On Tue, 21 Dec 2021, 15:36 Sadanand Warrier, 
>> 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


Re: Contiguous Memory Allocator (CMA)

2022-01-08 Thread FMDF
On Sat, 8 Jan 2022, 14:37 Sadanand Warrier, 
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  wrote:
> >
> > On Tue, 21 Dec 2021, 15:36 Sadanand Warrier, 
> 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


Re: Contiguous Memory Allocator (CMA)

2022-01-08 Thread Sadanand Warrier
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  wrote:
>
> On Tue, 21 Dec 2021, 15:36 Sadanand Warrier,  
> 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


Re: Contiguous Memory Allocator (CMA)

2022-01-08 Thread FMDF
On Tue, 21 Dec 2021, 15:36 Sadanand Warrier, 
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


Contiguous Memory Allocator (CMA)

2021-12-21 Thread Sadanand Warrier
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
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Contiguous memory allocator

2016-03-26 Thread Manoj Nayak
  cma_declare_contiguous() allocates memory from memblock.
 cma_init_reserved_mem() initialize the memory. Then the memory is given to
buddy allocator with migration type MIGRATE_MOVABLE. when CMA needs
thosepages, it can take it from buddy allocator.

  We are supposed to use equivalent DMA api dma_declare_contiguous().
dma_declare_contiguous() calls cma_declare_contiguous().

http://lxr.free-electrons.com/source/arch/arm/mach-davinci/devices-da8xx.c#L833

   Regards
Manoj Nayak
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Contiguous memory allocator

2016-03-12 Thread Ronit Halder
What is the difference between function cma_init_reserved_mem() and
cma_declare_contiguous()?

If I am trying to allocate new CMA area at boot time, How to do that?

regards,
Ronit

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies