mm: export cma alloc and release
Subsystems (2)
PATCH 1/1 mm: export cma alloc and release
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.
--- mm/cma.c | 2 ++ 1 file changed, 2 insertions(+)
mm/cma.c +2 -0
@@ -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) {
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
Quoted 24 lines · Mark Salyzyn
Some drivers can not be turned into a module without
cma_allocandcma_releaseexported. Examples include ion, and we also found some out of tree infiniband and camera drivers.--- mm/cma.c | 2 ++ 1 file changed, 2 insertions(+)mm/cma.c +1
-0@@ -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
mm/cma.c bool cma_release(struct cma *cma, const struct page *pages, unsigned int count) · line 537
Quoted 4 lines
mm/cma.c +1
-0@@ -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?
Signature · 1 line
Catalin
Quoted 2 lines · Catalin Marinas
Aren't drivers supposed to use the DMA API for such allocations rather than invoking cma_*() directly?
Yes, they are.
Quoted 4 lines · Christoph Hellwig
Quoted 2 lines · Catalin Marinas
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
Quoted 6 lines · Mark Salyzyn
Quoted 4 lines · Christoph Hellwig
Quoted 2 lines · Catalin Marinas
Aren't drivers supposed to use the DMA API for such allocations rather than invoking cma_*() directly?
Yes, they are.
Quoted 8 lines
We have an engineer assigned to rewriting the ion memory driver to use
dma_bufinterfaces. 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?
Quoted 11 lines · Christoph Hellwig
Quoted 10 lines · Mark Salyzyn
Quoted 4 lines · Christoph Hellwig
Quoted 2 lines · Catalin Marinas
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_bufinterfaces. Hopefully that effort will solve the problem of requiring these interfaces to be exported so that that driver (and others) can be modularized.
Quoted 5 lines
Quoted 3 lines
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