From: Christoph Hellwig <hch@infradead.org>
To: "Gaël PORTAY" <gael.portay@collabora.com>
Cc: Laura Abbott <labbott@redhat.com>,
linux-mm@kvack.org, kernel@collabora.com,
Gabriel Krisman Bertazi <krisman@collabora.com>,
linux-arm-kernel@lists.infradead.org,
Mike Kravetz <mike.kravetz@oracle.com>
Subject: Re: [PATCH] ARM: dma-mapping: prevent writeback deadlock in CMA allocator
Date: Tue, 12 Feb 2019 10:25:11 -0800 [thread overview]
Message-ID: <20190212182511.GA10532@infradead.org> (raw)
In-Reply-To: <20190212042458.31856-1-gael.portay@collabora.com>
On Mon, Feb 11, 2019 at 11:24:58PM -0500, Gaël PORTAY wrote:
> The ARM DMA layer checks for allow blocking flag (__GFP_DIRECT_RECLAIM)
> to decide whether to go for CMA or not. That test is not sufficient to
> cover the case of writeback (GFP_NOIO).
The ARM DMA layer doesn't, the CMA helper does.
> - bool allowblock, cma;
> + bool allowblock, allowwriteback, cma;
> struct arm_dma_buffer *buf;
> struct arm_dma_alloc_args args = {
> .dev = dev,
> @@ -769,7 +769,8 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
>
> *handle = DMA_MAPPING_ERROR;
> allowblock = gfpflags_allow_blocking(gfp);
> - cma = allowblock ? dev_get_cma_area(dev) : false;
> + allowwriteback = gfpflags_allow_writeback(gfp);
> + cma = (allowblock && !allowwriteback) ? dev_get_cma_area(dev) : false;
But this only fixes ARM, but not all the user callers of
gfpflags_allow_blocking and dma_alloc_from_contiguous.
I think we just need a dma_can_alloc_from_contigous helper and
switch all callers of dma_alloc_from_contiguous to it.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2019-02-12 18:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-12 4:24 [PATCH] ARM: dma-mapping: prevent writeback deadlock in CMA allocator Gaël PORTAY
2019-02-12 18:25 ` Christoph Hellwig [this message]
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=20190212182511.GA10532@infradead.org \
--to=hch@infradead.org \
--cc=gael.portay@collabora.com \
--cc=kernel@collabora.com \
--cc=krisman@collabora.com \
--cc=labbott@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.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;
as well as URLs for NNTP newsgroup(s).