* [PATCH] mm: export cma alloc and release
@ 2019-10-02 21:22 Mark Salyzyn
2019-10-03 8:55 ` Catalin Marinas
0 siblings, 1 reply; 6+ messages in thread
From: Mark Salyzyn @ 2019-10-02 21:22 UTC (permalink / raw)
To: linux-kernel
Cc: kernel-team, Mark Salyzyn, Andrew Morton, Yue Hu, Mike Rapoport,
Catalin Marinas, Will Deacon, Thomas Gleixner, Ryohei Suzuki,
Doug Berger, Andrey Konovalov, Peng Fan, linux-mm
Some drivers can not be turned into a module without cma_alloc and
cma_release exported. Examples include ion, and we also found some
out of tree infiniband and camera drivers.
Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Cc: kernel-team@android.com
Cc: linux-kernel@vger.kernel.org
---
mm/cma.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/cma.c b/mm/cma.c
index 7fe0b8356775..65d830eea3b1 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -500,6 +500,7 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
pr_debug("%s(): returned %p\n", __func__, page);
return page;
}
+EXPORT_SYMBOL_GPL(cma_alloc);
/**
* cma_release() - release allocated pages
@@ -533,6 +534,7 @@ bool cma_release(struct cma *cma, const struct page *pages, unsigned int count)
return true;
}
+EXPORT_SYMBOL_GPL(cma_release);
int cma_for_each_area(int (*it)(struct cma *cma, void *data), void *data)
{
--
2.23.0.581.g78d2f28ef7-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] mm: export cma alloc and release
2019-10-02 21:22 [PATCH] mm: export cma alloc and release Mark Salyzyn
@ 2019-10-03 8:55 ` Catalin Marinas
2019-10-05 8:37 ` Christoph Hellwig
0 siblings, 1 reply; 6+ messages in thread
From: Catalin Marinas @ 2019-10-03 8:55 UTC (permalink / raw)
To: Mark Salyzyn
Cc: linux-kernel, kernel-team, Andrew Morton, Yue Hu, Mike Rapoport,
Will Deacon, Thomas Gleixner, Ryohei Suzuki, Doug Berger,
Andrey Konovalov, Peng Fan, linux-mm, Christoph Hellwig,
Robin Murphy
On Wed, Oct 02, 2019 at 02:22:48PM -0700, Mark Salyzyn wrote:
> Some drivers can not be turned into a module without cma_alloc and
> cma_release exported. Examples include ion, and we also found some
> out of tree infiniband and camera drivers.
>
> Signed-off-by: Mark Salyzyn <salyzyn@android.com>
> Cc: kernel-team@android.com
> Cc: linux-kernel@vger.kernel.org
> ---
> mm/cma.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/mm/cma.c b/mm/cma.c
> index 7fe0b8356775..65d830eea3b1 100644
> --- a/mm/cma.c
> +++ b/mm/cma.c
> @@ -500,6 +500,7 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
> pr_debug("%s(): returned %p\n", __func__, page);
> return page;
> }
> +EXPORT_SYMBOL_GPL(cma_alloc);
>
> /**
> * cma_release() - release allocated pages
> @@ -533,6 +534,7 @@ bool cma_release(struct cma *cma, const struct page *pages, unsigned int count)
>
> return true;
> }
> +EXPORT_SYMBOL_GPL(cma_release);
Aren't drivers supposed to use the DMA API for such allocations rather
than invoking cma_*() directly?
--
Catalin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mm: export cma alloc and release
2019-10-03 8:55 ` Catalin Marinas
@ 2019-10-05 8:37 ` Christoph Hellwig
2019-10-07 16:50 ` Mark Salyzyn
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2019-10-05 8:37 UTC (permalink / raw)
To: Catalin Marinas
Cc: Mark Salyzyn, linux-kernel, kernel-team, Andrew Morton, Yue Hu,
Mike Rapoport, Will Deacon, Thomas Gleixner, Ryohei Suzuki,
Doug Berger, Andrey Konovalov, Peng Fan, linux-mm,
Christoph Hellwig, Robin Murphy
On Thu, Oct 03, 2019 at 09:55:28AM +0100, Catalin Marinas wrote:
> Aren't drivers supposed to use the DMA API for such allocations rather
> than invoking cma_*() directly?
Yes, they are.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mm: export cma alloc and release
2019-10-05 8:37 ` Christoph Hellwig
@ 2019-10-07 16:50 ` Mark Salyzyn
2019-10-07 16:53 ` Christoph Hellwig
0 siblings, 1 reply; 6+ messages in thread
From: Mark Salyzyn @ 2019-10-07 16:50 UTC (permalink / raw)
To: Christoph Hellwig, Catalin Marinas
Cc: linux-kernel, kernel-team, Andrew Morton, Yue Hu, Mike Rapoport,
Will Deacon, Thomas Gleixner, Ryohei Suzuki, Doug Berger,
Andrey Konovalov, Peng Fan, linux-mm, Robin Murphy
On 10/5/19 1:37 AM, Christoph Hellwig wrote:
> On Thu, Oct 03, 2019 at 09:55:28AM +0100, Catalin Marinas wrote:
>> Aren't drivers supposed to use the DMA API for such allocations rather
>> than invoking cma_*() directly?
> Yes, they are.
We have an engineer assigned to rewriting the ion memory driver to use
dma_buf interfaces. Hopefully that effort will solve the problem of
requiring these interfaces to be exported so that that driver (and
others) can be modularized.
Thanks for the reviews, drop this patch from the list and we will
regroup, and accept that standing code in the kernel can not be
modularized for the moment.
Sincerely -- Mark Salyzyn
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mm: export cma alloc and release
2019-10-07 16:50 ` Mark Salyzyn
@ 2019-10-07 16:53 ` Christoph Hellwig
2019-10-07 17:06 ` Mark Salyzyn
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2019-10-07 16:53 UTC (permalink / raw)
To: Mark Salyzyn
Cc: Christoph Hellwig, Catalin Marinas, linux-kernel, kernel-team,
Andrew Morton, Yue Hu, Mike Rapoport, Will Deacon,
Thomas Gleixner, Ryohei Suzuki, Doug Berger, Andrey Konovalov,
Peng Fan, linux-mm, Robin Murphy
On Mon, Oct 07, 2019 at 09:50:31AM -0700, Mark Salyzyn wrote:
> On 10/5/19 1:37 AM, Christoph Hellwig wrote:
>> On Thu, Oct 03, 2019 at 09:55:28AM +0100, Catalin Marinas wrote:
>>> Aren't drivers supposed to use the DMA API for such allocations rather
>>> than invoking cma_*() directly?
>> Yes, they are.
>
> We have an engineer assigned to rewriting the ion memory driver to use
> dma_buf interfaces. Hopefully that effort will solve the problem of
> requiring these interfaces to be exported so that that driver (and others)
> can be modularized.
>
> Thanks for the reviews, drop this patch from the list and we will regroup,
> and accept that standing code in the kernel can not be modularized for the
> moment.
How is that different from the "DMA-BUF Heaps (destaging ION)" series
floating around?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mm: export cma alloc and release
2019-10-07 16:53 ` Christoph Hellwig
@ 2019-10-07 17:06 ` Mark Salyzyn
0 siblings, 0 replies; 6+ messages in thread
From: Mark Salyzyn @ 2019-10-07 17:06 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Catalin Marinas, linux-kernel, kernel-team, Andrew Morton,
Yue Hu, Mike Rapoport, Will Deacon, Thomas Gleixner,
Ryohei Suzuki, Doug Berger, Andrey Konovalov, Peng Fan, linux-mm,
Robin Murphy
On 10/7/19 9:53 AM, Christoph Hellwig wrote:
> On Mon, Oct 07, 2019 at 09:50:31AM -0700, Mark Salyzyn wrote:
>> On 10/5/19 1:37 AM, Christoph Hellwig wrote:
>>> On Thu, Oct 03, 2019 at 09:55:28AM +0100, Catalin Marinas wrote:
>>>> Aren't drivers supposed to use the DMA API for such allocations rather
>>>> than invoking cma_*() directly?
>>> Yes, they are.
>> We have an engineer assigned to rewriting the ion memory driver to use
>> dma_buf interfaces. Hopefully that effort will solve the problem of
>> requiring these interfaces to be exported so that that driver (and others)
>> can be modularized.
>>
>> Thanks for the reviews, drop this patch from the list and we will regroup,
>> and accept that standing code in the kernel can not be modularized for the
>> moment.
> How is that different from the "DMA-BUF Heaps (destaging ION)" series
> floating around?
IDK, I am asking around because I am only superficially aware of that
effort. Please view this as the left hand does not know what the right
hand is doing. My issue was with a series of out-of-tree drivers that
use the calls, and noted that currently the ion driver is using them as
well, as rationalization for a 'user' for the export. I am pushing back
on those out-of-tree drivers to switch their CMA interfaces to a modern
approach as a result of these reviews; the result of this review had a
positive effect because I was considering exporting them in the Android
distro as a minimum, and now I am soundly rejecting that approach.
Sincerely -- Mark Salyzyn
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-10-07 17:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-02 21:22 [PATCH] mm: export cma alloc and release Mark Salyzyn
2019-10-03 8:55 ` Catalin Marinas
2019-10-05 8:37 ` Christoph Hellwig
2019-10-07 16:50 ` Mark Salyzyn
2019-10-07 16:53 ` Christoph Hellwig
2019-10-07 17:06 ` Mark Salyzyn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).