[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220801180146.GB17256@lst.de>
Date: Mon, 1 Aug 2022 20:01:46 +0200
From: Christoph Hellwig <hch@....de>
To: Robin Murphy <robin.murphy@....com>
Cc: yf.wang@...iatek.com, Christoph Hellwig <hch@....de>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Matthias Brugger <matthias.bgg@...il.com>,
"open list:DMA MAPPING HELPERS" <iommu@...ts.linux.dev>,
open list <linux-kernel@...r.kernel.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-arm-kernel@...ts.infradead.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@...ts.infradead.org>, wsd_upstream@...iatek.com,
Libo Kang <Libo.Kang@...iatek.com>,
Ning Li <Ning.Li@...iatek.com>, Yong Wu <Yong.Wu@...iatek.com>,
Miles Chen <miles.chen@...iatek.com>
Subject: Re: [PATCH] dma-debug: Remove warning in dma_debug_entry
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.
Powered by blists - more mailing lists