From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3DF17C433EF for ; Sat, 8 Jan 2022 22:49:52 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1n6KWk-0003CR-S7; Sat, 08 Jan 2022 17:49:34 -0500 Received: from mail-yb1-xb34.google.com ([2607:f8b0:4864:20::b34]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1n6KWg-0003Bt-Jo for kernelnewbies@kernelnewbies.org; Sat, 08 Jan 2022 17:49:30 -0500 Received: by mail-yb1-xb34.google.com with SMTP id h14so10209247ybe.12 for ; Sat, 08 Jan 2022 14:49:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HykR2Vp+kAsiQCbcdlFoYlWo/1Pj0SCD9GdzQFuNJyo=; b=JrmVQO16g8Lp4xCpmQoGozt24BmTOI52VFK/rcF34uwazrrKfHfjnOwEs18bBk+C3J 3Iv32b5lqbD9SjszcrAihAWkHjENS8blBhhKzC7J5uFD7hXnGpIiv6mQWJMgnNhHOzVb //hqcwat7pypBSP05OkuFiWEPojxmewZUOyrAATF7Myo8L+JjcOwFbDLyRvy4T/GWdII tVABP4PUdPUMatsN7352E2rwnYM5p3Rq+St6qs/voWKZW46KBXRRu2AHU8fBhl+F6/zz hO3qoAq1SSo+2p9tSU+4hxERJlETJe3rpgutHBH3kODAJh4wKHv/eWUoFWsTtPpcLZxG z0og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HykR2Vp+kAsiQCbcdlFoYlWo/1Pj0SCD9GdzQFuNJyo=; b=4/LgWn7hK5A1pc83gWJZCqW/EbKZ7wDB8snGBrEHm/WKZy2ZfiSFpi+CF/GEhsJhi/ sqcOL9VM+NACANUTRNkipvyjmsYSRPru4ecQ7lSjaUZjAkYY65j1B57JpCRKamNqXBVe G8vIDltO5UBuekLlz5xff4z2uwCdx5RlECgWg21IIAWfH7rL5uhcHgh+aryqDeiYdZYz O7QnA0jsIyGx2q70Y5KloBY5uKxu3xp1gBafvc7Li9yJ2zikPD24XvQ1AQ2zHehcMuNB WzBzSigYTojA/aoxDZOOfxFt6H/Q9BFWm7ttdaKtSqY6LowVvof+AYc+Ng3zOKiz/8BW U3MA== X-Gm-Message-State: AOAM531SMgPnwj5ZrZzCTZsjey3hTZwsT42J4PfRAiQfwrTgs1o6nP+U 90l7pYZ9zYeQlAHJEJIgL4iMfKiv/4KVeiZL820= X-Google-Smtp-Source: ABdhPJz496RXbIlqUIbo/K289LZG8l9ZHl/7lsVji4UNcpoWNJjvvsj1E3c7e1JTTfjIdFxw4Vr9R2Vjo5C9wKMPMkA= X-Received: by 2002:a25:bbc7:: with SMTP id c7mr82971114ybk.725.1641682169410; Sat, 08 Jan 2022 14:49:29 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Sadanand Warrier Date: Sat, 8 Jan 2022 17:49:18 -0500 Message-ID: Subject: Re: Contiguous Memory Allocator (CMA) To: FMDF Cc: kernelnewbies X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============4681859778829622707==" Errors-To: kernelnewbies-bounces@kernelnewbies.org --===============4681859778829622707== Content-Type: multipart/alternative; boundary="0000000000008ab89205d519ea18" --0000000000008ab89205d519ea18 Content-Type: text/plain; charset="UTF-8" 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 >> > >> > --0000000000008ab89205d519ea18 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello Fabio,
I haven't do= ne it because I haven't had time and CONFIG_DMA_CMA has not been enable= d in the kernel I was fooling with. Yes I do know how to build the kernel.= =C2=A0
Thanks for all the help. Once I get it workin= g=C2=A0I'll let you know.
Cheerio
S

On Sat, Jan 8, 2022, 17:14 FMDF <fmdefrancesco@gmail.com> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex">
On Sat, 8 Jan 2022, 14:37 Sadana= nd Warrier, <sadanandwarrier@gmail.com> wrote:
Hello Fabio
=C2=A0 =C2=A0Thanks 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=3D128M 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 faile= d.
It seems that default CentOS and perhaps Ubuntu kernels are not
compiled with CONFIG_DMA_CMA=3Dyes 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=3Dyes and
CONFIG_DMA_CMA=3Dyes 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=C2=A0 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 enabl= ed. Or you may use directly "make menuconfig" and search with its= special keys. Then "make -jN && sudo make modules_install ins= tall" (and hope that installkernel is not broken like it has been in o= penSUSE Tumbleweed for weeks).=C2=A0 :(

I'm not an expert about this particular subject, so if = they have already been=C2=A0 enabled I cannot help you with more than the a= bove information. That article in lwn.net is everything I've studied about thi= s subject and I haven't ever used it in kernel programming.

Regards,
Fabio M. De Francesco=C2=A0


Thanks
S


On Sat, 8 Jan 2022 at 07:23, FMDF <fmdefrancesco@gmail.c= om> wrote:
>
> On Tue, 21 Dec 2021, 15:36 Sadanand Warrier, <sad= anandwarrier@gmail.com> wrote:
>>
>> Hello
>>=C2=A0 =C2=A0 =C2=A0Is CMA still supported as described in this doc= ument
>> 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
>
--0000000000008ab89205d519ea18-- --===============4681859778829622707== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --===============4681859778829622707==--