From: Leon Romanovsky <leon@kernel.org>
To: Robin Murphy <robin.murphy@arm.com>
Cc: "Marek Szyprowski" <m.szyprowski@samsung.com>,
"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
"Arnd Bergmann" <arnd@arndb.de>, "Vinod Koul" <vkoul@kernel.org>,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dma-debug: Skip cacheline tracking for MMIO mappings
Date: Tue, 13 Oct 2026 18:05:46 +0300 [thread overview]
Message-ID: <20261013150546.GR219304@unreal> (raw)
In-Reply-To: <e7b6e74a-4ec9-4146-a6b0-9183a9fb7933@arm.com>
On Tue, Oct 13, 2026 at 01:43:56PM +0100, Robin Murphy wrote:
> On 13/10/2026 12:44 pm, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@nvidia.com>
> >
> > Mapping one MMIO dma-buf for many RDMA importers overflows dma-debug's
> > cacheline overlap counter and triggers a warning. DMA_ATTR_MMIO mappings
> > must never be CPU-cacheable, so CPU cacheline overlap tracking does not
> > apply to them.
> >
> > Skip MMIO entries in both cacheline insertion and removal. Keep them in
> > the DMA entry hash so mapping and unmapping checks still run.
>
> Seems fair;
>
> Reviewed-by: Robin Murphy <robin.murphy@arm.com>
>
> [...]
> >
> > Fixes: 0e74b34dfc33 ("dma-debug: add support for resource mappings")
>
> Although it would be a challenge to backport _that_ far, so more
> realistically I'd probably say:
>
> Fixes: 3aa31a8bb11e ("dma-buf: provide phys_vec to scatter-gather mapping
> routine")
This error was probably observed when we started exercising dma-buf in
various corner cases.
Thanks
>
> since regular dma_map_resource() users are still never going to hit this
> making their one-off mapping of a UART FIFO or whatever.
>
> Thanks,
> Robin.
>
> > Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> > ---
> > kernel/dma/debug.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
> > index 026d50de340e..36c1f7cbb2ae 100644
> > --- a/kernel/dma/debug.c
> > +++ b/kernel/dma/debug.c
> > @@ -489,8 +489,10 @@ static int active_cacheline_insert(struct dma_debug_entry *entry,
> > /* If the device is not writing memory then we don't have any
> > * concerns about the cpu consuming stale data. This mitigates
> > * legitimate usages of overlapping mappings.
> > + * MMIO mappings are never CPU-cacheable and do not need tracking either.
> > */
> > - if (entry->direction == DMA_TO_DEVICE)
> > + if (entry->direction == DMA_TO_DEVICE ||
> > + entry->attrs & DMA_ATTR_MMIO)
> > return 0;
> > spin_lock_irqsave(&radix_lock, flags);
> > @@ -519,7 +521,8 @@ static void active_cacheline_remove(struct dma_debug_entry *entry)
> > unsigned long flags;
> > /* ...mirror the insert case */
> > - if (entry->direction == DMA_TO_DEVICE)
> > + if (entry->direction == DMA_TO_DEVICE ||
> > + entry->attrs & DMA_ATTR_MMIO)
> > return;
> > spin_lock_irqsave(&radix_lock, flags);
> >
> > ---
> > base-commit: 39d3758108bb0ef9da484062d65288bbe9cada0e
> > change-id: 20261013-dma-debug-fixes-5aaf1bb17544
> >
> > Best regards,
> > --
> > Leon Romanovsky <leonro@nvidia.com>
> >
>
>
next prev parent reply other threads:[~2026-10-13 15:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 11:44 [PATCH] dma-debug: Skip cacheline tracking for MMIO mappings Leon Romanovsky
2026-10-13 12:43 ` Robin Murphy
2026-10-13 15:05 ` Leon Romanovsky [this message]
2026-10-13 15:14 ` Marek Szyprowski
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=20261013150546.GR219304@unreal \
--to=leon@kernel.org \
--cc=arnd@arndb.de \
--cc=iommu@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=robin.murphy@arm.com \
--cc=vkoul@kernel.org \
/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.