All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ioana Ciornei <ioana.ciornei@nxp.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jeremy Linton <jeremy.linton@arm.com>,
	Hamza Mahfooz <someguy@effective-light.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Robin Murphy <robin.murphy@arm.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	Dan Williams <dan.j.williams@intel.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: DPAA2 triggers, [PATCH] dma debug: report -EEXIST errors in add_dma_entry
Date: Fri, 1 Oct 2021 09:21:13 +0000	[thread overview]
Message-ID: <20211001092112.ndi43juysd2vg6zm@skbuf> (raw)
In-Reply-To: <20211001041959.GA17448@lst.de>

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

WARNING: multiple messages have this Message-ID (diff)
From: Ioana Ciornei <ioana.ciornei@nxp.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Hamza Mahfooz <someguy@effective-light.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jeremy Linton <jeremy.linton@arm.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Robin Murphy <robin.murphy@arm.com>
Subject: Re: DPAA2 triggers, [PATCH] dma debug: report -EEXIST errors in add_dma_entry
Date: Fri, 1 Oct 2021 09:21:13 +0000	[thread overview]
Message-ID: <20211001092112.ndi43juysd2vg6zm@skbuf> (raw)
In-Reply-To: <20211001041959.GA17448@lst.de>

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
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2021-10-01  9:21 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 12:54 [PATCH] dma debug: report -EEXIST errors in add_dma_entry Hamza Mahfooz
2021-05-18 12:54 ` Hamza Mahfooz
2021-06-22  7:41 ` Christoph Hellwig
2021-06-22  7:41   ` Christoph Hellwig
2021-09-09  3:33 ` DPAA2 triggers, " Jeremy Linton
2021-09-09  3:33   ` Jeremy Linton
2021-09-09 21:16   ` Ioana Ciornei
2021-09-09 21:16     ` Ioana Ciornei
2021-09-10 10:23   ` Christoph Hellwig
2021-09-10 10:23     ` Christoph Hellwig
2021-09-14 15:45   ` Ioana Ciornei
2021-09-14 15:45     ` Ioana Ciornei
2021-09-30 13:37     ` Karsten Graul
2021-09-30 13:37       ` Karsten Graul
2021-10-01 12:52       ` Gerald Schaefer
2021-10-01 12:52         ` Gerald Schaefer
2021-10-06 13:10         ` Gerald Schaefer
2021-10-06 13:10           ` Gerald Schaefer
2021-10-06 13:21           ` Gerald Schaefer
2021-10-06 13:21             ` Gerald Schaefer
2021-10-06 14:23           ` Robin Murphy
2021-10-06 14:23             ` Robin Murphy
2021-10-06 15:06             ` Gerald Schaefer
2021-10-06 15:06               ` Gerald Schaefer
2021-10-07 10:59             ` Karsten Graul
2021-10-07 10:59               ` Karsten Graul
2021-10-07 16:40               ` Gerald Schaefer
2021-10-07 16:40                 ` Gerald Schaefer
2021-10-11 11:47               ` Christoph Hellwig
2021-10-11 11:47                 ` Christoph Hellwig
2021-10-01  4:19     ` Christoph Hellwig
2021-10-01  4:19       ` Christoph Hellwig
2021-10-01  9:21       ` Ioana Ciornei [this message]
2021-10-01  9:21         ` Ioana Ciornei

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=20211001092112.ndi43juysd2vg6zm@skbuf \
    --to=ioana.ciornei@nxp.com \
    --cc=dan.j.williams@intel.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jeremy.linton@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=netdev@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=someguy@effective-light.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.