From: Robin Murphy <robin.murphy@arm.com>
To: dann frazier <dann.frazier@canonical.com>,
Christoph Hellwig <hch@lst.de>
Cc: iommu@lists.linux-foundation.org,
Xinwei Kong <kong.kongxinwei@hisilicon.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [RFC] arm64: swiotlb: cma_alloc error spew
Date: Tue, 23 Apr 2019 12:32:41 +0100 [thread overview]
Message-ID: <fa287dc4-59e9-0500-70ee-e96c2920d5a9@arm.com> (raw)
In-Reply-To: <20190417204817.GA28897@xps13.dannf>
On 17/04/2019 21:48, dann frazier wrote:
> hey,
> I'm seeing an issue on a couple of arm64 systems[*] where they spew
> ~10K "cma: cma_alloc: alloc failed" messages at boot. The errors are
> non-fatal, and bumping up cma to a large enough size (~128M) gets rid
> of them - but that seems suboptimal. Bisection shows that this started
> after commit fafadcd16595 ("swiotlb: don't dip into swiotlb pool for
> coherent allocations"). It looks like __dma_direct_alloc_pages()
> is opportunistically using CMA memory but falls back to non-CMA if CMA
> disabled or unavailable. I've demonstrated that this fallback is
> indeed returning a valid pointer. So perhaps the issue is really just
> the warning emission.
The CMA area being full isn't necessarily an ignorable non-problem,
since it means you won't be able to allocate the kind of large buffers
for which CMA was intended. The question is, is it actually filling up
with allocations that deserve to be there, or is this the same as I've
seen on a log from a ThunderX2 system where it's getting exhausted by
thousands upon thousands of trivial single page allocations? If it's the
latter (CONFIG_CMA_DEBUG should help shed some light if necessary), then
that does lean towards spending a bit more effort on this idea:
https://lore.kernel.org/lkml/20190327080821.GB20336@lst.de/
Robin.
> The following naive patch solves the problem for me - just silence the
> cma errors, since it looks like a soft error. But is there a better
> approach?
>
> [*] APM X-Gene & HiSilicon Hi1620 w/ SMMU disabled
>
> diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
> index 6310ad01f915b..0324aa606c173 100644
> --- a/kernel/dma/direct.c
> +++ b/kernel/dma/direct.c
> @@ -112,7 +112,7 @@ struct page *__dma_direct_alloc_pages(struct device *dev, size_t size,
> /* CMA can be used only in the context which permits sleeping */
> if (gfpflags_allow_blocking(gfp)) {
> page = dma_alloc_from_contiguous(dev, count, page_order,
> - gfp & __GFP_NOWARN);
> + true);
> if (page && !dma_coherent_ok(dev, page_to_phys(page), size)) {
> dma_release_from_contiguous(dev, page, count);
> page = NULL;
>
>
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-04-23 11:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-17 20:48 [RFC] arm64: swiotlb: cma_alloc error spew dann frazier
2019-04-23 11:32 ` Robin Murphy [this message]
2019-04-23 18:03 ` dann frazier
2019-04-24 0:39 ` dann frazier
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=fa287dc4-59e9-0500-70ee-e96c2920d5a9@arm.com \
--to=robin.murphy@arm.com \
--cc=dann.frazier@canonical.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=kong.kongxinwei@hisilicon.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
/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