Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Marek Szyprowski <m.szyprowski@samsung.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	John Garry <john.g.garry@oracle.com>,
	iommu@lists.linux.dev, linux-nvme@lists.infradead.org
Subject: dma_opt_mapping_size returns way too low sizes when using IOMMU
Date: Mon, 17 Aug 2026 10:36:54 +0200	[thread overview]
Message-ID: <20260817083654.GA23414@lst.de> (raw)

Hi all,

I got reports that NVMe devices were arbitrarily limited to 128kiB
transfers in recent kernel.  It turns out that this only happens when
using an IOMMU and is caused by iommu_dma_opt_mapping_size returning
iova_rcache_range(), which is defined as follows:

unsigned long iova_rcache_range(void)
{
	return PAGE_SIZE << (IOVA_RANGE_CACHE_MAX_SIZE - 1);
}

and thus indeed hardcodes a 128kiB return on 4k page size architectures.

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?


             reply	other threads:[~2026-08-17  8:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17  8:36 Christoph Hellwig [this message]
2026-08-17  9:12 ` dma_opt_mapping_size returns way too low sizes when using IOMMU John Garry
2026-08-17  9:18   ` Christoph Hellwig
2026-08-17 10:11     ` John Garry
2026-08-17 17:04       ` Robin Murphy
2026-08-19  8:57         ` Christoph Hellwig
2026-08-19  8:51       ` 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=20260817083654.GA23414@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox