Linux IOMMU Development
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Robin Murphy <robin.murphy@arm.com>
Cc: yf.wang@mediatek.com, Christoph Hellwig <hch@lst.de>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	"open list:DMA MAPPING HELPERS" <iommu@lists.linux.dev>,
	open list <linux-kernel@vger.kernel.org>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-arm-kernel@lists.infradead.org>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>,
	wsd_upstream@mediatek.com, Libo Kang <Libo.Kang@mediatek.com>,
	Ning Li <Ning.Li@mediatek.com>, Yong Wu <Yong.Wu@mediatek.com>,
	Miles Chen <miles.chen@mediatek.com>
Subject: Re: [PATCH] dma-debug: Remove warning in dma_debug_entry
Date: Mon, 1 Aug 2022 20:01:46 +0200	[thread overview]
Message-ID: <20220801180146.GB17256@lst.de> (raw)
In-Reply-To: <19a0a508-fb39-8b06-ce0f-ce26767ef57f@arm.com>

On Mon, Aug 01, 2022 at 01:07:10PM +0100, Robin Murphy wrote:
> Furthermore, even for the valid dma-buf import case I'm not convinced that 
> the SKIP_CPU_SYNC check can be dropped either. If one device can import a 
> buffer while another device is already accessing it, there are definitely 
> combinations of parameters which could lead to potential data loss (e.g. a 
> non-coherent DMA_TO_DEVICE mapping during a non-coherent DMA_FROM_DEVICE 
> access, a or non-coherent DMA_FROM_DEVICE mapping during a coherent 
> DMA_TO_DEVICE access).

Yes.  While there is a rare case where double mapping actually works
(exactly the same region, no access to the data between the invidual
mapping and unmapping calls), there is absolutely no good reason to
support it.  The additional cache maintainance operations will still
take some overhead that can be skipped, and it makes the rules very
confusing.  It is much better to fix the upper layers to use
the SKIP_CPU_SYNC flag in case of multiple mappings, which also
clearly documents what is being done there.

      reply	other threads:[~2022-08-01 18:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-30  8:56 [PATCH] dma-debug: Remove warning in dma_debug_entry yf.wang
2022-08-01 12:07 ` Robin Murphy
2022-08-01 18:01   ` 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=20220801180146.GB17256@lst.de \
    --to=hch@lst.de \
    --cc=Libo.Kang@mediatek.com \
    --cc=Ning.Li@mediatek.com \
    --cc=Yong.Wu@mediatek.com \
    --cc=iommu@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=m.szyprowski@samsung.com \
    --cc=matthias.bgg@gmail.com \
    --cc=miles.chen@mediatek.com \
    --cc=robin.murphy@arm.com \
    --cc=wsd_upstream@mediatek.com \
    --cc=yf.wang@mediatek.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