From: 陈华才 <chenhc@lemote.com>
To: "Christoph Hellwig" <hch@infradead.org>,
"Robin Murphy" <robin.murphy@arm.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"Fuxin Zhang" <zhangfx@lemote.com>, linux-mm <linux-mm@kvack.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
stable <stable@vger.kernel.org>
Subject: Re: [V5, 2/3] mm: dmapool: Align to ARCH_DMA_MINALIGN innon-coherent DMA mode
Date: Tue, 19 Sep 2017 10:23:45 +0800 [thread overview]
Message-ID: <tencent_27AD421B310F475224638DF3@qq.com> (raw)
In-Reply-To: <20170918155134.GC16672@infradead.org>
Oh, I know, I've make a mistake, dmapool doesn't need to change.
Huacai
------------------ Original ------------------
From: "Christoph Hellwig"<hch@infradead.org>;
Date: Mon, Sep 18, 2017 11:51 PM
To: "Robin Murphy"<robin.murphy@arm.com>;
Cc: "Huacai Chen"<chenhc@lemote.com>; "Andrew Morton"<akpm@linux-foundation.org>; "Fuxin Zhang"<zhangfx@lemote.com>; "linux-mm"<linux-mm@kvack.org>; "linux-kernel"<linux-kernel@vger.kernel.org>; "stable"<stable@vger.kernel.org>;
Subject: Re: [V5, 2/3] mm: dmapool: Align to ARCH_DMA_MINALIGN innon-coherent DMA mode
On Mon, Sep 18, 2017 at 10:44:54AM +0100, Robin Murphy wrote:
> On 18/09/17 05:22, Huacai Chen wrote:
> > In non-coherent DMA mode, kernel uses cache flushing operations to
> > maintain I/O coherency, so the dmapool objects should be aligned to
> > ARCH_DMA_MINALIGN. Otherwise, it will cause data corruption, at least
> > on MIPS:
> >
> > Step 1, dma_map_single
> > Step 2, cache_invalidate (no writeback)
> > Step 3, dma_from_device
> > Step 4, dma_unmap_single
>
> This is a massive red warning flag for the whole series, because DMA
> pools don't work like that. At best, this will do nothing, and at worst
> it is papering over egregious bugs elsewhere. Streaming mappings of
> coherent allocations means completely broken code.
Oh, I hadn't even seen that part. Yes, dma coherent (and pool)
allocations must never be used for streaming mappings. I wish we'd
have some debug infrastructure to warn on such uses.
next prev parent reply other threads:[~2017-09-19 2:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-18 4:22 [PATCH V5 2/3] mm: dmapool: Align to ARCH_DMA_MINALIGN in non-coherent DMA mode Huacai Chen
2017-09-18 5:22 ` Christoph Hellwig
2017-09-18 6:55 ` [PATCH V5 2/3] mm: dmapool: Align to ARCH_DMA_MINALIGN innon-coherent " 陈华才
2017-09-18 9:44 ` [V5, 2/3] mm: dmapool: Align to ARCH_DMA_MINALIGN in non-coherent " Robin Murphy
2017-09-18 15:51 ` Christoph Hellwig
2017-09-19 2:23 ` 陈华才 [this message]
2017-09-18 15:45 ` [PATCH V5 " Christoph Hellwig
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=tencent_27AD421B310F475224638DF3@qq.com \
--to=chenhc@lemote.com \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=robin.murphy@arm.com \
--cc=stable@vger.kernel.org \
--cc=zhangfx@lemote.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).