Re: [PATCH v2] dma-contiguous: define proper name for global cma region

From: Christoph Hellwig
Date: Tue Aug 01 2023 - 13:18:49 EST


On Tue, Aug 01, 2023 at 10:42:42PM +0530, Pintu Agarwal wrote:
> > I agree that reserved is not a very useful name. Unfortuately the
> > name of the region leaks to userspace through cma_heap.
> >
> > So I think we need prep patches to hardcode "reserved" in
> > add_default_cma_heap first, and then remove the cma_get_name
> > first.
>
> Sorry, but I could not fully understand your comments.
> Can you please elaborate a little more what changes are required in
> cma_heap if we change "reserved" to "global-cma-region" ?

Step 1:

Instead of setting exp_info.name to cma_get_name(cma);
in __add_cma_heap just set it to "reserved", probably by passing a name
argument. You can also remove the unused data argument to __add_cma_heap
and/or just fold that function into the only caller while you're at it.

Step 2:

Remove cma_get_name, as it is unused now.

Step 3:

The patch your previously sent.

> You mean to say there are userspace tools that rely on this "reserved"
> naming for global cma ?

Yes.