From: Joe Damato <joe@dama.to>
To: iommu@lists.linux.dev, "Joerg Roedel (AMD)" <joro@8bytes.org>,
linux-kernel@vger.kernel.org, Robin Murphy <robin.murphy@arm.com>,
Will Deacon <will@kernel.org>
Subject: Re: [PATCH 0/2] iommu/dma: Skip iova_to_phys() on unmap for coherent devices
Date: Tue, 1 Dec 2026 09:48:44 -0800 [thread overview]
Message-ID: <aw8IfEFUUIN8O/5I@devvm20253.cco0.facebook.com> (raw)
In-Reply-To: <20261106175745.3362057-1-joe@dama.to>
On Fri, Nov 06, 2026 at 09:57:41AM -0800, Joe Damato wrote:
> Greetings:
>
> iommu_dma_unmap_phys() calls iommu_iova_to_phys() on every unmap, which
> walks the IOMMU page table. The physical address it returns is only used
> for devices that are non-coherent or use a swiotlb.
>
> For a coherent device that does not use swiotlb, the lookup is not
> needed. iommu_dma_sync_single_for_cpu() and
> iommu_dma_sync_single_for_device() already skip it for these devices, as
> does __iommu_dma_iova_unlink() for the dma_iova_link() API.
>
> Patch 1 factors the check out into a helper. Patch 2 uses the helper to
> skip the lookup in iommu_dma_unmap_phys().
>
> I split this into two patches because I thought it would make review and
> bisect easier, but I can make them a single patch if needed.
>
> One behavior change: for these devices the WARN_ON(!phys) in
> iommu_dma_unmap_phys() is no longer reached, so unmapping an IOVA that
> is not mapped no longer warns there. CONFIG_DMA_API_DEBUG still catches
> this class of driver bug.
>
> I tested on prod hosts serving TX heavy network traffic, which unmaps TX
> buffers on completion.
>
> Intel Xeon Gold 6138 (Skylake), VT-d:
>
> - iova_to_phys() on unmap: 119-143 ns per TX packet (~0.5% of busy
> CPU) before, 0 after
>
> AMD EPYC 9334 (Genoa), AMD IOMMU:
>
> - iova_to_phys() on unmap: ~10 ns per TX packet (~0.1% of busy CPU)
> before, 0 after
>
> So, the performance improvement is small, but measureable. The proposed
> change removes redundant work in the unmap, though, making it match the map
> path.
>
> Thanks,
> Joe
>
> Joe Damato (2):
> iommu/dma: Add helper for coherent devs without swiotlb
> iommu/dma: Skip iova_to_phys() on unmap when unneeded
>
> drivers/iommu/dma-iommu.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
>
> base-commit: f66469d9905b39d2c260a15d7d6db450f4db67c1
Hi:
Just wanted to ping on the above. Sorry, I think my git settings were a little
off and I realized my cover letter had no To line.
Not sure if I need to resend the series or not, but I haven't heard anything
in a few weeks.
Thanks,
Joe
prev parent reply other threads:[~2026-12-01 17:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 17:57 Joe Damato
2026-11-06 17:57 ` [PATCH 1/2] iommu/dma: Add helper for coherent devs without swiotlb Joe Damato
2026-12-01 20:30 ` Robin Murphy
2026-11-06 17:57 ` [PATCH 2/2] iommu/dma: Skip iova_to_phys() on unmap when unneeded Joe Damato
2026-12-01 17:48 ` Joe Damato [this message]
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=aw8IfEFUUIN8O/5I@devvm20253.cco0.facebook.com \
--to=joe@dama.to \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®