Re: [PATCH v4 1/2] dma-direct: provide the ability to reserve per-numa CMA

Christoph Hellwig
2020-07-28T12:22:51Z

On Tue, Jul 28, 2020 at 12:19:03PM +0000, Song Bao Hua (Barry Song) wrote:
> I am sorry I haven't got your point yet. Do you mean something like the below?
>
> arch/arm64/Kconfig:
> config CMDLINE
> string "Default kernel command string"
> - default ""
> + default "pernuma_cma=16M"
> help
> Provide a set of default command-line options at build time by
> entering them here. As a minimum, you should specify the the
> root device (e.g. root=/dev/nfs).

Yes.

> A background of the current code is that Linux distributions can usually use arch/arm64/configs/defconfig
> directly to build kernel. cmdline can be easily ignored during the generation of Linux distributions.

I've not actually heard of a distro shipping defconfig yet..

>
> > if a way to expose this in the device tree might be useful, but people
> > more familiar with the device tree and the arm code will have to chime
> > in on that.
>
> Not sure if it is an useful user case as we are using ACPI but not device tree since it is an ARM64
> server with NUMA.

Well, than maybe ACPI experts need to chime in on this.

> > This seems to have lost the dma_contiguous_default_area NULL check.
>
> cma_alloc() is doing the check by returning NULL if cma is NULL.
>
> struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
> bool no_warn)
> {
> ...
> if (!cma || !cma->count)
> return NULL;
> }
>
> But I agree here the code can check before calling cma_alloc_aligned.

Oh, indeed. Please split the removal of the NULL check in to a prep
patch then.