From: Christoph Hellwig <hch@lst.de>
To: John Garry <john.g.garry@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Robin Murphy <robin.murphy@arm.com>,
Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
iommu@lists.linux.dev, linux-nvme@lists.infradead.org
Subject: Re: dma_opt_mapping_size returns way too low sizes when using IOMMU
Date: Mon, 17 Aug 2026 11:18:40 +0200 [thread overview]
Message-ID: <20260817091840.GA26843@lst.de> (raw)
In-Reply-To: <86f7fbdc-3c7f-4d84-871e-52ed3cfe8d58@oracle.com>
On Mon, Aug 17, 2026 at 10:12:25AM +0100, John Garry wrote:
> On 17/08/2026 09:36, Christoph Hellwig wrote:
>> Hi all,
>>
>> I got reports that NVMe devices were arbitrarily limited to 128kiB
>> transfers in recent kernel.
>
> How recent a kernel? This NVMe and DMA mapping code has not changed in
> years as far as I know.
This was hardware QA moving from an old distro kernel to a "recent" (aka
still old) one. But I've actually reproduced it locally on an
upstream kernel. I guess most kernel developers or power users simply
do not run with IOMMU enabled.
>> Both the NVMe performance numbers and common sense suggest that this
>> is NOT the optimal DMA mapping granularity. Can we pick a saner value
>> for iommu_dma_opt_mapping_size that does not restrict common I/O sizes?
>
> Note that SCSI does not use iommu_dma_opt_mapping_size() for clamping max
> HW sectors, but instead sets opt size / max sectors from this value (so it
> is not a hard limit there). Could we consider similar for NVMe?
We could consider that, but it would still reduce performane..
> The reason for which we have iommu_dma_opt_mapping_size() is that
> performance can go through the floor we can't use the rcache for getting
> the IOVA, i.e. we need to always alloc and dealloc an IOVA from the RB tree
> for each mapping, and this can greatly reduce performance when the IOVA
> space fills.
>
> If we increase IOVA_RANGE_CACHE_MAX_SIZE, then we just get caching of
> larger IOVAs and I am not sure that is a great idea.
At least on the four different nvme devices I tested, the larger I/O
sizes made up for this. But maybe the details depend on other
factors as well.
next prev parent reply other threads:[~2026-08-17 9:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 8:36 dma_opt_mapping_size returns way too low sizes when using IOMMU Christoph Hellwig
2026-08-17 9:12 ` John Garry
2026-08-17 9:18 ` Christoph Hellwig [this message]
2026-08-17 10:11 ` John Garry
2026-08-17 17:04 ` Robin Murphy
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=20260817091840.GA26843@lst.de \
--to=hch@lst.de \
--cc=iommu@lists.linux.dev \
--cc=john.g.garry@oracle.com \
--cc=joro@8bytes.org \
--cc=linux-nvme@lists.infradead.org \
--cc=m.szyprowski@samsung.com \
--cc=robin.murphy@arm.com \
--cc=will@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.