From: David Laight <david.laight.linux@gmail.com>
To: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Cc: Leon Romanovsky <leon@kernel.org>,
m.szyprowski@samsung.com, hch@lst.de, robin.murphy@arm.com,
djbw@kernel.org, akpm@linux-foundation.org,
catalin.marinas@arm.com, harry@kernel.org, ming.lei@redhat.com,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dma-debug: skip cacheline overlap tracking on cache-coherent architectures
Date: Tue, 19 May 2026 10:06:06 +0100 [thread overview]
Message-ID: <20260519100606.6b3c91e3@pumpkin> (raw)
In-Reply-To: <CABXGCsMxZ7VieyzWEmpGdxohdbTJ_qf_1ZOw0eF5g9i0YeOc3w@mail.gmail.com>
On Mon, 18 May 2026 17:23:15 +0500
Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com> wrote:
> On Mon, May 18, 2026 at 5:10 PM Leon Romanovsky <leon@kernel.org> wrote:
> >
> > I would say this reproducer is incorrect. From what I recall, the only two
> > legitimate use cases for cacheline overlap are virtio and RDMA.
>
> The wild trace in the commit message is NVMe block I/O -- neither virtio
> nor RDMA:
>
> add_dma_entry -> debug_dma_map_phys -> dma_map_phys ->
> blk_dma_map_iter_start -> nvme_map_data
>
> The block layer submits many concurrent in-flight requests; small
> kmalloc'd buffers naturally land in the same cacheline under high IOPS,
Isn't there a flag to kmalloc() that indicates the buffers will be used
for dma and mustn't share a cache line with anything else writable.
(Which means the size must be rounded up to a multiple of the cache
line size.)
For DMA_FROM_DEVICE it is important that the cpu doesn't dirty the cache
lines.
This is probably worse on systems with 256 byte cache lines.
-- David
> which is incidental rather than intentional overlap. Ming Lei's report
> linked in the commit message [1] enumerates additional non-virtio /
> non-RDMA cases hitting the same WARN: liburing iopoll tests, raid1,
> dm-thin and other storage utilities.
>
> > The first intentionally relies on it for small allocations, and the second exports the
> > cachelines to the user space and cannot operate on non‑coherent architectures.
>
> The reproducer isn't claiming to be either of those. It deterministically
> reaches the same state-based gate the wild NVMe trace hits
> (!is_cache_clean && overlap > 7, with direction != DMA_TO_DEVICE, after
> the v2 coherent-arch / SWIOTLB-bounce suppressions are evaluated). Since
> that gate has no subsystem-specific term, any caller -- synthetic or real
> -- reaching it with those state values triggers the same WARN.
>
> If the broader concern is that the block layer should opt into your
> coherency-attribute work rather than relying on debug-side suppression,
> that's a reasonable longer-term direction. But it's additive: even with
> opt-in adoption, the WARN remains a false positive on coherent arches
> for callers that don't annotate -- which is exactly what v2 (3d48c9fd78dd)
> already established for the sibling "cacheline tracking EEXIST" err_printk.
>
> [1] https://lore.kernel.org/all/ZwxzdWmYcBK27mUs@fedora/
>
next prev parent reply other threads:[~2026-05-19 9:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 11:32 [PATCH] dma-debug: skip cacheline overlap tracking on cache-coherent architectures Mikhail Gavrilov
2026-05-18 12:10 ` Leon Romanovsky
2026-05-18 12:23 ` Mikhail Gavrilov
2026-05-18 12:53 ` Leon Romanovsky
2026-05-18 13:29 ` Mikhail Gavrilov
2026-05-19 7:17 ` Christoph Hellwig
2026-05-19 8:03 ` Mikhail Gavrilov
2026-05-19 9:28 ` Christoph Hellwig
2026-05-19 9:57 ` Mikhail Gavrilov
2026-05-19 11:49 ` Christoph Hellwig
2026-05-19 9:06 ` David Laight [this message]
2026-05-19 9:18 ` Mikhail Gavrilov
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=20260519100606.6b3c91e3@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=djbw@kernel.org \
--cc=harry@kernel.org \
--cc=hch@lst.de \
--cc=iommu@lists.linux.dev \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mikhail.v.gavrilov@gmail.com \
--cc=ming.lei@redhat.com \
--cc=robin.murphy@arm.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