From: Jonathan Richardson <jonathan.richardson@broadcom.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
linux-mm@kvack.org, akpm@linux-foundation.org,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
Robin Murphy <robin.murphy@arm.com>
Subject: Re: cma can't activate area on arm64
Date: Fri, 28 Feb 2020 11:56:06 -0800 [thread overview]
Message-ID: <CAHrpVsXuTEQR7GG6pS4AVjU=ABvmpec7wx3trZuoHz1yf97SVw@mail.gmail.com> (raw)
In-Reply-To: <20200227174838.GI3281767@arrakis.emea.arm.com>
On Thu, Feb 27, 2020 at 9:48 AM Catalin Marinas <catalin.marinas@arm.com> wrote:
>
> On Thu, Feb 27, 2020 at 10:56:12AM +0100, Vlastimil Babka wrote:
> > On 2/22/20 12:42 AM, Jonathan Richardson wrote:
> > > As of the 5.5 kernel I see boot errors in cma. It reserves 1G and then can't
> > > activate an area. I added some prints. It's trying to activate the DMA
> > > zone. This causes a driver to fail allocating a dma pool later on. The
> > > coherent pool is the default 256MB. If I reduce cma from 1G to 512M
> > > then it only tries activates DMA32 zone. I assume there was not enough cma
> > > memory for DMA zone? Are there any configuration changes required due
> > > to the DMA_ZONE and DMA_ZONE32 changes? I've attached my boot log.
> >
> > I think this question is better for the ARM guys. CC'd
>
> With commit 1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32"), we
> limited ZONE_DMA to 1G to accommodate the RPi4 requirements. ZONE_DMA32
> spans to the end of the 32-bit space. So with a CMA region that goes
> across the 1st GB, you'd hit this problem.
>
> The dma_contiguous_reserve() call in arm64 uses ZONE_DMA32 as the upper
> limit under the assumption that you don't need CMA in ZONE_DMA. But this
> one doesn't have a lower limit.
>
> What platform is this and how to you request the CMA size (cmdline)?
This is stingray (arch/arm64/boot/dts/broadcom/stingray/bcm958742k.dts).
cma is specified on cmdline as "cma=1G". The full boot log was in the
attachment.
Do
> you use a fixed base? Also, do you want the CMA in ZONE_DMA or
> ZONE_DMA32?
I'm not sure which zone we want it in. I'm assuming ZONE_DMA32. Before
that change there was only one zone. If I disable ZONE_DMA I don't see
the error, though I haven't tested anything. I don't really understand why
ZONE_DMA is enabled by default if it's a requirement for Rpi only. I'm
assuming it should work as is with both zones enabled but not clear how
cma spans the two zones. Was there a reason for having both zones
enabled as the default?
>
> > > [ 0.000000] cma: Reserved 1024 MiB at 0x00000000a0000000
> > > ...
> > > [ 0.390448] Activating cma name: reserved, zone name: DMA
> > > [ 0.396564] pfn = 0xa0000
> > > [ 0.399522] cma->count = 262144
> > > [ 0.406244] pfn failed on = c0000
> > > [ 0.410002] cma: CMA area reserved could not be activated
> > >
> > > static int __init cma_activate_area(struct cma *cma)
> > > {
> > > ...
> > > printk("Activating cma name: %s, zone name: %s\n", cma->name, zone->name);
> > > printk("pfn = 0x%lx\n", pfn);
> > > printk("cma->count = %lu\n", cma->count);
> > >
> > > do {
> > > unsigned j;
> > >
> > > base_pfn = pfn;
> > > for (j = pageblock_nr_pages; j; --j, pfn++) {
> > > WARN_ON_ONCE(!pfn_valid(pfn));
> > > /*
> > > * alloc_contig_range requires the pfn range
> > > * specified to be in the same zone. Make this
> > > * simple by forcing the entire CMA resv range
> > > * to be in the same zone.
> > > */
> > > if (page_zone(pfn_to_page(pfn)) != zone) {
> > > printk("pfn failed on = 0x%lx\n", pfn);
> > > goto not_in_zone;
>
> So I guess it's this test that fails as the CMA now spans ZONE_DMA and
> ZONE_DMA32.
Yes it fails here.
next prev parent reply other threads:[~2020-02-28 19:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-21 23:42 Jonathan Richardson
2020-02-27 9:56 ` Vlastimil Babka
2020-02-27 17:48 ` Catalin Marinas
2020-02-28 19:56 ` Jonathan Richardson [this message]
2020-02-28 20:16 ` Nicolas Saenz Julienne
2020-02-28 20:34 ` Jonathan Richardson
2020-02-28 21:00 ` Robin Murphy
2020-02-28 23:04 ` Jonathan Richardson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHrpVsXuTEQR7GG6pS4AVjU=ABvmpec7wx3trZuoHz1yf97SVw@mail.gmail.com' \
--to=jonathan.richardson@broadcom.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=nsaenzjulienne@suse.de \
--cc=robin.murphy@arm.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox