lkml.org 
[lkml]   [2020]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] arm64: mm: make CONFIG_ZONE_DMA configurable without EXPERT
Date
> Subject: Re: [PATCH] arm64: mm: make CONFIG_ZONE_DMA configurable
> without EXPERT
>
> On Wed, Mar 25, 2020 at 12:34:15AM +0000, Peng Fan wrote:
> > > On Tue, Mar 10, 2020 at 08:48:46PM +0800, peng.fan@nxp.com wrote:
> > > > From: Peng Fan <peng.fan@nxp.com>
> > > >
> > > > commit 1a8e1cef7603 ("arm64: use both ZONE_DMA and
> ZONE_DMA32")
> > > > enables both ZONE_DMA and ZONE_DMA32. The lower 1GB memory
> will be
> > > > occupied by ZONE_DMA, this will cause CMA allocation fail on some
> > > > platforms, because CMA area could not across different type of
> > > > memory zones.
> > > >
> > > > Make CONFIG_ZONE_DMA configurable without EXPERT option could
> let
> > > > people build non debug kernel image with CONFIG_ZONE_DMA
> disabled.
> > >
> > > While I see why you need to toggle this feature, I'd rather try to
> > > figure out whether there is a better solution that does not break
> > > the single kernel image aim (i.e. the same config works for all supported
> SoCs).
> > >
> > > When we decided to go ahead with a static 1GB ZONE_DMA for
> Raspberry
> > > Pi 4, we thought that other platforms would be fine, ZONE_DMA32
> > > allocations fall back to ZONE_DMA. We missed the large CMA case.
> > >
> > > I see a few potential options:
> > >
> > > a) Ensure the CMA is contained within a single zone.
> >
> > This will break legacy dts with new version kernel.
> >
> > > How large is it in your case?
> >
> > It is 1GB
> >
> > > Is it allocated by the kernel dynamically or a fixed start set by
> > > the boot loader?
> >
> > We use alloc-ranges and size in kernel dts.
> >
> > But there is only 2GB DRAM in the board.
>
> So I guess without changing the dts, option (a) doesn't really work.
>
> > > b) Change the CMA allocator to allow spanning multiple zones (last time
> > > I looked it wasn't trivial since it relied on some per-zone lock).
> > >
> > > c) Make ZONE_DMA dynamic on arm64 and only enable it if RPi4.
> >
> > Option c seems a bit easier to me :)
> >
> > I will try to explore both, but if you have time to help, that would
> > be appreciated.
>
> I don't have time but option (c) was already discussed and there are patches
> from Nicolas on the list:
>
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.ke
> rnel.org%2Flinux-arm-kernel%2F20190820145821.27214-5-nsaenzjulienne%
> 40suse.de%2F&amp;data=02%7C01%7Cpeng.fan%40nxp.com%7C6403ddf37
> 89b452ae5ee08d7d0a5a659%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0
> %7C0%7C637207282191026738&amp;sdata=t2cZ9HTCcRuaL9RO4kD%2BzN
> 2n4VqM%2F66zYNZIOComCVs%3D&amp;reserved=0
>
> The above series was checking whether the platform is RPi4 and limiting the
> ZONE_DMA size to 1GB (otherwise 4GB with ZONE_DMA32 empty). We
> ended up with a static 1GB for ZONE_DMA but we missed the fact that it may
> break existing platforms.


Thanks for the information. I'll check the patchset and work out something
proper to fix the issue I met.

Thanks,
Peng.

>
> So I don't think it would be too hard to revive the above series (most of it was
> already merged).
>
> --
> Catalin

\
 
 \ /
  Last update: 2020-03-25 13:31    [W:0.078 / U:1.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site