From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-block@vger.kernel.org, Keith Busch <kbusch@kernel.org>,
Jens Axboe <axboe@kernel.dk>,
ming.lei@redhat.com
Subject: Re: [Regression] b1a000d3b8ec ("block: relax direct io memory alignment")
Date: Wed, 16 Oct 2024 16:31:45 +0800 [thread overview]
Message-ID: <Zw958YtMExrNhUxy@fedora> (raw)
In-Reply-To: <20241016080419.GA30713@lst.de>
On Wed, Oct 16, 2024 at 10:04:19AM +0200, Christoph Hellwig wrote:
> On Wed, Oct 16, 2024 at 12:40:13AM +0800, Ming Lei wrote:
> > Hello Guys,
> >
> > Turns out host controller's DMA alignment is often too relax, so two DMA
> > buffers may cross same cache line easily, and trigger the warning of
> > "cacheline tracking EEXIST, overlapping mappings aren't supported".
> >
> > The attached test code can trigger the warning immediately with CONFIG_DMA_API_DEBUG
> > enabled when reading from one scsi disk which queue DMA alignment is 3.
> >
>
> We should not allow smaller than cache line alignment on architectures
> that are not cache coherent indeed.
Yes, something like the following change:
diff --git a/block/blk-settings.c b/block/blk-settings.c
index a446654ddee5..26bd0e72c68e 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -348,7 +348,9 @@ static int blk_validate_limits(struct queue_limits *lim)
*/
if (!lim->dma_alignment)
lim->dma_alignment = SECTOR_SIZE - 1;
- if (WARN_ON_ONCE(lim->dma_alignment > PAGE_SIZE))
+ else if (lim->dma_alignment < L1_CACHE_BYTES - 1)
+ lim->dma_alignment = L1_CACHE_BYTES - 1;
+ else if (WARN_ON_ONCE(lim->dma_alignment > PAGE_SIZE))
return -EINVAL;
if (lim->alignment_offset) {
Thanks,
Ming
next prev parent reply other threads:[~2024-10-16 8:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-15 16:40 [Regression] b1a000d3b8ec ("block: relax direct io memory alignment") Ming Lei
2024-10-16 8:04 ` Christoph Hellwig
2024-10-16 8:31 ` Ming Lei [this message]
2024-10-16 12:31 ` Christoph Hellwig
2024-10-22 1:21 ` Ming Lei
2024-10-22 7:25 ` Christoph Hellwig
2024-10-22 2:15 ` Jens Axboe
2024-10-22 10:24 ` Catalin Marinas
2024-10-23 0:50 ` Ming Lei
2024-10-23 6:12 ` Christoph Hellwig
2024-10-23 8:14 ` Ming Lei
2024-10-23 12:23 ` Christoph Hellwig
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=Zw958YtMExrNhUxy@fedora \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox