[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211001092112.ndi43juysd2vg6zm@skbuf>
Date: Fri, 1 Oct 2021 09:21:13 +0000
From: Ioana Ciornei <ioana.ciornei@....com>
To: Christoph Hellwig <hch@....de>
CC: Jeremy Linton <jeremy.linton@....com>,
Hamza Mahfooz <someguy@...ective-light.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Robin Murphy <robin.murphy@....com>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
Dan Williams <dan.j.williams@...el.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: DPAA2 triggers, [PATCH] dma debug: report -EEXIST errors in
add_dma_entry
On Fri, Oct 01, 2021 at 06:19:59AM +0200, Christoph Hellwig wrote:
> On Tue, Sep 14, 2021 at 03:45:06PM +0000, Ioana Ciornei wrote:
> > [ 245.927020] fsl_dpaa2_eth dpni.3: scather-gather idx 0 P=20a7320000 N=20a7320 D=20a7320000 L=30 DMA_BIDIRECTIONAL dma map error check not applicableĀ·
> > [ 245.927048] fsl_dpaa2_eth dpni.3: scather-gather idx 1 P=20a7320030 N=20a7320 D=20a7320030 L=5a8 DMA_BIDIRECTIONAL dma map error check not applicable
> > [ 245.927062] DMA-API: cacheline tracking EEXIST, overlapping mappings aren't supported
> >
> > The first line is the dump of the dma_debug_entry which is already present
> > in the radix tree and the second one is the entry which just triggered
> > the EEXIST.
> >
> > As we can see, they are not actually overlapping, at least from my
> > understanding. The first one starts at 0x20a7320000 with a size 0x30
> > and the second one at 0x20a7320030.
>
> They overlap the cache lines. Which means if you use this driver
> on a system that is not dma coherent you will corrupt data.
This is a driver of an integrated ethernet controller which is DMA
coherent.
I added a print just to make sure of this:
--- a/kernel/dma/debug.c
+++ b/kernel/dma/debug.c
@@ -567,6 +567,7 @@ static void add_dma_entry(struct dma_debug_entry *entry)
pr_err("cacheline tracking ENOMEM, dma-debug disabled\n");
global_disable = true;
} else if (rc == -EEXIST) {
+ pr_err("dev_is_dma_coherent(%s) = %d\n", dev_name(entry->dev), dev_is_dma_coherent(entry->dev));
err_printk(entry->dev, entry,
"cacheline tracking EEXIST, overlapping mappings aren't supported\n");
}
[ 85.852218] DMA-API: dev_is_dma_coherent(dpni.3) = 1
[ 85.858891] ------------[ cut here ]------------
[ 85.858893] DMA-API: fsl_dpaa2_eth dpni.3: cacheline tracking EEXIST, overlapping mappings aren't supported
[ 85.858901] WARNING: CPU: 13 PID: 1046 at kernel/dma/debug.c:571 add_dma_entry+0x330/0x390
[ 85.858911] Modules linked in:
[ 85.858915] CPU: 13 PID: 1046 Comm: iperf3 Not tainted 5.15.0-rc2-00478-g34286ba6a164-dirty #1275
[ 85.858919] Hardware name: NXP Layerscape LX2160ARDB (DT)
Shouldn't this case not generate this kind of warning?
Ioana
Powered by blists - more mailing lists